Skip to main content

curves

import {...} from "@canvas-commons/2d/lib/curves";

Classes​

Interfaces​

Type Aliases​

KnotAutoHandles​

type KnotAutoHandles

Properties

end​

end: number

start​

start: number

Functions​

createCurveSampler​

public createCurveSamplerprofile: CurveProfile: distance: number => CurvePoint

Create an arc-length sampler over a profile. Calls with non-decreasing distances are amortized O(1). A smaller distance rescans from the start.

Parameters

  • profile: CurveProfile

    The profile to sample.


getBezierSplineProfile​

public getBezierSplineProfileknots: KnotInfo[]closed: booleansmoothness: number: CurveProfile

Calculate the curve profile of a spline based on a set of knots.

Parameters

  • knots: KnotInfo[]

    The knots defining the spline

  • closed: boolean

    Whether the spline should be closed or not

  • smoothness: number

    The desired smoothness of the spline when using auto calculated handles.


getCircleProfile​

public getCircleProfilesize: Vector2startAngle: numberendAngle: numberclosed: booleancounterclockwise: boolean = false: CurveProfile

Parameters


getPointAtDistance​

public getPointAtDistanceprofile: CurveProfiledistance: number: CurvePoint

Parameters


getPolylineProfile​

public getPolylineProfilepoints: readonly Vector2[]radius: numberclosed: boolean: CurveProfile

Parameters


getRectProfile​

public getRectProfilerect: BBoxradius: SpacingsmoothCorners: booleancornerSharpness: number: CurveProfile

Parameters


isClosedProfile​

public isClosedProfileprofile: CurveProfile: boolean

Whether a profile's path loops back to its own start, within a tolerance relative to its arc length.

Parameters

  • profile: CurveProfile

    The profile to check.


profileToSVGPathData​

public profileToSVGPathDataprofile: CurveProfile: string

Convert a curve profile to SVG path data.

Parameters

  • profile: CurveProfile

    The curve profile to convert