Options
All
• Public
• Public/Protected
• All

# @thi.ng/geom-splines

## Functions

### Const closedCubicFromBreakPoints

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

### Const closedCubicFromControlPoints

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

### Const closestPointCubic

• 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

query point

control point 1

control point 2

control point 3

control point 4

• ##### Optional res: number

search steps per iteration

iterations

• ##### Optional eps: number

epsilon value

#### Returns 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

query point

control point 1

control point 2

control point 3

• ##### Optional res: number

search steps per iteration

iterations

• ##### Optional eps: number

epsilon value

### Const cubicFromArc

• cubicFromArc(pos: ReadonlyVec, r: ReadonlyVec, axis: number, start: number, end: number): Vec[][]
• Converts elliptic arc into a 1-4 cubic curve segments, depending on arc's angle range.

#### Parameters

ellipse center

### 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[]

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

### Const cubicPointAt

• Same as thi.ng/vectors/mixCubic

### Const openCubicFromBreakPoints

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

### Const openCubicFromControlPoints

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

### Const sampleCubic

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

### Const sampleCubicArray

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