Skip to content

editorGlobalsCurveHelper

Class: CurveHelper

Hierarchy

  • CurveHelper

Index

Methods

Methods

Static Private _cleanseOffsetPoints

_cleanseOffsetPoints(offsetCurvePoints: Vector3[], offsetSegments: Array‹[Vector3, Vector3]›): Vector3‹›[]

Defined in src/util/CurveHelper.ts:211

Remove self-intersections and wrong ends of the curve. Mutates offsetCurvePoints. This works by identifying parts of the curve that are not oriented in the same direction as the original (offset) segments. In that case, the bad part is replaced appropriately: either a different intersection of segments or the part is removed entirely.

Parameters:

Name Type Description
offsetCurvePoints Vector3[] -
offsetSegments Array‹[Vector3, Vector3]› -

Returns: Vector3‹›[]


Static Private _offsetSegments

_offsetSegments(segments: Array‹[Vector3, Vector3]›, segmentNormals: Vector3[], offset: number): void

Defined in src/util/CurveHelper.ts:284

Parameters:

Name Type
segments Array‹[Vector3, Vector3]›
segmentNormals Vector3[]
offset number

Returns: void


Static Private _segmentize

_segmentize(curvePoints: Vector3[]): Array‹[Vector3, Vector3]›

Defined in src/util/CurveHelper.ts:187

Converts the curve into segments consisting of two points each. the Vector3 instances will be cloned.

Parameters:

Name Type Description
curvePoints Vector3[] -

Returns: Array‹[Vector3, Vector3]›


Static convertToPointsArrays

convertToPointsArrays(points: Vector3[]): Array‹[number, number]›

Defined in src/util/CurveHelper.ts:16

Parameters:

Name Type
points Vector3[]

Returns: Array‹[number, number]›


Static flexOffsetCurve

flexOffsetCurve(curvePoints: Vector3[], offset: IExpression): IVectorExpression[]

Defined in src/util/CurveHelper.ts:65

Parameters:

Name Type
curvePoints Vector3[]
offset IExpression

Returns: IVectorExpression[]


Static getCurveLength

getCurveLength(curve: Vector3[]): number

Defined in src/util/CurveHelper.ts:160

Parameters:

Name Type Description
curve Vector3[] -

Returns: number

The length of the supplied curve.


Static getFlexPartialSection

getFlexPartialSection(sectionStart: Vector3, sectionEnd: Vector3, partStart: IExpression, partEnd: IExpression): [IVectorExpression, IVectorExpression]

Defined in src/util/CurveHelper.ts:90

Parameters:

Name Type
sectionStart Vector3
sectionEnd Vector3
partStart IExpression
partEnd IExpression

Returns: [IVectorExpression, IVectorExpression]


Static getPartialCurve

getPartialCurve(curve: Vector3[], start: number, end: number, minimumLength: number): Vector3‹›[]

Defined in src/util/CurveHelper.ts:112

Returns a part of a curve defined by a start and an end point. Start and end refer to distance traveled on the curve, 0 being the beginning of the curve and 'length' being the end.

Parameters:

Name Type Default Description
curve Vector3[] - -
start number - -
end number - -
minimumLength number 0.01 Minimum length of segments added at the start or the end of the partial curve

Returns: Vector3‹›[]


Static getSegmentNormal

getSegmentNormal(start: Vector3, end: Vector3): Vector3‹›

Defined in src/util/CurveHelper.ts:168

Parameters:

Name Type
start Vector3
end Vector3

Returns: Vector3‹›


Static getSegmentNormals

getSegmentNormals(segments: Array‹[Vector3, Vector3]›): Vector3‹›[]

Defined in src/util/CurveHelper.ts:178

Parameters:

Name Type
segments Array‹[Vector3, Vector3]›

Returns: Vector3‹›[]


Static offsetCurve

offsetCurve(curvePoints: Vector3[], offset: number): Vector3[]

Defined in src/util/CurveHelper.ts:29

Offsets the curve by offset. Relative to the curve, a positive offset means offsetting to the right of the curve. NOTE: This only handles simple self-intersections and does not cut off larger parts. However, it can prevent potential problems the start and end of a curve. These would lead to self intersections, if the curve is later used as part of a polygon.

Parameters:

Name Type
curvePoints Vector3[]
offset number

Returns: Vector3[]