Options
All
  • Public
  • Public/Protected
  • All
Menu

@thi.ng/geom-splines

Index

Functions

Const closedCubicFromBreakPoints

  • closedCubicFromBreakPoints(points: ReadonlyVec[], t?: number, uniform?: boolean): Vec[][]

Const closedCubicFromControlPoints

  • closedCubicFromControlPoints(points: ReadonlyVec[], t?: number, uniform?: boolean): Vec[][]

Const closestPointCubic

  • closestPointCubic(p: ReadonlyVec, a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, d: ReadonlyVec, out?: Vec, res?: number, iter?: number, eps?: number): Vec
  • Performs recursive search for closest point to p on cubic curve defined by control points a,b,c,d. The res and recur params are used to control the recursion behavior. If eps is given, the search is terminated as soon as a point with a shorter squared distance than eps is found.

    minError

    Parameters

    • p: ReadonlyVec

      query point

    • a: ReadonlyVec

      control point 1

    • b: ReadonlyVec

      control point 2

    • c: ReadonlyVec

      control point 3

    • d: ReadonlyVec

      control point 4

    • out: Vec = ...
    • Optional res: number

      search steps per iteration

    • Optional iter: number

      iterations

    • Optional eps: number

      epsilon value

    Returns Vec

Const closestPointQuadratic

  • closestPointQuadratic(p: ReadonlyVec, a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, out?: Vec, res?: number, iter?: number, eps?: number): Vec
  • Performs recursive search for closest point to p on quadratic curve defined by control points a,b,c. The res and recur params are used to control the recursion behavior. If eps is given, the search is terminated as soon as a point with a shorter squared distance than eps is found.

    minError

    Parameters

    • p: ReadonlyVec

      query point

    • a: ReadonlyVec

      control point 1

    • b: ReadonlyVec

      control point 2

    • c: ReadonlyVec

      control point 3

    • out: Vec = ...
    • Optional res: number

      search steps per iteration

    • Optional iter: number

      iterations

    • Optional eps: number

      epsilon value

    Returns Vec

Const cubicBounds

  • cubicBounds(a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, d: ReadonlyVec): VecPair
  • Parameters

    • a: ReadonlyVec
    • b: ReadonlyVec
    • c: ReadonlyVec
    • d: ReadonlyVec

    Returns VecPair

Const cubicFromArc

  • cubicFromArc(pos: ReadonlyVec, r: ReadonlyVec, axis: number, start: number, end: number): Vec[][]

Const cubicFromLine

  • cubicFromLine(a: Vec, b: Vec): Vec[]
  • Converts line segment a -> b into a cubic curve, which when sampled yields uniformly spaced points. The inner control points are located at 1/3 and 2/3 respectively.

    Parameters

    • a: Vec

      line endpoint

    • b: Vec

      line endpoint

    Returns Vec[]

Const cubicFromQuadratic

  • cubicFromQuadratic(a: Vec, b: Vec, c: Vec): Vec[]

Const cubicPointAt

  • cubicPointAt(out: null | Vec, a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, d: ReadonlyVec, t: number): Vec
  • Same as thi.ng/vectors/mixCubic

    Parameters

    • out: null | Vec
    • a: ReadonlyVec
    • b: ReadonlyVec
    • c: ReadonlyVec
    • d: ReadonlyVec
    • t: number

    Returns Vec

Const cubicSplitAt

  • cubicSplitAt(a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, d: ReadonlyVec, t: number): Vec[][]
  • Parameters

    • a: ReadonlyVec
    • b: ReadonlyVec
    • c: ReadonlyVec
    • d: ReadonlyVec
    • t: number

    Returns Vec[][]

Const cubicTangentAt

  • cubicTangentAt(out: Vec, a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, d: ReadonlyVec, t: number, len?: number): Vec
  • Parameters

    • out: Vec
    • a: ReadonlyVec
    • b: ReadonlyVec
    • c: ReadonlyVec
    • d: ReadonlyVec
    • t: number
    • len: number = 1

    Returns Vec

Const openCubicFromBreakPoints

  • openCubicFromBreakPoints(points: ReadonlyVec[], t?: number, uniform?: boolean): Vec[][]

Const openCubicFromControlPoints

  • openCubicFromControlPoints(points: ReadonlyVec[], t?: number, uniform?: boolean): Vec[][]

Const quadraticBounds

  • quadraticBounds(a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec): VecPair

Const quadraticFromLine

  • quadraticFromLine(a: ReadonlyVec, b: ReadonlyVec): Vec[]

Const quadraticPointAt

  • quadraticPointAt(out: null | Vec, a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, t: number): Vec
  • Same as thi.ng/vectors/mixQuadratic

    Parameters

    • out: null | Vec
    • a: ReadonlyVec
    • b: ReadonlyVec
    • c: ReadonlyVec
    • t: number

    Returns Vec

Const quadraticSplitAt

  • quadraticSplitAt(a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, t: number): Vec[][]
  • Parameters

    • a: ReadonlyVec
    • b: ReadonlyVec
    • c: ReadonlyVec
    • t: number

    Returns Vec[][]

Const quadraticSplitNearPoint

  • quadraticSplitNearPoint(p: ReadonlyVec, a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, res?: number, iter?: number): Vec[][]
  • Parameters

    • p: ReadonlyVec
    • a: ReadonlyVec
    • b: ReadonlyVec
    • c: ReadonlyVec
    • Optional res: number
    • Optional iter: number

    Returns Vec[][]

Const quadraticTangentAt

  • quadraticTangentAt(out: Vec, a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, t: number, len?: number): Vec
  • Parameters

    • out: Vec
    • a: ReadonlyVec
    • b: ReadonlyVec
    • c: ReadonlyVec
    • t: number
    • len: number = 1

    Returns Vec

Const sampleCubic

  • sampleCubic(pts: ReadonlyVec[], opts?: number | Partial<SamplingOpts>): Vec[]
  • Parameters

    • pts: ReadonlyVec[]
    • Optional opts: number | Partial<SamplingOpts>

    Returns Vec[]

Const sampleCubicArray

  • sampleCubicArray(segments: ReadonlyVec[][], closed?: boolean, opts: number | Partial<SamplingOpts>): any[]
  • Parameters

    • segments: ReadonlyVec[][]
    • closed: boolean = false
    • opts: number | Partial<SamplingOpts>

    Returns any[]

Const sampleQuadratic

  • sampleQuadratic(pts: ReadonlyVec[], opts?: number | Partial<SamplingOpts>): Vec[]
  • Parameters

    • pts: ReadonlyVec[]
    • Optional opts: number | Partial<SamplingOpts>

    Returns Vec[]

Const sampleQuadraticArray

  • sampleQuadraticArray(segments: ReadonlyVec[][], closed?: boolean, opts: number | Partial<SamplingOpts>): any[]
  • Parameters

    • segments: ReadonlyVec[][]
    • closed: boolean = false
    • opts: number | Partial<SamplingOpts>

    Returns any[]

Const splitCubicNearPoint

  • splitCubicNearPoint(p: ReadonlyVec, a: ReadonlyVec, b: ReadonlyVec, c: ReadonlyVec, d: ReadonlyVec, res?: number, iter?: number): Vec[][]
  • Parameters

    • p: ReadonlyVec
    • a: ReadonlyVec
    • b: ReadonlyVec
    • c: ReadonlyVec
    • d: ReadonlyVec
    • Optional res: number
    • Optional iter: number

    Returns Vec[][]

Generated using TypeDoc