Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "index"

Index

Variables

Const closestPointSphere

closestPointSphere: closestPointCircle = closestPointCircle

Functions

Const closestBoxEdge

  • closestBoxEdge(p: ReadonlyVec, bmin: ReadonlyVec, bmax: ReadonlyVec, n: number): number[]
  • Parameters

    • p: ReadonlyVec
    • bmin: ReadonlyVec
    • bmax: ReadonlyVec
    • n: number

    Returns number[]

Const closestPointAABB

  • closestPointAABB(p: ReadonlyVec, bmin: ReadonlyVec, bmax: ReadonlyVec, out?: Vec): Vec
  • Parameters

    • p: ReadonlyVec
    • bmin: ReadonlyVec
    • bmax: ReadonlyVec
    • Default value out: Vec = []

    Returns Vec

Const closestPointArray

  • closestPointArray(p: ReadonlyVec, pts: Vec[], out?: Vec): undefined | Vec
  • Parameters

    • p: ReadonlyVec
    • pts: Vec[]
    • Default value out: Vec = []

    Returns undefined | Vec

Const closestPointCircle

  • closestPointCircle(p: ReadonlyVec, c: ReadonlyVec, r: number, out?: Vec): Vec
  • Parameters

    • p: ReadonlyVec
    • c: ReadonlyVec
    • r: number
    • Default value out: Vec = []

    Returns Vec

Const closestPointLine

  • closestPointLine(p: ReadonlyVec, a: ReadonlyVec, b: ReadonlyVec): Vec
  • Returns closest point to p on infinite line defined by points a and b. Use closestPointSegment to only consider the actual line segment between these two points.

    closestPointSegment

    Parameters

    • p: ReadonlyVec

      query point

    • a: ReadonlyVec

      line point A

    • b: ReadonlyVec

      line point B

    Returns Vec

Const closestPointPlane

  • closestPointPlane(p: ReadonlyVec, normal: ReadonlyVec, w: number, out?: Vec): Vec
  • Parameters

    • p: ReadonlyVec
    • normal: ReadonlyVec
    • w: number
    • Default value out: Vec = []

    Returns Vec

Const closestPointPolyline

  • closestPointPolyline(p: ReadonlyVec, pts: ReadonlyArray<Vec>, closed?: boolean, out?: Vec): undefined | Vec
  • Parameters

    • p: ReadonlyVec
    • pts: ReadonlyArray<Vec>
    • Default value closed: boolean = false
    • Default value out: Vec = []

    Returns undefined | Vec

Const closestPointRect

  • closestPointRect(p: ReadonlyVec, bmin: ReadonlyVec, bmax: ReadonlyVec, out?: Vec): Vec
  • Parameters

    • p: ReadonlyVec
    • bmin: ReadonlyVec
    • bmax: ReadonlyVec
    • Default value out: Vec = []

    Returns Vec

Const closestPointSegment

  • closestPointSegment(p: ReadonlyVec, a: ReadonlyVec, b: ReadonlyVec, out?: Vec, insideOnly?: boolean, eps?: number): undefined | Vec
  • Returns closest point to p on line segment a -> b. By default, if the result point lies outside the segment, returns a copy of the closest end point. The result is written to the optional out vector (or if omitted, a new one is created).

    If insideOnly is true, only returns the closest point iff it actually is inside the segment. The behavior of this configurable via the optional eps arg and by default includes both end points. This function uses closestT to compute the parametric position of the result point and determine if it lies within the line segment. If eps > 0, the end points a and b will be excluded from the match, effectively shortening the valid line segment from both ends, i.e. the valid interval of the parametric position will be [eps,1-eps]. If the result lies outside this interval, the function returns undefined. Likewise, if a and b are coincident.

    Parameters

    • p: ReadonlyVec

      query point

    • a: ReadonlyVec

      line point A

    • b: ReadonlyVec

      line point B

    • Optional out: Vec

      result

    • Default value insideOnly: boolean = false
    • Default value eps: number = 0

      epsilon value

    Returns undefined | Vec

Const closestT

  • closestT(p: ReadonlyVec, a: ReadonlyVec, b: ReadonlyVec): undefined | number
  • Computes the parametric distance t of point p projected onto line a -> b, relative to a. I.e. the projection of p can then be computed like so:

    example
    mixN([], a, b, closestT(p, a, b))

    If the return value is outside the closed [0,1] interval, the projected point lies outside the line segment. Returns undefined if a and b are coincident.

    Parameters

    • p: ReadonlyVec

      query point

    • a: ReadonlyVec

      line point A

    • b: ReadonlyVec

      line point B

    Returns undefined | number

Const distToLine

  • distToLine(p: ReadonlyVec, a: ReadonlyVec, b: ReadonlyVec): number
  • Returns distance from p to closest point to infinite line a -> b. Use distToSegment to only consider the actual line segment between these two points.

    distToSegment

    Parameters

    • p: ReadonlyVec

      query point

    • a: ReadonlyVec

      line point A

    • b: ReadonlyVec

      line point B

    Returns number

Const distToPlane

  • distToPlane(p: ReadonlyVec, n: ReadonlyVec, w: number): number
  • Parameters

    • p: ReadonlyVec
    • n: ReadonlyVec
    • w: number

    Returns number

Const distToSegment

  • distToSegment(p: ReadonlyVec, a: ReadonlyVec, b: ReadonlyVec): number
  • Returns distance from p to closest point on line segment a -> b.

    Parameters

    • p: ReadonlyVec

      query point

    • a: ReadonlyVec

      line point A

    • b: ReadonlyVec

      line point B

    Returns number

Const farthestPointSegment

  • farthestPointSegment(a: ReadonlyVec, b: ReadonlyVec, points: ReadonlyVec[], from?: number, to?: number): number[]
  • Returns the index of the start point containing the segment in the polyline array points farthest away from p with regards to the line segment a to b. points is only checked between indices from and to (not including the latter).

    Parameters

    • a: ReadonlyVec

      line point A

    • b: ReadonlyVec

      line point B

    • points: ReadonlyVec[]

      points

    • Default value from: number = 0

      start search index

    • Default value to: number = points.length

      end search index

    Returns number[]

Generated using TypeDoc