Skip to main content

Class: abstract QuadraticSpline

Spline curve representation

You can find more about splines in this video https://www.youtube.com/watch?v=jvPPXbo87ds&t=11m20s

Extends​

Extended by​

Constructors​

new QuadraticSpline()​

new QuadraticSpline(props?): QuadraticSpline

Parameters​

• props?: SplineProps

Returns​

QuadraticSpline

Inherited from​

Spline.constructor

Defined in​

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

Accessors​

aabb​

get aabb(): AABB2

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

Returns​

AABB2

Inherited from​

Spline.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​

Spline.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​

Spline.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​

Spline.fixedResolution

Defined in​

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


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​

Spline.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​

Spline.length

Defined in​

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


numControlPoints​

get numControlPoints(): number

Number of control points

Returns​

number

Inherited from​

Spline.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​

Spline.resolution

Defined in​

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

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​

Spline.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​

Spline.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​

Spline.addControlPoints

Defined in​

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


clearControlPoints()​

clearControlPoints(): void

Remove all control points

Returns​

void

Inherited from​

Spline.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​

Spline.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​

Spline.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​

Spline.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​

Spline.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​

Spline.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​

Spline.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​

Spline.getControlPoints

Defined in​

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


getLineSegments()​

protected getLineSegments(): SplineLineSegment[]

Returns​

SplineLineSegment[]

Defined in​

tools/src/tools/annotation/splines/QuadraticSpline.ts:12


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​

Spline.getPolylinePoints

Defined in​

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


getPreviewCurveSegments()​

getPreviewCurveSegments(controlPointPreview, closeSpline): SplineCurveSegment[]

Parameters​

• controlPointPreview: Point2

• closeSpline: boolean

Returns​

SplineCurveSegment[]

Overrides​

Spline.getPreviewCurveSegments

Defined in​

tools/src/tools/annotation/splines/QuadraticSpline.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​

Spline.getPreviewPolylinePoints

Defined in​

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


getSplineCurves()​

protected getSplineCurves(): SplineCurveSegment[]

Returns​

SplineCurveSegment[]

Overrides​

Spline.getSplineCurves

Defined in​

tools/src/tools/annotation/splines/QuadraticSpline.ts:7


getTransformMatrix()​

abstract protected getTransformMatrix(): number[]

Returns​

number[]

Inherited from​

Spline.getTransformMatrix

Defined in​

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


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​

Spline.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​

Spline.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​

Spline.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​

Spline.updateControlPoint

Defined in​

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