Skip to content

@feds01/graphika


@feds01/graphika / core/interpolation

core/interpolation

Type Aliases

ControlPoint

ts
type ControlPoint = {
  next: default;
  prev: default;
};

Defined in: core/interpolation.ts:21

Control points for cubic Bezier curves.

Properties

PropertyTypeDefined in
nextdefaultcore/interpolation.ts:23
prevdefaultcore/interpolation.ts:22

InterpolationKind

ts
type InterpolationKind = "linear" | "cubic";

Defined in: core/interpolation.ts:18

Types of interpolation supported.

Functions

splineCurve()

ts
function splineCurve(
   prev, 
   current, 
   next, 
   t, 
   graph): ControlPoint;

Defined in: core/interpolation.ts:41

x0,y0,x1,y1 are the coordinates of the end (knot) pts of this segment x2,y2 is the next knot -- not connected here but needed to calculate p2 p1 is the control point calculated here, from x1 back toward x0. p2 is the next control point, calculated here and returned to become the next segment's p1.

Parameters

ParameterTypeDescription
prevdefaultthe previous point
currentdefaultthe current point
nextdefaultthe next point
tnumbertension coefficient
graphdefaultgraph object

Returns

ControlPoint

Released under the ISC License.