editor › Globals › PointOnSurfaceAnchor
Class: PointOnSurfaceAnchor
Specialized surface anchor that, with it transforms, represents a point on the given surface.
Per convention, the z-axis of the transforms is equal to the normal of the surface. The leftover rotational degree of freedom (in-surface rotation around the normal) is stabilized analyzing geometrical changes of the surface.
Hierarchy
↳ PointOnSurfaceAnchor
Implements
Index
Properties
- additionalElementContext
- changeEventEmitter
- element
- elementSignature
- isDestroyed
- lastMeshAdaptionWasSuccessful
- mesh
- meshLocalTransforms
- transforms
- transformsChangeEventEmitter
Methods
- _adaptToChangedMesh
- _adjustToRotationAroundAxis
- _applyChangedScale
- _canCalculatePublicTransforms
- _changeSelfToChosenCandidate
- _checkIfAnchorCanBeValid
- _createEvent
- _createSplitOffInstance
- _determineMatchingPoints
- _ensurePointIsOnSurfacePlane
- _ensureRotationIsInPlane
- _extractAdditionalElementContextFromCurrentElement
- _extractSignatureFromCurrentElement
- _findByMirror
- _findBySameIdentity
- _findBySameSignature
- _findBySameUID
- _findBySimilarSignature
- _findSurfacesWithSharedPoints
- _getAssemblySpaceSignature
- _getInstance
- _getSurfacesWithSimilarNormal
- _isElementValid
- _localCoordinateSystemIsValid
- _mirrorPositionAndRotation
- _onMeshChange
- _onMeshTransformsChange
- _performInitialLookup
- _reFindElementOnMesh
- _refindSelfAndEmit
- _setElement
- _setMesh
- _setMeshAndElement
- _setPosition
- _setRotation
- _transformCoordinateSystemToNewSurface
- _updatePublicTransformsFromLocal
- clone
- destroy
- getChangeEventEmitter
- getInMeshTarget
- getIsValid
- getLocalAngle
- getMesh
- getMeshLocalTransforms
- getSignature
- getSurface
- getTargets
- getTransforms
- getTransformsChangeEventEmitter
- getTransformsTargets
- initializeFromElement
- initializeFromElementWithLocalCoordinates
- initializeFromSignature
- reFindElementOnMesh
- rotateAround
- setFromPointOnSurface
- setLocalAngle
- setPosition
- setRotation
- _createDefaultRotation
Properties
Protected additionalElementContext
• additionalElementContext: Map‹string, object› = new Map()
Overrides MeshElementAnchor.additionalElementContext
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:60
Protected Readonly changeEventEmitter
• changeEventEmitter: EventEmitter‹IMeshAnchorChangeEvent› = new EventEmitter
Inherited from AbstractMeshAnchor.changeEventEmitter
Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:33
Protected element
• element: MeshSurface = null
Inherited from MeshElementAnchor.element
Defined in src/model/data/Concepts/Anchors/MeshElementAnchor.ts:42
Last known identity of the element. Only null if the anchor has never been valid in its lifetime yet or is already destroyed.
Protected elementSignature
• elementSignature: ISurfaceSignature = null
Inherited from MeshSurfaceAnchor.elementSignature
Overrides MeshElementAnchor.elementSignature
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:52
Protected isDestroyed
• isDestroyed: boolean = false
Inherited from AbstractMeshAnchor.isDestroyed
Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:24
Protected lastMeshAdaptionWasSuccessful
• lastMeshAdaptionWasSuccessful: boolean = false
Inherited from AbstractMeshAnchor.lastMeshAdaptionWasSuccessful
Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:31
During initialization, subclasses need to take care of setting this value to true, if the anchor became valid before the first meshChangeEvent was fired. Else, the anchor will stay invalid until the first meshChangeEvent is fired.
Protected mesh
• mesh: Mesh | null
Inherited from AbstractMeshAnchor.mesh
Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:23
Private meshLocalTransforms
• meshLocalTransforms: Transforms‹› = new Transforms()
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:70
The transforms, in mesh coordinate system
Private transforms
• transforms: Transforms‹› = new Transforms()
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:66
The official transforms of the anchor, in assembly space
Private Readonly transformsChangeEventEmitter
• transformsChangeEventEmitter: EventEmitter‹ITransformsChangeEvent› = new EventEmitter
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:62
Methods
Protected _adaptToChangedMesh
▸ _adaptToChangedMesh(event: MeshChangeEvent, requiresExactMatch: boolean): object
Inherited from MeshElementAnchor._adaptToChangedMesh
Overrides AbstractMeshAnchor._adaptToChangedMesh
Defined in src/model/data/Concepts/Anchors/MeshElementAnchor.ts:263
see AbstractMeshAnchor._adaptToChangedMesh
Parameters:
| Name | Type | Description |
|---|---|---|
event |
MeshChangeEvent | - |
requiresExactMatch |
boolean | if true, will only adapt to elements in the mesh that match the signature perfectly |
Returns: object
-
event? : IMeshAnchorChangeEvent
-
invalid: boolean
Private _adjustToRotationAroundAxis
▸ _adjustToRotationAroundAxis(notChangedOutlinePoints: ReadonlyVector3[], notChangedOutlineEdges: MeshHalfEdge[], oldNormal: Vector3, newNormal: Vector3): boolean
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:653
Parameters:
| Name | Type | Description |
|---|---|---|
notChangedOutlinePoints |
ReadonlyVector3[] | - |
notChangedOutlineEdges |
MeshHalfEdge[] | - |
oldNormal |
Vector3 | - |
newNormal |
Vector3 | - |
Returns: boolean
Protected _applyChangedScale
▸ _applyChangedScale(scale: number): void
Overrides MeshSurfaceAnchor._applyChangedScale
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:391
Parameters:
| Name | Type |
|---|---|
scale |
number |
Returns: void
Private _canCalculatePublicTransforms
▸ _canCalculatePublicTransforms(): boolean
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:409
true, if the mesh is defined and has a transforms definer
Returns: boolean
Protected _changeSelfToChosenCandidate
▸ _changeSelfToChosenCandidate(chosenCandidate: IAbstractElementCandidate‹MeshSurface›, mirror?: IMirrorMapping): boolean
Overrides MeshElementAnchor._changeSelfToChosenCandidate
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:358
Parameters:
| Name | Type |
|---|---|
chosenCandidate |
IAbstractElementCandidate‹MeshSurface› |
mirror? |
IMirrorMapping |
Returns: boolean
Protected _checkIfAnchorCanBeValid
▸ _checkIfAnchorCanBeValid(): boolean
Inherited from MeshElementAnchor._checkIfAnchorCanBeValid
Overrides AbstractMeshAnchor._checkIfAnchorCanBeValid
Defined in src/model/data/Concepts/Anchors/MeshElementAnchor.ts:194
Returns: boolean
Protected _createEvent
▸ _createEvent(splitAnchors: MeshSurfaceAnchor[], previousTarget: Mesh, __namedParameters: object): IMeshAnchorChangeEvent
Inherited from MeshElementAnchor._createEvent
Defined in src/model/data/Concepts/Anchors/MeshElementAnchor.ts:224
Creates an appropriate MeshAnchorChangeEvent depending on how many additional anchors have been created
Parameters:
▪ splitAnchors: MeshSurfaceAnchor[]
if there are multiple equally good candidates, the rest of them should be split off using an anchor each. In this case, the event will be a MeshAnchorChange.SPLIT.
▪ previousTarget: Mesh
-
▪ __namedParameters: object
| Name | Type | Description |
|---|---|---|
mirror |
IMirrorMapping | - |
scale |
number | - |
Returns: IMeshAnchorChangeEvent
Protected _createSplitOffInstance
▸ _createSplitOffInstance(mesh: Mesh, surface: MeshSurface): PointOnSurfaceAnchor
Overrides MeshSurfaceAnchor._createSplitOffInstance
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:351
Parameters:
| Name | Type |
|---|---|
mesh |
Mesh |
surface |
MeshSurface |
Returns: PointOnSurfaceAnchor
Protected _determineMatchingPoints
▸ _determineMatchingPoints(candidateMesh: Mesh, candidateSurface: MeshSurface): Vector3[]
Inherited from MeshSurfaceAnchor._determineMatchingPoints
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:265
Parameters:
| Name | Type |
|---|---|
candidateMesh |
Mesh |
candidateSurface |
MeshSurface |
Returns: Vector3[]
Private _ensurePointIsOnSurfacePlane
▸ _ensurePointIsOnSurfacePlane(point: Vector3): void
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:682
Parameters:
| Name | Type |
|---|---|
point |
Vector3 |
Returns: void
Private _ensureRotationIsInPlane
▸ _ensureRotationIsInPlane(localRotation: Quaternion): Quaternion
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:700
Makes sure the rotation only rotates within the surface, i.e. does not change the surface's normal vector when applied to it.
Parameters:
| Name | Type | Description |
|---|---|---|
localRotation |
Quaternion | the mesh-local rotation |
Returns: Quaternion
the mesh-local rotation, fixed when being flipped by 180°
Protected _extractAdditionalElementContextFromCurrentElement
▸ _extractAdditionalElementContextFromCurrentElement(): Map‹string, object›
Overrides MeshSurfaceAnchor._extractAdditionalElementContextFromCurrentElement
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:336
Returns: Map‹string, object›
Protected _extractSignatureFromCurrentElement
▸ _extractSignatureFromCurrentElement(): ISurfaceSignature
Inherited from MeshSurfaceAnchor._extractSignatureFromCurrentElement
Overrides MeshElementAnchor._extractSignatureFromCurrentElement
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:108
Do not extract the signature when the surface is degenerated (normal with length 0 doesn't help us). Rather keep the old signature.
Returns: ISurfaceSignature
Protected _findByMirror
▸ _findByMirror(successor: Mesh, mirror: IMirrorMapping): Array‹IAbstractElementCandidate‹MeshSurface››
Inherited from MeshSurfaceAnchor._findByMirror
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:186
Parameters:
| Name | Type |
|---|---|
successor |
Mesh |
mirror |
IMirrorMapping |
Returns: Array‹IAbstractElementCandidate‹MeshSurface››
Protected _findBySameIdentity
▸ _findBySameIdentity(candidateMesh: Mesh): ISurfaceCandidate[]
Inherited from MeshSurfaceAnchor._findBySameIdentity
Overrides MeshElementAnchor._findBySameIdentity
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:154
Easy case - we still have the same identity NOTICE: this can produce unexpected results: if we have a CSG operation that splits up a surface in two equally possible successors and keeps one surface with same identity, this line will always only choose one surface. This is okay as long as we assume "if the same surface identity remains, it always wins"
Parameters:
| Name | Type | Description |
|---|---|---|
candidateMesh |
Mesh | - |
Returns: ISurfaceCandidate[]
Protected _findBySameSignature
▸ _findBySameSignature(candidateMesh: Mesh): ISurfaceCandidate[]
Inherited from MeshSurfaceAnchor._findBySameSignature
Overrides MeshElementAnchor._findBySameSignature
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:204
Try to find a surface with same normal and same outline points
Parameters:
| Name | Type | Description |
|---|---|---|
candidateMesh |
Mesh | - |
Returns: ISurfaceCandidate[]
Protected _findBySameUID
▸ _findBySameUID(candidateMesh: Mesh): Array‹IAbstractElementCandidate‹MeshSurface››
Inherited from MeshSurfaceAnchor._findBySameUID
Overrides MeshElementAnchor._findBySameUID
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:166
Also returns the surface with the same uid but different identity. The anchor also follows the surface when it moved and has a different identity but we know where it needs to go.
Parameters:
| Name | Type | Description |
|---|---|---|
candidateMesh |
Mesh | - |
Returns: Array‹IAbstractElementCandidate‹MeshSurface››
Protected _findBySimilarSignature
▸ _findBySimilarSignature(candidateMesh: Mesh): ISurfaceCandidate[]
Inherited from MeshSurfaceAnchor._findBySimilarSignature
Overrides MeshElementAnchor._findBySimilarSignature
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:286
Tries to find matching surfaces based on a similar (= within some ° similarity) normal and similar outline points. Assigns probability values based on the similarity to the original surface.
Parameters:
| Name | Type | Description |
|---|---|---|
candidateMesh |
Mesh | - |
Returns: ISurfaceCandidate[]
Protected _findSurfacesWithSharedPoints
▸ _findSurfacesWithSharedPoints(candidateMesh: Mesh, minimalMatchingPointsCount?: number, normalDifferenceTolerance?: number): ISurfaceCandidate[]
Inherited from MeshSurfaceAnchor._findSurfacesWithSharedPoints
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:213
Parameters:
| Name | Type |
|---|---|
candidateMesh |
Mesh |
minimalMatchingPointsCount? |
number |
normalDifferenceTolerance? |
number |
Returns: ISurfaceCandidate[]
Protected _getAssemblySpaceSignature
▸ _getAssemblySpaceSignature(signature: ISurfaceSignature): ISurfaceSignature
Inherited from MeshSurfaceAnchor._getAssemblySpaceSignature
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:311
Transforms the surface signature into assembly space so that it can be compared with other meshes
Parameters:
| Name | Type |
|---|---|
signature |
ISurfaceSignature |
Returns: ISurfaceSignature
Protected _getInstance
▸ _getInstance(): MeshSurfaceAnchor
Inherited from MeshSurfaceAnchor._getInstance
Overrides MeshElementAnchor._getInstance
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:100
Returns: MeshSurfaceAnchor
Protected _getSurfacesWithSimilarNormal
▸ _getSurfacesWithSimilarNormal(candidateMesh: Mesh, allowedAngleDifference?: number): MeshSurface[]
Inherited from MeshSurfaceAnchor._getSurfacesWithSimilarNormal
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:247
Parameters:
| Name | Type |
|---|---|
candidateMesh |
Mesh |
allowedAngleDifference? |
number |
Returns: MeshSurface[]
Protected _isElementValid
▸ _isElementValid(): boolean
Inherited from MeshSurfaceAnchor._isElementValid
Overrides MeshElementAnchor._isElementValid
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:126
Returns: boolean
Private _localCoordinateSystemIsValid
▸ _localCoordinateSystemIsValid(): boolean
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:417
Returns: boolean
true, if the local coordinate system origin lies in the surface and is only a rotation around the surface's normal
Private _mirrorPositionAndRotation
▸ _mirrorPositionAndRotation(newSurface: MeshSurface, mirror: IMirrorMapping): boolean
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:602
Transforms the coordinate system using a reference surface and the mirror matrix.
Parameters:
| Name | Type | Description |
|---|---|---|
newSurface |
MeshSurface | - |
mirror |
IMirrorMapping | - |
Returns: boolean
if the anchor is still valid (currently always true)
Protected _onMeshChange
▸ _onMeshChange(meshEvent: MeshChangeEvent): void
Overrides AbstractMeshAnchor._onMeshChange
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:329
Parameters:
| Name | Type |
|---|---|
meshEvent |
MeshChangeEvent |
Returns: void
Private _onMeshTransformsChange
▸ _onMeshTransformsChange(event: ITransformsChangeEvent): void
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:678
Parameters:
| Name | Type |
|---|---|
event |
ITransformsChangeEvent |
Returns: void
Protected _performInitialLookup
▸ _performInitialLookup(): void
Inherited from MeshElementAnchor._performInitialLookup
Defined in src/model/data/Concepts/Anchors/MeshElementAnchor.ts:173
When creating the anchor, there is the time span between setting signature/mesh and the first mesh change event where the anchor can already be valid (if the mesh is already filled with the correct data). To not falsely stay invalid, when either the element is set or the mesh is set, this initial lookup function needs to be called.
Afterwards, the anchor will simply evaluate it's validity after each meshChange event.
Returns: void
Protected _reFindElementOnMesh
▸ _reFindElementOnMesh(candidateMesh: Mesh, requiresExactMatch: boolean, mirror?: IMirrorMapping): Array‹IAbstractElementCandidate‹MeshSurface››
Inherited from MeshSurfaceAnchor._reFindElementOnMesh
Overrides MeshElementAnchor._reFindElementOnMesh
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:176
Parameters:
| Name | Type |
|---|---|
candidateMesh |
Mesh |
requiresExactMatch |
boolean |
mirror? |
IMirrorMapping |
Returns: Array‹IAbstractElementCandidate‹MeshSurface››
Protected _refindSelfAndEmit
▸ _refindSelfAndEmit(meshEvent: MeshChangeEvent, requiresExactMatch: boolean): void
Inherited from AbstractMeshAnchor._refindSelfAndEmit
Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:134
Parameters:
| Name | Type | Default |
|---|---|---|
meshEvent |
MeshChangeEvent | - |
requiresExactMatch |
boolean | false |
Returns: void
Protected _setElement
▸ _setElement(element: MeshSurface): void
Inherited from MeshElementAnchor._setElement
Defined in src/model/data/Concepts/Anchors/MeshElementAnchor.ts:363
Sets the (new) element this points to. For data consistency, also extracts the element's signature
Parameters:
| Name | Type |
|---|---|
element |
MeshSurface |
Returns: void
_setMesh
▸ _setMesh(newMesh: Mesh): void
Overrides AbstractMeshAnchor._setMesh
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:215
Parameters:
| Name | Type |
|---|---|
newMesh |
Mesh |
Returns: void
Protected _setMeshAndElement
▸ _setMeshAndElement(mesh: Mesh, element: MeshSurface): void
Inherited from MeshElementAnchor._setMeshAndElement
Defined in src/model/data/Concepts/Anchors/MeshElementAnchor.ts:185
Parameters:
| Name | Type |
|---|---|
mesh |
Mesh |
element |
MeshSurface |
Returns: void
Private _setPosition
▸ _setPosition(localPointOnSurface: Vector3, emitEvent: boolean): void
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:401
Parameters:
| Name | Type | Default |
|---|---|---|
localPointOnSurface |
Vector3 | - |
emitEvent |
boolean | true |
Returns: void
Private _setRotation
▸ _setRotation(localRotation: Quaternion, emitEvent: boolean): void
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:396
Parameters:
| Name | Type | Default |
|---|---|---|
localRotation |
Quaternion | - |
emitEvent |
boolean | true |
Returns: void
Private _transformCoordinateSystemToNewSurface
▸ _transformCoordinateSystemToNewSurface(newSurface: MeshSurface, mirror: IMirrorMapping): boolean
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:437
Transforms the anchor's coordinate system (== the point + orientation on the surface) to the newly selected surface. All values stored in the instance aren't changed yet, however adapted to the new surface's mesh's coordinate system.
You should adapt the meshLocalTransforms here, as the transforms will be updated based on this later.
Parameters:
| Name | Type |
|---|---|
newSurface |
MeshSurface |
mirror |
IMirrorMapping |
Returns: boolean
whether the transforms were be adapted successfully
Private _updatePublicTransformsFromLocal
▸ _updatePublicTransformsFromLocal(emitEvent: boolean): void
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:724
Parameters:
| Name | Type | Default |
|---|---|---|
emitEvent |
boolean | true |
Returns: void
clone
▸ clone(): PointOnSurfaceAnchor
Implementation of IOrientedPositioningAnchor
Overrides MeshElementAnchor.clone
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:261
Returns: PointOnSurfaceAnchor
destroy
▸ destroy(): void
Implementation of IOrientedPositioningAnchor
Overrides MeshElementAnchor.destroy
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:147
Returns: void
getChangeEventEmitter
▸ getChangeEventEmitter(): IPublicEventEmitterInterface‹IMeshAnchorChangeEvent›
Implementation of IOrientedPositioningAnchor
Inherited from AbstractMeshAnchor.getChangeEventEmitter
Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:81
Returns: IPublicEventEmitterInterface‹IMeshAnchorChangeEvent›
getInMeshTarget
▸ getInMeshTarget(): MeshElement
Implementation of IMeshAnchor
Inherited from MeshSurfaceAnchor.getInMeshTarget
Overrides AbstractMeshAnchor.getInMeshTarget
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:88
Returns: MeshElement
getIsValid
▸ getIsValid(): boolean
Implementation of IOrientedPositioningAnchor
Overrides AbstractMeshAnchor.getIsValid
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:275
Returns: boolean
if the mesh, surface, and local coordinate system are valid.
getLocalAngle
▸ getLocalAngle(): number
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:284
Returns: number
getMesh
▸ getMesh(): Mesh‹›
Implementation of IMeshAnchor
Inherited from AbstractMeshAnchor.getMesh
Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:47
This should initialize the anchor with the necessary positionable arguments.
Returns: Mesh‹›
getMeshLocalTransforms
▸ getMeshLocalTransforms(): IReadOnlyTransforms
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:143
Returns: IReadOnlyTransforms
getSignature
▸ getSignature(): ISurfaceSignature
Inherited from MeshSurfaceAnchor.getSignature
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:96
Returns: ISurfaceSignature
getSurface
▸ getSurface(): MeshSurface
Inherited from MeshSurfaceAnchor.getSurface
Defined in src/model/data/Concepts/Anchors/MeshSurfaceAnchor.ts:92
Returns: MeshSurface
getTargets
▸ getTargets(): [Mesh] | []
Implementation of IOrientedPositioningAnchor
Inherited from AbstractMeshAnchor.getTargets
Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:54
Returns: [Mesh] | []
the target mesh this anchor points to or an empty list if the mesh is not set
getTransforms
▸ getTransforms(): IReadOnlyTransforms
Implementation of IOrientedPositioningAnchor
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:139
Returns: IReadOnlyTransforms
getTransformsChangeEventEmitter
▸ getTransformsChangeEventEmitter(): IPublicEventEmitterInterface‹ITransformsChangeEvent›
Implementation of IOrientedPositioningAnchor
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:135
Returns: IPublicEventEmitterInterface‹ITransformsChangeEvent›
getTransformsTargets
▸ getTransformsTargets(): any[]
Implementation of IOrientedPositioningAnchor
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:127
Returns: any[]
initializeFromElement
▸ initializeFromElement(mesh: Mesh, surface: MeshSurface, pointOnSurface?: ReadonlyVector3, rotationInSurfacePlane?: ReadonlyQuaternion): this
Overrides MeshElementAnchor.initializeFromElement
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:84
Initializes the anchor with a mesh and surface (and as with MeshSurfaceAnchor.initializeFromElement, expect the combination of mesh and surface to be valid).
Parameters:
| Name | Type | Description |
|---|---|---|
mesh |
Mesh | - |
surface |
MeshSurface | - |
pointOnSurface? |
ReadonlyVector3 | point (in assembly space) that lies on the surface. If not defined, the center of the surface is taken. |
rotationInSurfacePlane? |
ReadonlyQuaternion | a rotation (in assembly space) that lies in the surface's plane (meaning that if you apply this rotation to the unrotated normal (0, 0, 1) vector, the rotated vector must equal the surface's normal in assembly space). If not defined, will align the x-axis to the first section of the surface. |
Returns: this
initializeFromElementWithLocalCoordinates
▸ initializeFromElementWithLocalCoordinates(mesh: Mesh, surface: MeshSurface, localPointOnSurface: Vector3, localRotationInSurfacePlane: Quaternion‹›): this
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:105
Parameters:
| Name | Type | Default |
|---|---|---|
mesh |
Mesh | - |
surface |
MeshSurface | - |
localPointOnSurface |
Vector3 | - |
localRotationInSurfacePlane |
Quaternion‹› | PointOnSurfaceAnchor._createDefaultRotation( |
| surface.getOutlinePointsReadonly(), | ||
| surface.getNormal(), | ||
| ) |
Returns: this
initializeFromSignature
▸ initializeFromSignature(mesh: Mesh, signature: ISurfaceSignature, localPosition?: Vector3, localRotation?: Quaternion): void
Overrides MeshElementAnchor.initializeFromSignature
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:237
Preferred way of using: Initializes the anchor with a mesh and surface signature ({@see MeshSurfaceAnchor.initializeFromSignature} for constraints).
Parameters:
| Name | Type | Description |
|---|---|---|
mesh |
Mesh | - |
signature |
ISurfaceSignature | - |
localPosition? |
Vector3 | - |
localRotation? |
Quaternion | - |
Returns: void
reFindElementOnMesh
▸ reFindElementOnMesh(candidateMesh: Mesh, requiresExactMatch: boolean, mirror?: IMirrorMapping): Array‹IAbstractElementCandidate‹MeshSurface››
Inherited from MeshElementAnchor.reFindElementOnMesh
Defined in src/model/data/Concepts/Anchors/MeshElementAnchor.ts:99
Parameters:
| Name | Type |
|---|---|
candidateMesh |
Mesh |
requiresExactMatch |
boolean |
mirror? |
IMirrorMapping |
Returns: Array‹IAbstractElementCandidate‹MeshSurface››
rotateAround
▸ rotateAround(rotationPoint: Vector3, angle: number): void
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:320
Rotates the POSA around the surface normal with the given rotationPoint and angle
Parameters:
| Name | Type | Description |
|---|---|---|
rotationPoint |
Vector3 | in assembly coordinates |
angle |
number | in radians |
Returns: void
setFromPointOnSurface
▸ setFromPointOnSurface(mesh: Mesh, point: Vector3, normal?: Vector3, rotation?: Quaternion): void
Overrides MeshSurfaceAnchor.setFromPointOnSurface
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:165
This will initialize this PointOnSurfaceAnchor with a MeshSurface and set its position. You can optionally supply a rotation as well.
Parameters:
| Name | Type | Description |
|---|---|---|
mesh |
Mesh | see MeshSurfaceAnchor.setFromPointOnSurface |
point |
Vector3 | see MeshSurfaceAnchor.setFromPointOnSurface |
normal? |
Vector3 | see MeshSurfaceAnchor.setFromPointOnSurface |
rotation? |
Quaternion | optional rotation of the PointOnSurfaceAnchor. In mesh coordinates. |
Returns: void
setLocalAngle
▸ setLocalAngle(angle: number): void
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:304
Sets the local rotation angle around the surface normal. An angle of 0 means, that the surface's first section aligns with the local x direction.
Parameters:
| Name | Type | Description |
|---|---|---|
angle |
number | in radians, positive numbers are rotation in CCW direction around the normal, when seen from above |
Returns: void
setPosition
▸ setPosition(pointOnSurface: ReadonlyVector3): void
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:180
Changes the position of the anchor
Parameters:
| Name | Type | Description |
|---|---|---|
pointOnSurface |
ReadonlyVector3 | the new position, in assembly space. The point is expected to lie in the plane of the surface. |
Returns: void
setRotation
▸ setRotation(rotationInSurfacePlane: Quaternion): void
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:201
Changes the rotation of the anchor
Parameters:
| Name | Type | Description |
|---|---|---|
rotationInSurfacePlane |
Quaternion | the new rotation, in assembly space. The rotation is expected to be in the surface plane, i.e. applying it to the z=1 vector has to result in the surface's normal (in assembly space) |
Returns: void
Static Private _createDefaultRotation
▸ _createDefaultRotation(outlinePoints: ReadonlyVectorCycle3D, surfaceNormal: Vector3, initialRotation?: number): Quaternion
Defined in src/model/data/Concepts/Anchors/PointOnSurfaceAnchor.ts:36
Creates a default rotation in mesh-space, meaning that the rotation's x-axis is aligned to one of the surface's sections and the z axis equals the normal.
Parameters:
| Name | Type | Description |
|---|---|---|
outlinePoints |
ReadonlyVectorCycle3D | - |
surfaceNormal |
Vector3 | - |
initialRotation? |
number | allows you to set an initial rotation angle, if not supplied, 0 will be used implicitly |
Returns: Quaternion