Pranshu258 / Field-Aligned-Mesh

Designing and visualizing a continuous vector field over a planar base triangle mesh and to further construct a new mesh in which most triangles have edges aligned with the underlying vector field

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Field Aligned Triangle Meshes

The goal of this project is to implement algorithms for designing and visualizing a continuous vector field over a planar base triangle mesh and to further construct a new mesh in which most triangles have one edge aligned with the underlying vector field. Finally, some practical applications of such meshes are discussed.

Introduction

The construction of structure must consider the forces that will be incident upon it. These force can be represented as a vector field over the points contained in the structure. In most cases, it is impractical to ascertain the value of the field at every point in the structure, therefore, a set of constraints are considered i.e., a set of points at which the force field is known. The remaining field is then constructed by interpolating between these constraints.

Solving for Unconstrained Vectors

It is possible that a point is required to be sampled on the structure but it is difficult to measure the field at that point. In such scenarios, an algorithm to solve the vector field at these locations is needed. One such algorithm is iterative tuck-untuck smoothing, in which each vector moves towards the average of it's neighbors (tuck), followed by it moving away from the new averages (untuck), and finally all the known constrained vectors are restored (snap). This procedure is repeated iteratively for a pre-defined maximum number of iterations.

Visualizing the Vector Field

In order to visualize the approximate vector field with the given constraints, it is first partitioned into triangular faces using the delaunay triangulation algorithm and then the field is defined inside each triangle by assuming a linear interpolation of the constraints, within each triangle. This linear interpolation can be achieved using the normalized barycentric co-ordinates of a point inside a triangle.

Tracing the Vector Field

In order to create a field aligned mesh, we first need to generate a set of curve which define the shape of the vector field inside a triangle. These curves are generated by tracing the vector field in all the triangles in the mesh. The algorithm for generating these curves:

  • Start at the triangle which contains the cursor.
  • Pick the mid point of an edge of the triangle.
  • Start tracing the curve from the point by moving in small steps in the direction of the vector field at each point.
  • Once the tracing is completed inside a triangle, mark it as visited
  • If a trace spirals inside a triangle, stop the tracing after a few steps.
  • Then pick the next unvisited triangle and start tracing from the mid point of one of its edges.
  • In some cases, the field in the triangle is defined in such a way that one can't enter the triangle from any edge. Such cases are identified, and the triangle is marked as visited.

Building the Field Aligned Mesh

Once the sample traces have been generated, they can be used to create new edges for the field aligned mesh. One way to create it is by joining the mid points of the trace to the edge intersections and the three vertices of the triangle. This creates 5 new triangles, 4 which will have exactly one edge along the field

However, in this mesh 5 new edges are being introduced per triangle. Another way to create a sparse mesh is to connect the mid points of generated trace in each triangle to those of the neighboring 3 triangles and the vertices of it's own triangle. Then all the old, non border edges are removed.

Comparison: Dense and Sparse Field Aligned Meshes

The dense mesh is easier to compute, as it does not require any neighborhood information and the new triangulation can be done while tracing the field in a triangle. Whereas, the sparse mesh can only be computed once the tracing is complete. The actual construction would be costlier for the dense mesh as it has more edges. Thus, these two techniques offer a tradeoff between computation and resource efficiency.

Identifying Field Aligned Edges

In the dense mesh, the 2 edges that connect the mid point of the trace to its start and end point in the triangle are the ones which are aligned to the field. These edges are shown with a thicker stroke.

In the sparse mesh, the neighbor connecting edges are the generally the ones which are along the vector field. However, some of the neighbors might belong to different traces, whose direction at its mid point might not align with the direction of the vector field at a point. The alignment of these candidate edges with the field is tested by taking the dot product of the direction of an edge with the field at its start and end vertices. If they are aligned with at least one of these vector, they are drawn with a thicker stroke.

Keybindings

Key Binding
M Show the delaunay triangulation
$ Show subdivision of triangulation
m Show the trace from the triangle under mouse
N show the field aligned triangle mesh
g show the field
h show the tuck-untuck mesh
U Remove a triangle from consideration
G show Dense mesh
I show hide arrows
J show hide corners
1-9 load different point sets

Contributors

  • Pranshu Gupta
  • Harish Krupo KPS

About

Designing and visualizing a continuous vector field over a planar base triangle mesh and to further construct a new mesh in which most triangles have edges aligned with the underlying vector field


Languages

Language:Processing 99.7%Language:Python 0.3%