Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
hkhaung committed Feb 28, 2024
1 parent b00d772 commit 8f9fbce
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 22 deletions.
61 changes: 39 additions & 22 deletions homeworks/hw2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ <h3>Overview</h3>
Implemented Bezier curves and expanded them to also work on 3D
surfaces. Then, implemented Phong shading so that meshes can have
better shading. Finally, implemented loop subdivision to increase
resolution for low resolution polygon meshes by implementing helper
functions flipEdge and splitEdge.
resolution for low resolution polygon meshes by implementing local
remesh operations `flipEdge` and `splitEdge`.
</p>
</div>
</div>
Expand Down Expand Up @@ -359,7 +359,7 @@ <h3>Task 4: Edge Flip</h3>

<div class="text-start taskp mt-4 mb-5">
<p>
In this task, we implemented a remashing operation on an edge. This
In this task, we implemented a remeshing operation on an edge. This
operation flips an edge by changing its two endpoints, or vertices,
to another pair of vertices.
</p>
Expand All @@ -372,7 +372,14 @@ <h3>Task 4: Edge Flip</h3>
that we do not forget to reassign the pointers after the flip
operation. Finally, we perform the flip operation by changing the
given edge's two vertices to the other two vertices in the simple
mesh and reassigning all pointers.
mesh and reassigning all pointers. Keeping track of all elements and
doing so correctly was crucial in ensuring that they were no bugs in
this function. This required a complete understanding of the
halfedge data structure which we did not have initially. We were
confused with halfedge->vertex; we initially thought
halfedge->vertex meant the vertex pointed to by the halfedge. After
fully understanding how the halfedge datastructure worked, we were
able to easily implement the flip operation.
</p>

<br />
Expand Down Expand Up @@ -410,25 +417,26 @@ <h3>Task 5: Edge Split</h3>

<div class="text-start taskp mt-4 mb-5">
<p>
In this task, we implemented a remashing operation on an edge. This
In this task, we implemented a remeshing operation on an edge. This
operation splits the given edge and inserts a new vertex at the
midpoint and connects the two opposing vertex that were not
originally connected by the given edge.
</p>
<p>
To implement this, we first drew a diagram of two triangles
connected by a half-edge before the split. We labeled every pointer
in the diagram before we perform the operation just like we did in
`flipEdge`: halfedges, vertices, edges, and faces. In code, we
tracked all these pointers. Then, we drew a diagram of what would
happen to these two triangles after the split operation and labeled
what each pointer would point to. In code, this is done by using
`setNeighbor` function; we also had to create new halfedges, new
vertices, new edges, and faces which is done by calling
`newHalfedge`, `newVertex`, `newEdge`, and `newFace`. Overall, these
diagrams were key in helping us implement this function because they
helped us easily determine what each pointer should be reassigned
to.
Implementing this was similar to the implementation of `flipEdge`
except now, we have to account for new elements. To implement this,
we first drew a diagram of two triangles connected by a half-edge
before the split. We labeled every pointer in the diagram before we
perform the operation just like we did in `flipEdge`: halfedges,
vertices, edges, and faces. In code, we tracked all these pointers.
Then, we drew a diagram of what would happen to these two triangles
after the split operation and labeled what each pointer would point
to. In code, this is done by using `setNeighbor` function; we also
had to create new halfedges, new vertices, new edges, and faces
which is done by calling `newHalfedge`, `newVertex`, `newEdge`, and
`newFace`. Overall, these diagrams were key in helping us implement
this function because they helped us easily determine what each
pointer should be reassigned to.
</p>

<br />
Expand All @@ -437,15 +445,24 @@ <h3>Task 5: Edge Split</h3>
<table style="width=100%">
<tr>
<td>
<img src="task3.png" align="middle" width="400px" />
<img src="task5.png" align="middle" width="400px" />
<figcaption class="figcaption" align="middle">
Teapot without shading (without vertex normals)
Before any edge splits
</figcaption>
</td>
<td>
<img src="task3shading.png" align="middle" width="400px" />
<img src="task5_1.png" align="middle" width="400px" />
<figcaption class="figcaption" align="middle">
Teapot with shading
After an edge split
</figcaption>
</td>
</tr>
<br />
<tr>
<td>
<img src="task5_2.png" align="middle" width="400px" />
<figcaption class="figcaption" align="middle">
After some edge splits and edge flips
</figcaption>
</td>
</tr>
Expand Down
Binary file added homeworks/hw2/task5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added homeworks/hw2/task5_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added homeworks/hw2/task5_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8f9fbce

Please sign in to comment.