Class: Mesh
A Mesh describes a two-manifold volume. It can be implemented in different ways by using different MeshImplementations.
You may only modify a mesh using the modify() callback, where you can also access and modify the MeshImplementation directly. Re-usable modifications should be extracted into a MeshOperation class, which offers additional convenience functions around the modify() function, e.g. @see SingleMeshOperation
Hierarchy
- Mesh
Implements
Index
Constructors
Properties
- annotations
- assembly
- changeEventEmitter
- dimensionConception
- implementation
- meshAnalyzers
- meshCaches
- meshOperationInProgress
- modifyPromiseChain
- modifyQueueLength
- transformsAnchor
- transformsChangeEventEmitter
Methods
- _getAnnotations
- _getImplementation
- _onAnchorTransformsChange
- _onAnnotationChange
- _resetCaches
- _throwErrorOnCoordinateTransformationIfMeshIsInvalid
- addAnnotation
- canBeModifiedSynchronously
- cleanupInvalidAnnotations
- destroy
- getAnalyzer
- getAnnotationsFor
- getAssembly
- getCache
- getChangeEventEmitter
- getDimensionConception
- getEdges
- getElementsThisDependsOn
- getGlobalTransforms
- getIsTwoManifold
- getIsValid
- getNumberOfNotDisabledSurfaces
- getParent
- getPoints
- getSurfaces
- getTransforms
- getTransformsChangeEventEmitter
- getTransformsDefiner
- hasEdge
- hasSurface
- isSurfaceDisabled
- mapLocalDirectionToWorld
- mapLocalPositionToWorld
- mapLocalRotationToWorld
- mapWorldDirectionToLocal
- mapWorldPositionToLocal
- mapWorldRotationToLocal
- modify
- modifySync
- removeAnnotation
- setAssembly
- setDimensionConception
- setImplementation
- setTransformsDefiner
Constructors
constructor
+ new Mesh(referenceTransforms?: IReadOnlyTransforms): Mesh
Defined in src/model/data/Concepts/Mesh/Mesh.ts:81
Parameters:
| Name | Type |
|---|---|
referenceTransforms? |
IReadOnlyTransforms |
Returns: Mesh
Properties
Private annotations
• annotations: Set‹MeshAnnotation› = new Set()
Defined in src/model/data/Concepts/Mesh/Mesh.ts:75
Private assembly
• assembly: Assembly = null
Defined in src/model/data/Concepts/Mesh/Mesh.ts:73
Private Readonly changeEventEmitter
• changeEventEmitter: EventEmitter‹MeshChangeEvent› = new EventEmitter
Defined in src/model/data/Concepts/Mesh/Mesh.ts:62
Private dimensionConception
• dimensionConception: DimensionConception = DimensionConception.EXTERNAL
Defined in src/model/data/Concepts/Mesh/Mesh.ts:81
Protected implementation
• implementation: IMeshImplementation
Defined in src/model/data/Concepts/Mesh/Mesh.ts:60
Private meshAnalyzers
• meshAnalyzers: Map‹AnalyzerType, MeshAnalyzer‹›› = new Map
Defined in src/model/data/Concepts/Mesh/Mesh.ts:78
Private meshCaches
• meshCaches: Map‹CacheType, MeshCache‹›› = new Map
Defined in src/model/data/Concepts/Mesh/Mesh.ts:77
Private meshOperationInProgress
• meshOperationInProgress: boolean = false
Defined in src/model/data/Concepts/Mesh/Mesh.ts:79
Private modifyPromiseChain
• modifyPromiseChain: Promise‹void› = Promise.resolve()
Defined in src/model/data/Concepts/Mesh/Mesh.ts:68
Private modifyQueueLength
• modifyQueueLength: number = 0
Defined in src/model/data/Concepts/Mesh/Mesh.ts:69
Private transformsAnchor
• transformsAnchor: IPositioningAnchor | null
Defined in src/model/data/Concepts/Mesh/Mesh.ts:71
Private Readonly transformsChangeEventEmitter
• transformsChangeEventEmitter: EventEmitter‹ITransformsChangeEvent› = new EventEmitter< ITransformsChangeEvent
()
Defined in src/model/data/Concepts/Mesh/Mesh.ts:64
Methods
_getAnnotations
▸ _getAnnotations(reason: string): Set‹MeshAnnotation‹››
Defined in src/model/data/Concepts/Mesh/Mesh.ts:536
WARNING: This method is for serialization only. Do not use this to modify the Mesh.
Parameters:
| Name | Type |
|---|---|
reason |
string |
Returns: Set‹MeshAnnotation‹››
_getImplementation
▸ _getImplementation(): IMeshImplementation
Defined in src/model/data/Concepts/Mesh/Mesh.ts:529
WARNING: This method is for serialization only. Do not use this to modify the Mesh.
Returns: IMeshImplementation
Private _onAnchorTransformsChange
▸ _onAnchorTransformsChange(event: ITransformsChangeEvent): void
Defined in src/model/data/Concepts/Mesh/Mesh.ts:547
Parameters:
| Name | Type |
|---|---|
event |
ITransformsChangeEvent |
Returns: void
Private _onAnnotationChange
▸ _onAnnotationChange(): void
Defined in src/model/data/Concepts/Mesh/Mesh.ts:543
Returns: void
Private _resetCaches
▸ _resetCaches(): void
Defined in src/model/data/Concepts/Mesh/Mesh.ts:555
Returns: void
Private _throwErrorOnCoordinateTransformationIfMeshIsInvalid
▸ _throwErrorOnCoordinateTransformationIfMeshIsInvalid(): void
Defined in src/model/data/Concepts/Mesh/Mesh.ts:562
Returns: void
addAnnotation
▸ addAnnotation(meshAnnotation: MeshAnnotation): void
Defined in src/model/data/Concepts/Mesh/Mesh.ts:182
Adds an annotation to the mesh.
Parameters:
| Name | Type | Description |
|---|---|---|
meshAnnotation |
MeshAnnotation | - |
Returns: void
canBeModifiedSynchronously
▸ canBeModifiedSynchronously(): boolean
Defined in src/model/data/Concepts/Mesh/Mesh.ts:335
Returns: boolean
cleanupInvalidAnnotations
▸ cleanupInvalidAnnotations(): void
Defined in src/model/data/Concepts/Mesh/Mesh.ts:200
Removes all annotations that have an invalid anchor and thus do not point to anything useful anymore
Returns: void
destroy
▸ destroy(): void
Implementation of IPositionableElement
Defined in src/model/data/Concepts/Mesh/Mesh.ts:250
Returns: void
getAnalyzer
▸ getAnalyzer(type: VOLUME_ANALYZER): MeshVolumeAnalyzer
Defined in src/model/data/Concepts/Mesh/Mesh.ts:422
Get an analyzer of the given type. This analyzer will remain valid until the next MeshChangeEvent.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
VOLUME_ANALYZER | - |
Returns: MeshVolumeAnalyzer
▸ getAnalyzer(type: SURFACE_ANALYZER): MeshSurfaceAnalyzer
Defined in src/model/data/Concepts/Mesh/Mesh.ts:423
Parameters:
| Name | Type |
|---|---|
type |
SURFACE_ANALYZER |
Returns: MeshSurfaceAnalyzer
▸ getAnalyzer(type: POINTS_ANALYZER): MeshPointsAnalyzer
Defined in src/model/data/Concepts/Mesh/Mesh.ts:424
Parameters:
| Name | Type |
|---|---|
type |
POINTS_ANALYZER |
Returns: MeshPointsAnalyzer
▸ getAnalyzer(type: EDGE_ANALYZER): MeshEdgeAnalyzer
Defined in src/model/data/Concepts/Mesh/Mesh.ts:425
Parameters:
| Name | Type |
|---|---|
type |
EDGE_ANALYZER |
Returns: MeshEdgeAnalyzer
getAnnotationsFor
▸ getAnnotationsFor(target: MeshElement): MeshAnnotation[]
Defined in src/model/data/Concepts/Mesh/Mesh.ts:187
Parameters:
| Name | Type |
|---|---|
target |
MeshElement |
Returns: MeshAnnotation[]
getAssembly
▸ getAssembly(): Assembly
Implementation of IPositionableElement
Defined in src/model/data/Concepts/Mesh/Mesh.ts:139
Returns: Assembly
getCache
▸ getCache(type: SURFACE_NORMALS): SurfaceNormalCache
Defined in src/model/data/Concepts/Mesh/Mesh.ts:386
Get a cache of the given type. This cache will remain valid until the next MeshChangeEvent.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
SURFACE_NORMALS | - |
Returns: SurfaceNormalCache
▸ getCache(type: SURFACE_POINTS): SurfacePointsCache
Defined in src/model/data/Concepts/Mesh/Mesh.ts:387
Parameters:
| Name | Type |
|---|---|
type |
SURFACE_POINTS |
Returns: SurfacePointsCache
▸ getCache(type: SURFACE_PLANE): SurfacePlaneCache
Defined in src/model/data/Concepts/Mesh/Mesh.ts:388
Parameters:
| Name | Type |
|---|---|
type |
SURFACE_PLANE |
Returns: SurfacePlaneCache
getChangeEventEmitter
▸ getChangeEventEmitter(): IPublicEventEmitterInterface‹MeshChangeEvent‹››
Implementation of IPositionableElement
Defined in src/model/data/Concepts/Mesh/Mesh.ts:147
Returns: IPublicEventEmitterInterface‹MeshChangeEvent‹››
getDimensionConception
▸ getDimensionConception(): DimensionConception
Defined in src/model/data/Concepts/Mesh/Mesh.ts:170
Returns: DimensionConception
getEdges
▸ getEdges(): MeshHalfEdge[]
Defined in src/model/data/Concepts/Mesh/Mesh.ts:123
Returns: MeshHalfEdge[]
getElementsThisDependsOn
▸ getElementsThisDependsOn(): IModelElement[]
Implementation of IPositionableElement
Defined in src/model/data/Concepts/Mesh/Mesh.ts:369
Returns: IModelElement[]
getGlobalTransforms
▸ getGlobalTransforms(): Transforms
Defined in src/model/data/Concepts/Mesh/Mesh.ts:159
Returns: Transforms
getIsTwoManifold
▸ getIsTwoManifold(): boolean
Defined in src/model/data/Concepts/Mesh/Mesh.ts:119
Returns: boolean
getIsValid
▸ getIsValid(): boolean
Implementation of IPositionableElement
Defined in src/model/data/Concepts/Mesh/Mesh.ts:241
Returns: boolean
getNumberOfNotDisabledSurfaces
▸ getNumberOfNotDisabledSurfaces(): number
Defined in src/model/data/Concepts/Mesh/Mesh.ts:215
Returns: number
getParent
▸ getParent(): ITransformable
Implementation of IPositionableElement
Defined in src/model/data/Concepts/Mesh/Mesh.ts:163
Returns: ITransformable
getPoints
▸ getPoints(): MeshPoint[]
Defined in src/model/data/Concepts/Mesh/Mesh.ts:131
Returns: MeshPoint[]
getSurfaces
▸ getSurfaces(): readonly MeshSurface[]
Defined in src/model/data/Concepts/Mesh/Mesh.ts:111
Returns: readonly MeshSurface[]
the surfaces that define this mesh. Note that the transforms defined by the transforms-defining anchor are NOT applied (== surfaces are in "local coordinates"), this is the responsibility of whoever uses theses surfaces.
getTransforms
▸ getTransforms(): IReadOnlyTransforms | null
Implementation of IPositionableElement
Defined in src/model/data/Concepts/Mesh/Mesh.ts:155
Returns: IReadOnlyTransforms | null
getTransformsChangeEventEmitter
▸ getTransformsChangeEventEmitter(): IPublicEventEmitterInterface‹ITransformsChangeEvent›
Implementation of IPositionableElement
Defined in src/model/data/Concepts/Mesh/Mesh.ts:378
Returns: IPublicEventEmitterInterface‹ITransformsChangeEvent›
getTransformsDefiner
▸ getTransformsDefiner(): IPositioningAnchor | null
Implementation of IPositionableElement
Defined in src/model/data/Concepts/Mesh/Mesh.ts:151
Returns: IPositioningAnchor | null
hasEdge
▸ hasEdge(edge: MeshHalfEdge): boolean
Defined in src/model/data/Concepts/Mesh/Mesh.ts:135
Parameters:
| Name | Type |
|---|---|
edge |
MeshHalfEdge |
Returns: boolean
hasSurface
▸ hasSurface(surface: MeshSurface): boolean
Defined in src/model/data/Concepts/Mesh/Mesh.ts:115
Parameters:
| Name | Type |
|---|---|
surface |
MeshSurface |
Returns: boolean
isSurfaceDisabled
▸ isSurfaceDisabled(surface: MeshSurface): boolean
Defined in src/model/data/Concepts/Mesh/Mesh.ts:225
Parameters:
| Name | Type |
|---|---|
surface |
MeshSurface |
Returns: boolean
mapLocalDirectionToWorld
▸ mapLocalDirectionToWorld(localDirection: ReadonlyVector3, target: Vector3): Vector3
Defined in src/model/data/Concepts/Mesh/Mesh.ts:475
Maps a Vector3 direction from the mesh-local coordinate system to the world coordinate system Pretends identity transform if there is no assembly
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
localDirection |
ReadonlyVector3 | - | - |
target |
Vector3 | new Vector3() | - |
Returns: Vector3
mapLocalPositionToWorld
▸ mapLocalPositionToWorld(localPosition: ReadonlyVector3, target: Vector3): Vector3
Defined in src/model/data/Concepts/Mesh/Mesh.ts:464
Maps a Vector3 position from the mesh-local coordinate system to the world coordinate system Pretends identity transform if there is no assembly
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
localPosition |
ReadonlyVector3 | - | - |
target |
Vector3 | new Vector3() | - |
Returns: Vector3
mapLocalRotationToWorld
▸ mapLocalRotationToWorld(localRotation: ReadonlyQuaternion, target: Quaternion): Quaternion
Defined in src/model/data/Concepts/Mesh/Mesh.ts:486
Maps a Quaternion rotation from the mesh-local coordinate system to the world coordinate system Pretends identity transform if there is no assembly
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
localRotation |
ReadonlyQuaternion | - | - |
target |
Quaternion | new Quaternion() | - |
Returns: Quaternion
mapWorldDirectionToLocal
▸ mapWorldDirectionToLocal(worldDirection: Vector3, target: Vector3): Vector3
Defined in src/model/data/Concepts/Mesh/Mesh.ts:509
Maps a Vector3 direction from the world coordinate system to the mesh-local coordinate system Pretends identity transform if there is no assembly
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
worldDirection |
Vector3 | - | - |
target |
Vector3 | new Vector3() | - |
Returns: Vector3
mapWorldPositionToLocal
▸ mapWorldPositionToLocal(worldPosition: Vector3, target: Vector3): Vector3
Defined in src/model/data/Concepts/Mesh/Mesh.ts:498
Maps a Vector3 position from the world coordinate system to the mesh-local coordinate system Pretends identity transform if there is no assembly
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
worldPosition |
Vector3 | - | - |
target |
Vector3 | new Vector3() | - |
Returns: Vector3
mapWorldRotationToLocal
▸ mapWorldRotationToLocal(worldRotation: Quaternion, target: Quaternion): Quaternion
Defined in src/model/data/Concepts/Mesh/Mesh.ts:520
Maps a Quaternion rotation from the world coordinate system to the mesh-local coordinate system Pretends identity transform if there is no assembly
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
worldRotation |
Quaternion | - | - |
target |
Quaternion | new Quaternion() | - |
Returns: Quaternion
modify
▸ modify(callback: function): Promise‹void›
Defined in src/model/data/Concepts/Mesh/Mesh.ts:288
Modify this mesh by providing a callback function that will be called once no one else is working on this mesh. Should only be called from a MeshOperation
Parameters:
▪ callback: function
the callback must return a promise resolving with a IMeshOperationResult when the modification finished.
▸ (mesh: Mesh, meshImplementation: IMeshImplementation): Promise‹IMeshOperationResult›
Parameters:
| Name | Type |
|---|---|
mesh |
Mesh |
meshImplementation |
IMeshImplementation |
Returns: Promise‹void›
modifySync
▸ modifySync(callback: function): void
Defined in src/model/data/Concepts/Mesh/Mesh.ts:344
Immediately execute the callback when there is no one else modifying the mesh at the same time. Emits change events.
Parameters:
▪ callback: function
-
▸ (mesh: Mesh, meshImplementation: IMeshImplementation): IMeshOperationResult
Parameters:
| Name | Type |
|---|---|
mesh |
Mesh |
meshImplementation |
IMeshImplementation |
Returns: void
removeAnnotation
▸ removeAnnotation(meshAnnotation: MeshAnnotation): void
Defined in src/model/data/Concepts/Mesh/Mesh.ts:233
Removes an annotation from the set of mesh annotations
Parameters:
| Name | Type | Description |
|---|---|---|
meshAnnotation |
MeshAnnotation | - |
Returns: void
setAssembly
▸ setAssembly(assembly: Assembly): void
Implementation of IPositionableElement
Defined in src/model/data/Concepts/Mesh/Mesh.ts:143
Parameters:
| Name | Type |
|---|---|
assembly |
Assembly |
Returns: void
setDimensionConception
▸ setDimensionConception(dimensionConception: DimensionConception): void
Defined in src/model/data/Concepts/Mesh/Mesh.ts:174
Parameters:
| Name | Type |
|---|---|
dimensionConception |
DimensionConception |
Returns: void
setImplementation
▸ setImplementation(implementation: IMeshImplementation): Mesh
Defined in src/model/data/Concepts/Mesh/Mesh.ts:96
Only use this function once for initialization. If you want to modify an existing mesh, use modify()
Parameters:
| Name | Type | Description |
|---|---|---|
implementation |
IMeshImplementation | - |
Returns: Mesh
setTransformsDefiner
▸ setTransformsDefiner(transformsAnchor: IPositioningAnchor | null): this
Defined in src/model/data/Concepts/Mesh/Mesh.ts:259
Replaces the transformsDefiningAnchor. Emits a transformsChange event with the new anchor.
Parameters:
| Name | Type | Description |
|---|---|---|
transformsAnchor |
IPositioningAnchor | null | - |
Returns: this