Options
All
  • Public
  • Public/Protected
  • All
Menu

Class representing an Halfedge Data Structure

Hierarchy

  • HalfedgeDS

Index

Constructors

Properties

faces: Face[] = ...
readonly

Faces

halfedges: Halfedge[] = ...
readonly

Halfedges

vertices: Vertex[] = ...
readonly

Vertices

Methods

  • 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.

    Parameters

    • v1: Vertex

      First vertex to link

    • v2: Vertex

      Second vertex to link

    • allowParallels: boolean = false

      Allows multiple pair of halfedges between vertices, default false

    Returns Halfedge

    Existing or new halfedge

  • addVertex(position: Vector3, checkDuplicates?: boolean, tolerance?: number): Vertex
  • 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.

    Parameters

    • position: Vector3

      New vertex position

    • checkDuplicates: boolean = false

      Enable/disable existing vertex matching, default false

    • tolerance: number = 1e-10

      Tolerance used for vertices position comparison

    Returns Vertex

  • clear(): void
  • 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;
    }

    Parameters

    • face: Face

      Face to cut

    • v1: Vertex

      1st vertex

    • v2: Vertex

      2nd vertex

    • createNewFace: boolean = true

      wether to create a new face or not when cutting

    Returns Halfedge

    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

    Returns Halfedge[]

  • removeEdge(halfedge: Halfedge, mergeFaces?: boolean): void
  • Removes an edge from the structrure

    Parameters

    • halfedge: Halfedge

      Halfedge to remove

    • mergeFaces: boolean = true

      If true, merges connected faces if any, otherwise removes them. Default true

    Returns void

  • removeFace(face: Face): void
  • removeVertex(vertex: Vertex, mergeFaces?: boolean): void
  • Removes a vertex from the structure

    Parameters

    • vertex: Vertex

      Vertex to remove

    • mergeFaces: boolean = true

      If true, merges connected faces if any, otherwise removes them. Default true

    Returns void

  • setFromGeometry(geometry: BufferGeometry, tolerance?: number): void
  • Sets the halfedge structure from a BufferGeometry.

    Parameters

    • geometry: BufferGeometry

      BufferGeometry to read

    • tolerance: number = 1e-10

      Tolerance distance from which positions are considered equal

    Returns void

  • splitEdge(halfedge: Halfedge, position: Vector3, tolerance?: number): Vertex
  • Splits the halfedge at position and returns the new vertex

    Parameters

    • halfedge: Halfedge
    • position: Vector3

      Position of the split vertex

    • tolerance: number = 1e-10

    Returns Vertex

    the new created vertex

Generated using TypeDoc