Options
All
• Public
• Public/Protected
• All

# Class Curve

Curve class provides static functions to interpolate curves. A curve is usually represented as a Group of 3 control points. You can use the static function as-is, or apply the `op` method in Group or Pt to many of these functions. See Op guide for details.

• Curve

## Methods

### Static _calcPt

• Calulcate weighted sum to get the interpolated points

anchors

parameters

### Static bezier

• Create a Bezier curve. In a cubic bezier curve, the first and 4th anchors are end-points, and 2nd and 3rd anchors are control-points.

#### Parameters

• ##### pts: GroupLike

a group of anchor Pt

• ##### Default value steps: number = 10

the number of line segments per curve. Defaults to 10 steps.

#### Returns Group

a curve as a group of interpolated Pt

### Static bezierStep

• Interpolate to get a point on a cubic Bezier curve

#### Parameters

• ##### step: Pt

the coefficients [ttt, t*t, t, 1]

• ##### ctrls: GroupLike

a group of anchor Pts

#### Returns Pt

an interpolated Pt on the curve

### Static bspline

• Create a B-spline curve

#### Parameters

• ##### pts: GroupLike

a group of anchor Pt

• ##### Default value steps: number = 10

the number of line segments per curve. Defaults to 10 steps.

• ##### Default value tension: number = 1

optional value between 0 to n to specify a "tension". Default is 1 which is the usual tension.

#### Returns Group

a curve as a group of interpolated Pt

### Static bsplineStep

• Interpolate to get a point on a B-spline curve

#### Parameters

• ##### step: Pt

the coefficients [ttt, t*t, t, 1]

• ##### ctrls: GroupLike

a group of anchor Pts

#### Returns Pt

an interpolated Pt on the curve

### Static bsplineTensionStep

• bsplineTensionStep(step: Pt, ctrls: GroupLike, tension?: number): Pt
• Interpolate to get a point on a B-spline curve

#### Parameters

• ##### step: Pt

the coefficients [ttt, t*t, t, 1]

• ##### ctrls: GroupLike

a group of anchor Pts

• ##### Default value tension: number = 1

optional value between 0 to n to specify a "tension". Default to 1 which is the usual tension.

#### Returns Pt

an interpolated Pt on the curve

### Static cardinal

• Create a Cardinal spline curve

#### Parameters

• ##### pts: GroupLike

a group of anchor Pt

• ##### Default value steps: number = 10

the number of line segments per curve. Defaults to 10 steps.

• ##### Default value tension: number = 0.5

optional value between 0 to 1 to specify a "tension". Default to 0.5 which is the tension for Catmull-Rom curve.

#### Returns Group

a curve as a group of interpolated Pt

### Static cardinalStep

• Interpolate to get a point on Catmull-Rom curve

#### Parameters

• ##### step: Pt

the coefficients [ttt, t*t, t, 1]

• ##### ctrls: GroupLike

a group of anchor Pts

• ##### Default value tension: number = 0.5

optional value between 0 to 1 to specify a "tension". Default to 0.5 which is the tension for Catmull-Rom curve

#### Returns Pt

an interpolated Pt on the curve

### Static catmullRom

• Create a Catmull-Rom curve. Catmull-Rom is a kind of Cardinal curve with smooth-looking curve.

#### Parameters

• ##### pts: GroupLike

a group of anchor Pt

• ##### Default value steps: number = 10

the number of line segments per curve. Defaults to 10 steps.

#### Returns Group

a curve as a group of interpolated Pt

### Static catmullRomStep

• Interpolate to get a point on Catmull-Rom curve

#### Parameters

• ##### step: Pt

the coefficients [ttt, t*t, t, 1]

• ##### ctrls: GroupLike

a group of anchor Pts

#### Returns Pt

an interpolated Pt on the curve

### Static controlPoints

• controlPoints(pts: GroupLike, index?: number, copyStart?: boolean): Group
• Given an index for the starting position in a Pt group, get the control and/or end points of a curve segment

#### Parameters

• ##### pts: GroupLike

a group of Pt

• ##### Default value index: number = 0

start index in `pts` array. Default is 0.

• ##### Default value copyStart: boolean = false

an optional boolean value to indicate if the start index should be used twice. Default is false.

#### Returns Group

a group of 4 Pts

### Static getSteps

• getSteps(steps: number): Group
• Get a precalculated coefficients per step

#### Parameters

• ##### steps: number

number of steps

#### Returns Group

Generated using TypeDoc