Skip to content

editor › Globals › OutlineSpline

Class: OutlineSpline

Cubic spline connecting two OutlinePoints. TODO: refactor tests to test more on section, less on subclasses

Hierarchy

↳ OutlineSpline

↳ OutlineCorner

Index

Properties

Methods

Properties

Private cachedBezierCurve2D

• cachedBezierCurve2D: CubicBezierCurve3

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:18


Private cachedBezierCurve3D

• cachedBezierCurve3D: CubicBezierCurve3

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:19


Protected edgeJoint

• edgeJoint: EdgeJoint | null = null

Inherited from OutlineLine.edgeJoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:30

EdgeJoint connection to some other OutlineSection


Protected end

• end: OutlinePoint | null = null

Inherited from OutlineLine.end

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:27

End OutlinePoint


Protected outline

• outline: Outline | null = null

Inherited from OutlineLine.outline

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:21

Outline this section belongs to


Protected start

• start: OutlinePoint | null = null

Inherited from OutlineLine.start

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:24

Start OutlinePoint


Private subdivisions

• subdivisions: number = 20

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:16

see {@link OutlineSpline#setNumberOfSubdivisions}


Protected teeJoint

• teeJoint: TeeJoint | null = null

Inherited from OutlineLine.teeJoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:33

TeeJoint connection to some other plate


Private tolerance

• tolerance: any = Config.get("approximateSolutions.intersectionTolerance")

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:17

Methods

Protected _buildBezierCurve

▸ _buildBezierCurve(params: [Vector3, Vector3, Vector3, Vector3]): CubicBezierCurve3‹›

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:307

Parameters:

Name Type
params [Vector3, Vector3, Vector3, Vector3]

Returns: CubicBezierCurve3‹›


Protected _findLineMidpoint

▸ _findLineMidpoint(line: Line3): Vector3‹›

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:245

Parameters:

Name Type
line Line3

Returns: Vector3‹›


Protected _getBezierCurve2D

▸ _getBezierCurve2D(): CubicBezierCurve3‹›

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:291

Returns: CubicBezierCurve3‹›


Protected Abstract _getBezierCurve2DParameters

▸ _getBezierCurve2DParameters(): [Vector3, Vector3, Vector3, Vector3]

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:215

Returns: [Vector3, Vector3, Vector3, Vector3]


Protected _getBezierCurve3D

▸ _getBezierCurve3D(): CubicBezierCurve3‹›

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:299

Returns: CubicBezierCurve3‹›


Protected Abstract _getBezierCurve3DParameters

▸ _getBezierCurve3DParameters(): [Vector3, Vector3, Vector3, Vector3]

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:217

Returns: [Vector3, Vector3, Vector3, Vector3]


Protected _nearestOwnPointTo

▸ _nearestOwnPointTo(point: Vector3): object

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:274

Uses rasterized curve approximation to find the nearest point

Parameters:

Name Type
point Vector3

Returns: object

  • distance: number = minDistance

  • point: Vector3‹› = minPoint


Protected _nearestOwnPointTo2D

▸ _nearestOwnPointTo2D(point: Vector3): object

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:254

Uses rasterized curve approximation to find the nearest point

Parameters:

Name Type
point Vector3

Returns: object

  • distance: number = minDistance

  • point: Vector3‹› = minPoint


Private _onOutlineChange

▸ _onOutlineChange(): void

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:311

Returns: void


Protected _searchIntersection

▸ _searchIntersection(points: Vector3[], line: Line3): object

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:219

Parameters:

Name Type
points Vector3[]
line Line3

Returns: object

  • coordinates: Vector3 | null

  • distance: number


clearEdgeJoint

▸ clearEdgeJoint(): void

Inherited from OutlineLine.clearEdgeJoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:329

Clears the assigned Edge joint. Should only be called by the associated EdgeJoint itself.

Returns: void


clearOutline

▸ clearOutline(): void

Inherited from OutlineLine.clearOutline

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:151

Clears the reference to the outline. This method should only be used by the Outline

Returns: void


clearTeeJoint

▸ clearTeeJoint(): void

Inherited from OutlineLine.clearTeeJoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:336

Clears the assigned TeeJoint. Should only be called by the associated TeeJoint itself.

Returns: void


Abstract clone

▸ clone(): any

Inherited from OutlineSection.clone

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:92

Returns: any


distanceToPoint

▸ distanceToPoint(point: Vector3): number

Overrides OutlineSection.distanceToPoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:57

see OutlineSection#distanceToPoint

Parameters:

Name Type
point Vector3

Returns: number


distanceToPoint2D

▸ distanceToPoint2D(point: Vector3): number

Overrides OutlineSection.distanceToPoint2D

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:64

see OutlineSection#distanceToPoint2D

Parameters:

Name Type
point Vector3

Returns: number


equalsSection

▸ equalsSection(otherSection: OutlineSection, sameAssembly: boolean): boolean

Inherited from OutlineLine.equalsSection

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:452

Determine if this section is equal to otherSection in positions of start and end point in 3D.

Parameters:

Name Type Default Description
otherSection OutlineSection - -
sameAssembly boolean true If true, the two sections will be considered to be in the same assembly coordinate system. Defaults to true.

Returns: boolean

Whether the sections are equal in positions


getAdjacentSectionAt

▸ getAdjacentSectionAt(point: OutlinePoint): OutlineSection | null

Inherited from OutlineLine.getAdjacentSectionAt

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:398

Gets the next or prev section, depending on the outlinePoint provided to "jump over". The provided point doesn't need to be one of my endpoints, just having the same coordinates is also ok.

Parameters:

Name Type Description
point OutlinePoint should be at the 3D position of either this.start or this.end

Returns: OutlineSection | null

an adjacent OutlineSection of me, or null if


getCenterPosition

▸ getCenterPosition(): Vector3‹›

Inherited from OutlineLine.getCenterPosition

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:187

Returns: Vector3‹›


getCenterPosition2D

▸ getCenterPosition2D(): Vector3‹›

Inherited from OutlineLine.getCenterPosition2D

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:195

Returns: Vector3‹›


getDirection

▸ getDirection(targetVector: Vector3‹›): Vector3‹›

Inherited from OutlineLine.getDirection

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:229

Returns the direction of this OutlineSection in 3D assembly coordinates.

Parameters:

Name Type Default
targetVector Vector3‹› new Vector3()

Returns: Vector3‹›

Direction


getDirection2D

▸ getDirection2D(targetVector: Vector3‹›): Vector3‹›

Inherited from OutlineLine.getDirection2D

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:238

Returns the direction of this OutlineSection in 2D outline coordinates.

Parameters:

Name Type Default
targetVector Vector3‹› new Vector3()

Returns: Vector3‹›


getEdgeJoint

▸ getEdgeJoint(): EdgeJoint‹›

Inherited from OutlineLine.getEdgeJoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:281

Returns: EdgeJoint‹›


getEnd

▸ getEnd(): OutlinePoint‹›

Inherited from OutlineLine.getEnd

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:175

Returns: OutlinePoint‹›


getInterpolatedPosition

▸ getInterpolatedPosition(alpha: number): Vector3

Inherited from OutlineLine.getInterpolatedPosition

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:191

Parameters:

Name Type
alpha number

Returns: Vector3


getInterpolatedPosition2D

▸ getInterpolatedPosition2D(alpha: number): Vector3

Inherited from OutlineLine.getInterpolatedPosition2D

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:199

Parameters:

Name Type
alpha number

Returns: Vector3


getJoinedSection

▸ getJoinedSection(): OutlineSection | null

Inherited from OutlineLine.getJoinedSection

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:344

Gets the OutlineSection this section is joint to via its EdgeJoint (or null).

Returns: OutlineSection | null

Other section connected by EdgeJoint


getJoint

▸ getJoint(jointClass: any): EdgeJoint‹› | TeeJoint‹›

Inherited from OutlineLine.getJoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:293

Parameters:

Name Type
jointClass any

Returns: EdgeJoint‹› | TeeJoint‹›


getJointPossibility

▸ getJointPossibility(point: Vector3): object | null

Inherited from OutlineLine.getJointPossibility

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:356

Parameters:

Name Type Description
point Vector3 3D interaction point in assembly space

Returns: object | null

Joint possibility for this OutlineLine, or null, if no plate is assigned or this section is already joined to some other plate


getJoints

▸ getJoints(): (EdgeJoint‹› | TeeJoint‹›)[]

Inherited from OutlineLine.getJoints

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:289

Returns: (EdgeJoint‹› | TeeJoint‹›)[]


getLength

▸ getLength(): number

Overrides OutlineSection.getLength

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:142

see OutlineSection.getLength

Returns: number


getNextSection

▸ getNextSection(): OutlineSection‹›

Inherited from OutlineLine.getNextSection

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:384

Returns: OutlineSection‹›


getNormal

▸ getNormal(target: Vector3‹›): Vector3‹›

Inherited from OutlineLine.getNormal

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:261

Returns the normal (outward facing, orthogonal on side of Plate) of this OutlineSection in 3D assembly coordinates.

Parameters:

Name Type Default
target Vector3‹› new Vector3()

Returns: Vector3‹›


getNormal2D

▸ getNormal2D(target: Vector3‹›): Vector3‹›

Inherited from OutlineLine.getNormal2D

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:276

Returns the normal (outward facing) of this OutlineSection in 2D plate-local coordinates Warning: Outlines that are CW will have their normals point inwards (for cutouts in plates).

Parameters:

Name Type Default
target Vector3‹› new Vector3()

Returns: Vector3‹›


getNumberOfSubdivisions

▸ getNumberOfSubdivisions(): number

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:50

Returns: number


getOtherPoint

▸ getOtherPoint(point: OutlinePoint): OutlinePoint‹›

Inherited from OutlineLine.getOtherPoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:215

Parameters:

Name Type
point OutlinePoint

Returns: OutlinePoint‹›


getOutline

▸ getOutline(): Outline‹›

Inherited from OutlineLine.getOutline

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:135

Returns: Outline‹›


getOutlinePoint

▸ getOutlinePoint(startOrEnd: "start" | "end"): OutlinePoint‹›

Inherited from OutlineLine.getOutlinePoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:179

Parameters:

Name Type
startOrEnd "start" | "end"

Returns: OutlinePoint‹›


getPlate

▸ getPlate(): Plate‹›

Inherited from OutlineLine.getPlate

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:127

Returns: Plate‹›


getPoint2D

▸ getPoint2D(x: number): Vector3‹›

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:87

Returns the point at the given x parameter.

see https://threejs.org/docs/#api/extras/core/Curve.getPoint

Parameters:

Name Type Description
x number the parameter in the range [0, 1]

Returns: Vector3‹›


getPoint2DAt

▸ getPoint2DAt(x: number): Vector3‹›

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:99

Returns the point at the given x parameter according to arc length.

see https://threejs.org/docs/#api/extras/core/Curve.getPointAt

Parameters:

Name Type Description
x number the arc parameter in the range [0, 1]

Returns: Vector3‹›


getPoint3DAt

▸ getPoint3DAt(x: number): Vector3‹›

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:112

Returns the point at the given x parameter according to arc length. This uses the accurate, but expensive method @see https://threejs.org/docs/#api/extras/core/Curve.getPointAt. A cheaper, but less precise alternative would be @see https://threejs.org/docs/#api/extras/core/Curve.getPoint.

Parameters:

Name Type Description
x number the arc parameter in the range [0, 1]

Returns: Vector3‹›


getPrevSection

▸ getPrevSection(): OutlineSection‹›

Inherited from OutlineLine.getPrevSection

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:388

Returns: OutlineSection‹›


getStart

▸ getStart(): OutlinePoint‹›

Inherited from OutlineLine.getStart

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:159

Returns: OutlinePoint‹›


getTangent2DAt

▸ getTangent2DAt(x: number): Vector3‹›

Overrides OutlineLine.getTangent2DAt

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:157

Parameters:

Name Type
x number

Returns: Vector3‹›


getTangentAt

▸ getTangentAt(x: number): Vector3‹›

Overrides OutlineLine.getTangentAt

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:153

Parameters:

Name Type
x number

Returns: Vector3‹›


getTeeJoint

▸ getTeeJoint(): TeeJoint‹›

Inherited from OutlineLine.getTeeJoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:285

Returns: TeeJoint‹›


hasSameDirectionAsJoinedSection

▸ hasSameDirectionAsJoinedSection(): boolean

Inherited from OutlineLine.hasSameDirectionAsJoinedSection

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:376

Returns: boolean

True, if this section and its joined section point in the same (assembly) direction - start and end point are at the same assembly coordinates, false if not.


intersectLine

▸ intersectLine(line: Line3): Vector3‹›

Overrides OutlineSection.intersectLine

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:27

Parameters:

Name Type
line Line3

Returns: Vector3‹›


intersectLineSegment

▸ intersectLineSegment(lineSegment: Line3): Vector3‹›

Inherited from OutlineLine.intersectLineSegment

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:99

Intersects this section with the line segment and returns the intersections.

Parameters:

Name Type Description
lineSegment Line3 Line segment (assembly space) to intersect OutlineSection with

Returns: Vector3‹›

Intersection or null if there was none


Abstract intersectPlane

▸ intersectPlane(plane: Plane, epsilon?: number): Vector3

Inherited from OutlineSection.intersectPlane

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:78

Intersects this section with the plane and returns the intersection point

Parameters:

Name Type Description
plane Plane Plane (assembly space) to intersect OutlineSection with
epsilon? number -

Returns: Vector3

Intersection point between this section and the plane. In assembly space


isConvex

▸ isConvex(): boolean

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:146

Returns: boolean


minRadiusOfCurvature

▸ minRadiusOfCurvature(): number

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:162

Returns: number


nearestOwnPointTo

▸ nearestOwnPointTo(point: Vector3): Vector3‹›

Overrides OutlineSection.nearestOwnPointTo

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:71

see OutlineSection#nearestOwnPointTo

Parameters:

Name Type
point Vector3

Returns: Vector3‹›


nearestOwnPointTo2D

▸ nearestOwnPointTo2D(point: Vector3): Vector3‹›

Overrides OutlineSection.nearestOwnPointTo2D

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:78

see OutlineSection#nearestOwnPointTo2D

Parameters:

Name Type
point Vector3

Returns: Vector3‹›


overlapsSection

▸ overlapsSection(otherSection: OutlineSection, sameAssembly: boolean): boolean

Inherited from OutlineLine.overlapsSection

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:428

Determine if this section is parallel to otherSection and they touch in more than one point

Parameters:

Name Type Default Description
otherSection OutlineSection - Other section, has to be in the same assembly as this section
sameAssembly boolean true (optional) If true, the two sections will be considered to be in the same assembly coordinate system. Defaults to true.

Returns: boolean

Whether the sections have a shared segment or not


radiusOfCurvatureAt

▸ radiusOfCurvatureAt(t: number, parameters: [Vector3‹›, Vector3‹›, Vector3‹›, Vector3‹›]): number

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:180

Computes the radius of the curvature (reciprocal of the curvature) at the given point on the curve. Based on the formulas given here https://math.stackexchange.com/a/1021397/462451

Parameters:

Name Type Default Description
t number - the point of the curve to compute. Between 0 and 1
parameters [Vector3‹›, Vector3‹›, Vector3‹›, Vector3‹›] this._getBezierCurve3DParameters() You supply optional curve parameters to allow caching outside of this method

Returns: number


rasterize

▸ rasterize(includeEnd: boolean): Vector3‹›[]

Overrides OutlineSection.rasterize

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:117

Parameters:

Name Type Default
includeEnd boolean false

Returns: Vector3‹›[]


rasterize3D

▸ rasterize3D(includeEnd: boolean): Vector3‹›[]

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:128

Parameters:

Name Type Default
includeEnd boolean false

Returns: Vector3‹›[]


reverse

▸ reverse(): void

Inherited from OutlineLine.reverse

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:414

Swaps start and end of this section This needs to handled with care as usually all sections in an Outline need to be reversed at the same time. Otherwise, there might be OutlinePoints, that have an invalid start/end.

Returns: void


setEdgeJoint

▸ setEdgeJoint(edgeJoint: EdgeJoint): void

Inherited from OutlineLine.setEdgeJoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:302

Set the EdgeJoint this section is connected with. This setter should only be used by the future EdgeJoint.

Parameters:

Name Type Description
edgeJoint EdgeJoint New EdgeJoint

Returns: void


setEnd

▸ setEnd(end: OutlinePoint): this

Inherited from OutlineLine.setEnd

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:209

Sets the ending OutlinePoint of this OutlineSection and also sets the ending OutlineSection of that point for consistency.

Parameters:

Name Type Description
end OutlinePoint Ending point

Returns: this

Returns this to allow chaining


setNumberOfSubdivisions

▸ setNumberOfSubdivisions(numberOfSubdivisions: number): void

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:46

Parameters:

Name Type Description
numberOfSubdivisions number - How fine granular the spline is approximated (number of lines) for rendering or calculations

Returns: void


setOutline

▸ setOutline(outline: Outline): void

Overrides OutlineLine.setOutline

Defined in src/model/data/PhysicalObject/Outline/OutlineSpline.ts:21

Parameters:

Name Type
outline Outline

Returns: void


setStart

▸ setStart(start: OutlinePoint): this

Inherited from OutlineLine.setStart

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:169

Sets the starting OutlinePoint of this OutlineSection and also sets the starting OutlineSection of that point for consistency.

Parameters:

Name Type Description
start OutlinePoint Starting point

Returns: this

Returns this to allow chaining


setTeeJoint

▸ setTeeJoint(teeJoint: TeeJoint): void

Inherited from OutlineLine.setTeeJoint

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:316

Set the TeeJoint this section is connected with. This setter should only be used by the TeeJoint.

Parameters:

Name Type Description
teeJoint TeeJoint New TeeJoint

Returns: void


toArray

▸ toArray(): [OutlinePoint, OutlinePoint]

Inherited from OutlineLine.toArray

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:481

Returns: [OutlinePoint, OutlinePoint]


toArrayOfPositions

▸ toArrayOfPositions(): [Vector3, Vector3]

Inherited from OutlineLine.toArrayOfPositions

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:485

Returns: [Vector3, Vector3]


translate

▸ translate(translation: Vector3): void

Inherited from OutlineLine.translate

Defined in src/model/data/PhysicalObject/Outline/OutlineSection.ts:119

Translates this OutlineSection by applying the translation to both end points' 3D positions.

Parameters:

Name Type Description
translation Vector3 Translation to apply

Returns: void