Options
All
  • Public
  • Public/Protected
  • All
Menu

@derschmale/tympanum

Index

Type aliases

Vector

Vector: number[] | Float32Array

Vector is the representation for any N-dimensional vector. This can be either an array of numbers, or a Float32Array.

Functions

barycentricCoords

  • Calculates the barycentric coordinates for a given point and a Facet. Every element of the coordinate is the weight for the facet's vertex at the corresponding index.

    author

    derschmale http://www.derschmale.com

    Parameters

    • position: Vector

      The position to calculate the barycentric coords for.

    • facet: Facet

      The Facet relative to which the coords are calculated.

    • points: Vector[]

      The points array indexed by Facet.

    • Optional tgt: Vector

      An optional target to store the results. For dimension N, must be of length N+1.

    Returns Vector

createSimplex

  • createSimplex(points: Vector[], indices?: number[]): Facet[]
  • Creates an N-simplex from N+1 points. The dimension of the points are used to define the dimension of the simplex.

    author

    derschmale http://www.derschmale.com

    Parameters

    • points: Vector[]

      An array of points. Only the first N+1 points are used.

    • Optional indices: number[]

      An optional array of indices into points to define which points in the set are used.

    Returns Facet[]

delaunay

quickHull

  • QuickHull implements the algorithm of the same name, based on the original paper by Barber, Dobkin and Huhdanpaa. We're not interested in 0- or 1-dimensional cases (the latter can simply be the extent of the point values). QuickHull returns a set of indices into the original point list so we can map it to a different original ata set (fe: points may be a mapping for position vectors on some scene graph object).

    author

    derschmale http://www.derschmale.com

    Parameters

    Returns Facet[]

visibilityWalk

  • Performs the visibility walk algorithm to find the Facet containing the given position. This should only be used on Delaunay triangulations, as other triangulations are not guaranteed to resolve to a solution.

    Parameters

    • position: Vector

      The position to search for.

    • facets: Facet[]

      The facets to search

    • points: Vector[]

      The points indexed by the facets.

    • Optional startFacet: Facet

      An optional facet to start the search. If none is provided, an initial search estimate is made, but this is not guaranteed to be a performance improvement.

    Returns Facet

  • Performs the visibility walk algorithm to find the Facet containing the given position. This should only be used on Delaunay triangulations, as other triangulations are not guaranteed to resolve to a solution.

    Parameters

    • position: Vector

      The position to search for.

    • facets: Facet[]

      The facets to search

    • points: Vector[]

      The points indexed by the facets.

    • Optional estimate: boolean

      If true, searches the facets to find an initial match.

    Returns Facet

Generated using TypeDoc