Adds an edge (i.e. a pair of halfedges) between the given vertices. Requires vertices to be free, i.e., there is at least one free halfedge (i.e. without face) in their neighborhood.
First vertex to link
Second vertex to link
Allows multiple pair of halfedges between vertices, default false
Existing or new halfedge
Adds a new vertex to the structure at the given position and returns it. If checkDuplicates is true, returns any existing vertex that matches the given position.
New vertex position
Enable/disable existing vertex matching, default false
Tolerance used for vertices position comparison
Clear the structure data
ts
Cuts the face
between the vertices v1
and v2
.
v1 and v2 must either be vertices of the face or isolated vertices.
To test if a new face is created, simply do
const halfedge = struct.cutFace(face, v1, v2, true);
if (halfedge.face !== halfedge.twin.face) {
// Halfedge are on different faces / loops
const existingFace = halfedge.face;
const newFace = halfedge.twin.face;
}
Face to cut
1st vertex
2nd vertex
wether to create a new face or not when cutting
the cutting halfedge
Returns an array of all the halfedge loops in the structure.
Note: Actually returns an array of halfedges from which loop generator can be called
Removes an edge from the structrure
Halfedge to remove
If true, merges connected faces if any, otherwise removes them. Default true
Removes a face from the structure.
Face to remove
Removes a vertex from the structure
Vertex to remove
If true, merges connected faces if any, otherwise removes them. Default true
Sets the halfedge structure from a BufferGeometry.
BufferGeometry to read
Tolerance distance from which positions are considered equal
Generated using TypeDoc
Class representing an Halfedge Data Structure