editor › Globals › BackSideAnchor
Class: BackSideAnchor
Allows placing something on the back side of a mesh surface. Utilizes a PointOnSurfaceAnchor and applies a transformation (flip rotation + add material thickness offset) to create the "back side" coordinate system.
ToDo: use in codebase - e.g. ornamentDescriptor(?), makerAsset(?)
ToDo: implement support for dynamic material thickness, i.e. by getting the mat thickness from a ToDo: surfaceDisplayAnnotation and change this' offset accordingly. Currently, due to this, ToDo: _transformBackSideToFrontSurface cannot determine if an offset is invalid, ToDo: i.e. if the point is not on the surface anymore
Hierarchy
- BackSideAnchor
Implements
Index
Properties
- actualOffset
- changeEventEmitter
- doNotAdaptToPlateThickness
- pointOnSurfaceAnchor
- specifiedOffset
- transforms
- transformsChangeEventEmitter
- localFlipToBackSideRotation
Methods
- _createSplitOffInstance
- _onPosaChange
- _onPosaTransformsChange
- _setPointOnSurfaceAnchor
- _updateOwnTransformsFromPosa
- clone
- destroy
- getActualOffset
- getChangeEventEmitter
- getInMeshTarget
- getIsValid
- getLocalAngle
- getMesh
- getPointOnSurfaceAnchor
- getSpecifiedOffset
- getSurface
- getTargets
- getTransforms
- getTransformsChangeEventEmitter
- getTransformsTargets
- initializeFromAnchor
- setLocalAngle
- setPosition
- setRotation
- _transformBackSideToFrontSurface
- generateAnchorsFromBackSideRotation
Properties
Private actualOffset
• actualOffset: number = 0
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:122
The actual offset, positive, in mm. It may be different from the specified one if you decide to manually override it via setPosition.
Private Readonly changeEventEmitter
• changeEventEmitter: EventEmitter‹IMeshAnchorChangeEvent› = new EventEmitter
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:95
Private doNotAdaptToPlateThickness
• doNotAdaptToPlateThickness: boolean = false
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:101
Used to update according to the plate thickness but still allow setting the position by setting the actual offset and the position of the underlying anchor used in setPosition.
Private pointOnSurfaceAnchor
• pointOnSurfaceAnchor: PointOnSurfaceAnchor = null
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:111
The anchor that points on the same point on the front surface
Private specifiedOffset
• specifiedOffset: number = 0
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:116
The desired offset, positive, in mm, how much this anchor is moved to the inside
Private transforms
• transforms: Transforms‹› = new Transforms()
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:106
The official transforms of the anchor, in assembly space
Private Readonly transformsChangeEventEmitter
• transformsChangeEventEmitter: EventEmitter‹ITransformsChangeEvent› = new EventEmitter
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:93
Static Private localFlipToBackSideRotation
▪ localFlipToBackSideRotation: Quaternion‹› = new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), Math.PI)
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:37
The rotation which will be mapped from PointOnSurfaceAnchor space into assembly space to perform the flip to the back side to build this anchor's transforms. It needs to transform the z = 1 normal vector to the z = -1 vector.
This transform tries to be consistent with the 2D front/back transforms, where the coordinates are flipped around the y-axis as well.
Methods
Private _createSplitOffInstance
▸ _createSplitOffInstance(splitAnchor: PointOnSurfaceAnchor): BackSideAnchor‹›
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:356
Parameters:
| Name | Type |
|---|---|
splitAnchor |
PointOnSurfaceAnchor |
Returns: BackSideAnchor‹›
Private _onPosaChange
▸ _onPosaChange(event: IMeshAnchorChangeEvent): void
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:331
Parameters:
| Name | Type |
|---|---|
event |
IMeshAnchorChangeEvent |
Returns: void
Private _onPosaTransformsChange
▸ _onPosaTransformsChange(event: ITransformsChangeEvent): void
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:362
Parameters:
| Name | Type |
|---|---|
event |
ITransformsChangeEvent |
Returns: void
Private _setPointOnSurfaceAnchor
▸ _setPointOnSurfaceAnchor(anchor: PointOnSurfaceAnchor): void
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:313
Parameters:
| Name | Type |
|---|---|
anchor |
PointOnSurfaceAnchor |
Returns: void
Private _updateOwnTransformsFromPosa
▸ _updateOwnTransformsFromPosa(): void
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:289
Returns: void
clone
▸ clone(): BackSideAnchor
Implementation of IOrientedPositioningAnchor
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:269
Returns: BackSideAnchor
destroy
▸ destroy(): void
Implementation of IOrientedPositioningAnchor
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:130
Returns: void
getActualOffset
▸ getActualOffset(): number
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:181
Returns: number
the actual offset, in mm. The anchor is invalid if the actual offset does not match the specified one. The actual offset may differ from the specified offset if the back side anchor is moved via setPosition(), as the PointOnSurfaceAnchor will stay on the surface in all cases.
getChangeEventEmitter
▸ getChangeEventEmitter(): IPublicEventEmitterInterface‹IMeshAnchorChangeEvent›
Implementation of IOrientedPositioningAnchor
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:139
Returns: IPublicEventEmitterInterface‹IMeshAnchorChangeEvent›
getInMeshTarget
▸ getInMeshTarget(): MeshElement
Implementation of IMeshAnchor
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:157
Returns: MeshElement
getIsValid
▸ getIsValid(): boolean
Implementation of IOrientedPositioningAnchor
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:124
Returns: boolean
getLocalAngle
▸ getLocalAngle(): number
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:280
Returns: number
getMesh
▸ getMesh(): Mesh‹›
Implementation of IMeshAnchor
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:150
Returns: Mesh‹›
getPointOnSurfaceAnchor
▸ getPointOnSurfaceAnchor(): PointOnSurfaceAnchor‹›
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:164
Returns: PointOnSurfaceAnchor‹›
getSpecifiedOffset
▸ getSpecifiedOffset(): number
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:172
Returns: number
the specifiedOffset, in mm, how much this anchor is moved inwards relative to the PointOnSurfaceAnchor. In other words, returns the assumed material thickness.
getSurface
▸ getSurface(): MeshSurface
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:265
Returns: MeshSurface
getTargets
▸ getTargets(): [Mesh] | []
Implementation of IOrientedPositioningAnchor
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:143
Returns: [Mesh] | []
getTransforms
▸ getTransforms(): IReadOnlyTransforms
Implementation of IOrientedPositioningAnchor
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:185
Returns: IReadOnlyTransforms
getTransformsChangeEventEmitter
▸ getTransformsChangeEventEmitter(): IPublicEventEmitterInterface‹ITransformsChangeEvent›
Implementation of IOrientedPositioningAnchor
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:189
Returns: IPublicEventEmitterInterface‹ITransformsChangeEvent›
getTransformsTargets
▸ getTransformsTargets(): IPositionableElementTransformsDefiner[]
Implementation of IOrientedPositioningAnchor
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:193
Returns: IPositionableElementTransformsDefiner[]
initializeFromAnchor
▸ initializeFromAnchor(anchor: PointOnSurfaceAnchor, specifiedOffset: number, actualOffset: number): void
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:208
Initializes from a pointOnSurfaceAnchor and an offset (assumed material thickness)
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
anchor |
PointOnSurfaceAnchor | - | the anchor on the front side of the surface |
specifiedOffset |
number | - | the desired distance front <-> back, in mm, positive. |
actualOffset |
number | specifiedOffset | the actual distance front <-> back. Usually not needed as it is the same as specified, except if you want to instantiate the anchor in an invalid state |
Returns: void
setLocalAngle
▸ setLocalAngle(angle: number): void
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:284
Parameters:
| Name | Type |
|---|---|
angle |
number |
Returns: void
setPosition
▸ setPosition(newPosition: Vector3, projectOntoBackSide: boolean): void
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:226
Manually sets the position of the back side anchor, updates the PointOnSurfaceAnchor accordingly
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
newPosition |
Vector3 | - | the new position on the back side of the surface |
projectOntoBackSide |
boolean | false | if set to true, will automatically project the position onto the back side using the specifiedOffset, meaning that you can also specify a point on the front side of the surface and will have a valid back position as a result. |
Returns: void
setRotation
▸ setRotation(newRotation: Quaternion): void
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:248
Parameters:
| Name | Type |
|---|---|
newRotation |
Quaternion |
Returns: void
Static Private _transformBackSideToFrontSurface
▸ _transformBackSideToFrontSurface(inSurfaceRotation: Quaternion, pointOnBackSide: Vector3, mesh: Mesh, surface: MeshSurface): object
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:69
Parameters:
| Name | Type |
|---|---|
inSurfaceRotation |
Quaternion |
pointOnBackSide |
Vector3 |
mesh |
Mesh |
surface |
MeshSurface |
Returns: object
-
distanceBackToFront: number
-
frontSidePosition: Vector3
-
frontSideRotation: Quaternion
Static generateAnchorsFromBackSideRotation
▸ generateAnchorsFromBackSideRotation(inSurfaceRotation: Quaternion, pointOnBackSide: Vector3, mesh: Mesh, surface: MeshSurface): BackSideAnchor‹›
Defined in src/model/data/Concepts/Anchors/BackSideAnchor.ts:45
Assumes this is a back-sided rotation
Parameters:
| Name | Type | Description |
|---|---|---|
inSurfaceRotation |
Quaternion | the rotation spanning up a coordinate system on the back side of the surface (= inverted surface normal), in assembly space |
pointOnBackSide |
Vector3 | a point on the back side of the surface, in assembly space |
mesh |
Mesh | - |
surface |
MeshSurface | - |
Returns: BackSideAnchor‹›