Skip to main content

Class: CatmullRomSpline

Base class for all cubic splines

Extends

Constructors

new CatmullRomSpline()

new CatmullRomSpline(): CatmullRomSpline

Returns

CatmullRomSpline

Overrides

CardinalSpline.constructor

Defined in

tools/src/tools/annotation/splines/CatmullRomSpline.ts:14

Accessors

aabb

get aabb(): AABB2

Axis-aligned bounding box (minX, minY, maxX, maxY)

Returns

AABB2

Inherited from

CardinalSpline.aabb

Defined in

tools/src/tools/annotation/splines/Spline.ts:100


closed

get closed(): boolean

Flag that is set to true when the curve is already closed

set closed(closed): void

Set the curve as closed which connects the last to the first point

Parameters

closed: boolean

Returns

boolean

Inherited from

CardinalSpline.closed

Defined in

tools/src/tools/annotation/splines/Spline.ts:85


controlPoints

get protected controlPoints(): Point2[]

Return the control points array

Any external access should be done through getControlPoints because it clones the points to make sure the data will not get changed by the caller

Returns

Point2[]

Inherited from

CardinalSpline.controlPoints

Defined in

tools/src/tools/annotation/splines/Spline.ts:50


fixedResolution

get fixedResolution(): boolean

Fixed resolution

Linar spline is one of the splines that does not allow changing the resolution for better performance otherwise it would calculate and render 20 line segments instead of a single one..

Returns

boolean

Inherited from

CardinalSpline.fixedResolution

Defined in

tools/src/tools/annotation/splines/Spline.ts:80


fixedScale

get fixedScale(): boolean

Returns

boolean

Inherited from

CardinalSpline.fixedScale

Defined in

tools/src/tools/annotation/splines/CardinalSpline.ts:27


invalidated

get invalidated(): boolean

Flag that is set to true when the spline needs to be updated. The update runs automaticaly when needed (eg: getPolylinePoints).

set invalidated(invalidated): void

Sets the spline as invalid when curve segments need to be recalculated or as valid after recomputing the curves

Parameters

invalidated: boolean

Returns

boolean

Inherited from

CardinalSpline.invalidated

Defined in

tools/src/tools/annotation/splines/Spline.ts:115


length

get length(): number

Length of the spline curve in pixels

Returns

number

Inherited from

CardinalSpline.length

Defined in

tools/src/tools/annotation/splines/Spline.ts:106


numControlPoints

get numControlPoints(): number

Number of control points

Returns

number

Inherited from

CardinalSpline.numControlPoints

Defined in

tools/src/tools/annotation/splines/Spline.ts:55


resolution

get resolution(): number

Resolution of the spline curve (greater than or equal to 0)

set resolution(resolution): void

Set the resolution of the spline curve

Parameters

resolution: number

Returns

number

Inherited from

CardinalSpline.resolution

Defined in

tools/src/tools/annotation/splines/Spline.ts:60


scale

get scale(): number

set scale(scale): void

Parameters

scale: number

Returns

number

Inherited from

CardinalSpline.scale

Defined in

tools/src/tools/annotation/splines/CardinalSpline.ts:14

Methods

addControlPoint()

addControlPoint(point): void

Add a control point to the end of the array

Parameters

point: Point2

Control point (2D)

Returns

void

Inherited from

CardinalSpline.addControlPoint

Defined in

tools/src/tools/annotation/splines/Spline.ts:139


addControlPointAtU()

addControlPointAtU(u): ControlPointInfo

Add a control point specifying its u value in Parameter Space which is a number from 0 to N where N is the number of curve segments. The integer part is the curve segment index and the decimal part is the t value on that curve segment.

Parameters

u: number

u value in Parameter Space

Returns

ControlPointInfo

Inherited from

CardinalSpline.addControlPointAtU

Defined in

tools/src/tools/annotation/splines/Spline.ts:158


addControlPoints()

addControlPoints(points): void

Add a list of control poits to the end of the array

Parameters

points: Point2[]

Control points to be added

Returns

void

Inherited from

CardinalSpline.addControlPoints

Defined in

tools/src/tools/annotation/splines/Spline.ts:148


clearControlPoints()

clearControlPoints(): void

Remove all control points

Returns

void

Inherited from

CardinalSpline.clearControlPoints

Defined in

tools/src/tools/annotation/splines/Spline.ts:206


containsPoint()

containsPoint(point): boolean

Checks if a 2D point is inside the spline curve.

A point is inside a curve/polygon if the number of intersections between the horizontal ray emanating from the given point and to the right and the line segments is odd. https://www.eecs.umich.edu/courses/eecs380/HANDOUTS/PROJ2/InsidePoly.html

Parameters

point: Point2

2D Point

Returns

boolean

True is the point is inside the spline curve or false otherwise

Inherited from

CardinalSpline.containsPoint

Defined in

tools/src/tools/annotation/splines/Spline.ts:502


deleteControlPointByIndex()

deleteControlPointByIndex(index): boolean

Delete a control point given its index

Parameters

index: number

Control point index to be removed

Returns

boolean

True if the control point is removed or false otherwise

Inherited from

CardinalSpline.deleteControlPointByIndex

Defined in

tools/src/tools/annotation/splines/Spline.ts:186


getClosestControlPoint()

getClosestControlPoint(point): ClosestControlPoint

Finds the closest control point given a 2D point

Parameters

point: Point2

Reference point

Returns

ClosestControlPoint

Closest control point

Inherited from

CardinalSpline.getClosestControlPoint

Defined in

tools/src/tools/annotation/splines/Spline.ts:254


getClosestControlPointWithinDistance()

getClosestControlPointWithinDistance(point, maxDist): ClosestControlPoint

Finds the closest control point given a 2D point and a maximum distance

Parameters

point: Point2

Reference 2D point

maxDist: number

Maximum distance

Returns

ClosestControlPoint

Closest control point that is within the given range or undefined otherwise

Inherited from

CardinalSpline.getClosestControlPointWithinDistance

Defined in

tools/src/tools/annotation/splines/Spline.ts:287


getClosestPoint()

getClosestPoint(point): ClosestSplinePoint

Finds the closest point on the spline curve given 2D point

Parameters

point: Point2

Reference 2D point

Returns

ClosestSplinePoint

Closest point on the spline curve

Inherited from

CardinalSpline.getClosestPoint

Defined in

tools/src/tools/annotation/splines/Spline.ts:303


getClosestPointOnControlPointLines()

getClosestPointOnControlPointLines(point): ClosestPoint

Finds the closest point on the straight line that connects all control points given a 2D point

Parameters

point: Point2

Reference point

Returns

ClosestPoint

Closest point on the straight line that connects all control points

Inherited from

CardinalSpline.getClosestPointOnControlPointLines

Defined in

tools/src/tools/annotation/splines/Spline.ts:376


getControlPoints()

getControlPoints(): Point2[]

Get a list with all control points. The control points are cloned to prevent any caller from changing them resulting in unexpected behaviors

Returns

Point2[]

  • List of all control points

Inherited from

CardinalSpline.getControlPoints

Defined in

tools/src/tools/annotation/splines/Spline.ts:242


getPolylinePoints()

getPolylinePoints(): Point2[]

Get all points necessary to draw a spline curve

Returns

Point2[]

Array with all points necessary to draw a spline curve

Inherited from

CardinalSpline.getPolylinePoints

Defined in

tools/src/tools/annotation/splines/Spline.ts:418


getPreviewCurveSegments()

protected getPreviewCurveSegments(controlPointPreview, closeSpline): SplineCurveSegment[]

Parameters

controlPointPreview: Point2

closeSpline: boolean

Returns

SplineCurveSegment[]

Inherited from

CardinalSpline.getPreviewCurveSegments

Defined in

tools/src/tools/annotation/splines/CubicSpline.ts:17


getPreviewPolylinePoints()

getPreviewPolylinePoints(controlPointPreview, closeDistance): Point2[]

Get all points necessary to draw the preview of the changes that shall be made to the spline if a new control point is added to it

Parameters

controlPointPreview: Point2

New control point preview

closeDistance: number

Distance to the first control point to consider it a closed spline

Returns

Point2[]

Array with all points necessary to draw a spline curve preview

Inherited from

CardinalSpline.getPreviewPolylinePoints

Defined in

tools/src/tools/annotation/splines/Spline.ts:431


getSplineCurves()

protected getSplineCurves(): SplineCurveSegment[]

Returns

SplineCurveSegment[]

Inherited from

CardinalSpline.getSplineCurves

Defined in

tools/src/tools/annotation/splines/CubicSpline.ts:48


getTransformMatrix()

protected getTransformMatrix(): number[]

Returns

number[]

Inherited from

CardinalSpline.getTransformMatrix

Defined in

tools/src/tools/annotation/splines/CardinalSpline.ts:31


hasTangentPoints()

hasTangentPoints(): boolean

Bézier curves have tangent points connected to control points

Returns

boolean

True if the spline has tangent point or false otherwise

Inherited from

CardinalSpline.hasTangentPoints

Defined in

tools/src/tools/annotation/splines/Spline.ts:131


isPointNearCurve()

isPointNearCurve(point, maxDist): boolean

Checks if a point is near to the spline curve

Parameters

point: Point2

Reference point

maxDist: number

Maximum allowed distance

Returns

boolean

True if the point is close to the spline curve or false otherwise

Inherited from

CardinalSpline.isPointNearCurve

Defined in

tools/src/tools/annotation/splines/Spline.ts:465


setControlPoints()

setControlPoints(points): void

Replace all control points by some new ones

Parameters

points: Point2[]

Control points to be added to the array

Returns

void

Inherited from

CardinalSpline.setControlPoints

Defined in

tools/src/tools/annotation/splines/Spline.ts:215


updateControlPoint()

updateControlPoint(index, newControlPoint): void

Update the coordinate of a control point given its index

Parameters

index: number

Control point index

newControlPoint: Point2

New control point

Returns

void

Inherited from

CardinalSpline.updateControlPoint

Defined in

tools/src/tools/annotation/splines/Spline.ts:225