editor › Globals › SplitMeshOperation
Class: SplitMeshOperation
A split operation requires two candidates that will be used to split into two halves (which may consist of multiple meshes) through two intersections. They both have to touch the split plane and be large enough that nothing gets cut off (the base has to be completely contained in the combined volume of the candidates): [‾‾‾‾‾‾‾‾‾‾|‾‾‾‾‾‾‾‾‾‾] |candidate1|candidate2| | [‾‾|‾‾] | | | base| | | [|] | [_|_] The FULL_SPLIT operation is finished at this point but the SPLIT operation is only supposed to split in one place and not through the whole object. That's why the splitPoint (the clicked point) and the split plane are required. These are then used to union parts that were not part of the directly clicked splitting point to be reunioned: [‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾] | | |___|<- clicked point |reunion| |split| [_] [__]
Hierarchy
↳ SplitMeshOperation
Index
Constructors
Properties
Methods
- _determineMeshUnions
- _ensureValidStartingState
- _generateResults
- _getAffectedMeshes
- _getFinalImplementationsFromUnions
- _getMeshImplementationsNearestToSplitPoint
- _getMeshOffStrings
- _getSurfacesInPlane
- _isMeshImplementationOnNegativeSide
- _meshFromOff
- _meshPointFromAssemblySpace
- _multiIntersection
- _performOperation
- canBeConsolidatedWith
- consolidateWith
- execute
- getBase
- getCandidates
- getId
- getOperationType
- hasBeenStarted
- setBase
- setCandidates
Constructors
constructor
+ new SplitMeshOperation(base: Mesh, candidates: Mesh[], operationType: FULL_SPLIT): SplitMeshOperation
Overrides CSGMeshOperation.constructor
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:40
Parameters:
| Name | Type |
|---|---|
base |
Mesh |
candidates |
Mesh[] |
operationType |
FULL_SPLIT |
Returns: SplitMeshOperation
+ new SplitMeshOperation(base: Mesh, candidates: Mesh[], operationType: SPLIT, params: ISplitParams): SplitMeshOperation
Overrides CSGMeshOperation.constructor
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:42
Parameters:
| Name | Type |
|---|---|
base |
Mesh |
candidates |
Mesh[] |
operationType |
SPLIT |
params |
ISplitParams |
Returns: SplitMeshOperation
Properties
Protected base
• base: Mesh = null
Inherited from CSGMeshOperation.base
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:25
Protected candidates
• candidates: Mesh[] = null
Inherited from CSGMeshOperation.candidates
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:26
Protected operationType
• operationType: CSGOperationType
Inherited from CSGMeshOperation.operationType
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:27
Private params
• params: ISplitParams
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:40
Methods
Private _determineMeshUnions
▸ _determineMeshUnions(surfacesInSplitPlane: IMeshSurfaceWithMeshImplementation[], splitMesh: Set‹IMeshImplementation›): IMeshSurfaceWithMeshImplementation[][]
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:156
Determines which meshes from the split operation have to be reunited again This checks for every surface in the split plane whether it can be added to one of the existing unions It is added to an existing union if: - it is in the same mesh as a surface in that union - it overlaps with a mesh in that union and the surfaces don't belong to the two meshes which we want to split In the end we should have two unions, one for each side of the split
Parameters:
| Name | Type | Description |
|---|---|---|
surfacesInSplitPlane |
IMeshSurfaceWithMeshImplementation[] | - |
splitMesh |
Set‹IMeshImplementation› | a set containing the meshes (their MeshImplementations) that should definitely be split |
Returns: IMeshSurfaceWithMeshImplementation[][]
Protected _ensureValidStartingState
▸ _ensureValidStartingState(): void
Inherited from CSGMeshOperation._ensureValidStartingState
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:183
Make sure the meshes are in a valid state to start operations
Returns: void
Protected _generateResults
▸ _generateResults(meshes: MeshAndImplementation[], resultImplementations: IMeshImplementation[], candidatesAreGone: boolean, firstImplementationOnNegativeSide?: boolean): IMeshOperationResult[]
Inherited from CSGMeshOperation._generateResults
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:95
Parameters:
| Name | Type | Default |
|---|---|---|
meshes |
MeshAndImplementation[] | - |
resultImplementations |
IMeshImplementation[] | - |
candidatesAreGone |
boolean | false |
firstImplementationOnNegativeSide? |
boolean | - |
Returns: IMeshOperationResult[]
Protected _getAffectedMeshes
▸ _getAffectedMeshes(): Mesh[]
Inherited from CSGMeshOperation._getAffectedMeshes
Overrides MeshOperation._getAffectedMeshes
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:81
Returns: Mesh[]
Private _getFinalImplementationsFromUnions
▸ _getFinalImplementationsFromUnions(unions: IMeshSurfaceWithMeshImplementation[][], intersectionResultImplementations: IMeshImplementation[], meshStrings: Map‹IMeshImplementation, string›, baseMesh: Mesh): Promise‹IMeshImplementation[]›
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:119
Parameters:
| Name | Type |
|---|---|
unions |
IMeshSurfaceWithMeshImplementation[][] |
intersectionResultImplementations |
IMeshImplementation[] |
meshStrings |
Map‹IMeshImplementation, string› |
baseMesh |
Mesh |
Returns: Promise‹IMeshImplementation[]›
Private _getMeshImplementationsNearestToSplitPoint
▸ _getMeshImplementationsNearestToSplitPoint(intersectionResultImplementations: IMeshImplementation[], surfacesInSplitPlane: IMeshSurfaceWithMeshImplementation[], transforms: IReadOnlyTransforms, splitPlane: Plane, splitPoint: Vector3): Set‹IMeshImplementation›
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:207
Finds the two meshes on different sides of the splitting plane that are closest to the clicked split point. The two meshes for which this applies should definitely be split even if they have overlapping surfaces.
Parameters:
| Name | Type | Description |
|---|---|---|
intersectionResultImplementations |
IMeshImplementation[] | the resulting implementations from the initial intersect operations |
surfacesInSplitPlane |
IMeshSurfaceWithMeshImplementation[] | the surfaces lying in the split plane |
transforms |
IReadOnlyTransforms | the mesh transforms |
splitPlane |
Plane | - |
splitPoint |
Vector3 | the (snapped) clicked point where the mesh should be split in assembly coordinates |
Returns: Set‹IMeshImplementation›
a set containing the MeshImplementations of the two meshes on different sides of the splitting plane that are closest to the clicked split point
Protected _getMeshOffStrings
▸ _getMeshOffStrings(meshes: Mesh[]): string[]
Inherited from CSGMeshOperation._getMeshOffStrings
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:85
Parameters:
| Name | Type |
|---|---|
meshes |
Mesh[] |
Returns: string[]
Private _getSurfacesInPlane
▸ _getSurfacesInPlane(resultImplementations: IMeshImplementation[], splitPlane: Plane, meshTransforms: IReadOnlyTransforms): IMeshSurfaceWithMeshImplementation[]
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:297
Parameters:
| Name | Type |
|---|---|
resultImplementations |
IMeshImplementation[] |
splitPlane |
Plane |
meshTransforms |
IReadOnlyTransforms |
Returns: IMeshSurfaceWithMeshImplementation[]
Private _isMeshImplementationOnNegativeSide
▸ _isMeshImplementationOnNegativeSide(implementation: IMeshImplementation, splitPlane: Plane, transforms: IReadOnlyTransforms): boolean
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:283
Parameters:
| Name | Type |
|---|---|
implementation |
IMeshImplementation |
splitPlane |
Plane |
transforms |
IReadOnlyTransforms |
Returns: boolean
Protected _meshFromOff
▸ _meshFromOff(offString: string, meshToMapCoordinatesTo: IPositionableElement): IMeshImplementation[]
Inherited from CSGMeshOperation._meshFromOff
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:166
Parameters:
| Name | Type |
|---|---|
offString |
string |
meshToMapCoordinatesTo |
IPositionableElement |
Returns: IMeshImplementation[]
Protected _meshPointFromAssemblySpace
▸ _meshPointFromAssemblySpace(mesh: IPositionableElement, point: Vector3): Vector3
Inherited from CSGMeshOperation._meshPointFromAssemblySpace
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:162
Parameters:
| Name | Type |
|---|---|
mesh |
IPositionableElement |
point |
Vector3 |
Returns: Vector3
Private _multiIntersection
▸ _multiIntersection(meshOffStrings: string[], baseString: string, baseMesh: Mesh): Promise‹IMeshImplementation[]›
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:321
Parameters:
| Name | Type |
|---|---|
meshOffStrings |
string[] |
baseString |
string |
baseMesh |
Mesh |
Returns: Promise‹IMeshImplementation[]›
Protected _performOperation
▸ _performOperation(meshes: MeshAndImplementation[]): Promise‹IMeshOperationResult[]›
Overrides CSGMeshOperation._performOperation
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:62
Parameters:
| Name | Type |
|---|---|
meshes |
MeshAndImplementation[] |
Returns: Promise‹IMeshOperationResult[]›
canBeConsolidatedWith
▸ canBeConsolidatedWith(otherOperation: CSGMeshOperation): boolean
Overrides CSGMeshOperation.canBeConsolidatedWith
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:54
Parameters:
| Name | Type |
|---|---|
otherOperation |
CSGMeshOperation |
Returns: boolean
consolidateWith
▸ consolidateWith(otherOperation: CSGMeshOperation): void
Overrides CSGMeshOperation.consolidateWith
Defined in src/model/data/Concepts/Mesh/SplitMeshOperation.ts:58
Parameters:
| Name | Type |
|---|---|
otherOperation |
CSGMeshOperation |
Returns: void
execute
▸ execute(): Promise‹IMeshOperationResult[]›
Inherited from MeshOperation.execute
Defined in src/model/data/Concepts/Mesh/MeshOperation.ts:47
Performs the operation.
Returns: Promise‹IMeshOperationResult[]›
Promise that will resolve to an array of IMeshOperationResults, each result being related to one of the affected meshes.
getBase
▸ getBase(): Mesh
Inherited from CSGMeshOperation.getBase
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:55
Returns: Mesh
getCandidates
▸ getCandidates(): Mesh[]
Inherited from CSGMeshOperation.getCandidates
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:64
Returns: Mesh[]
getId
▸ getId(): string
Inherited from MeshOperation.getId
Defined in src/model/data/Concepts/Mesh/MeshOperation.ts:30
this is used to identify for which operation a UI progress bar is being shown, collisions are unlikely and have no severe consequences.
Returns: string
a random string-identifier that should be unique across all MeshOperations
getOperationType
▸ getOperationType(): CSGOperationType
Inherited from CSGMeshOperation.getOperationType
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:75
Returns: CSGOperationType
hasBeenStarted
▸ hasBeenStarted(): boolean
Inherited from MeshOperation.hasBeenStarted
Defined in src/model/data/Concepts/Mesh/MeshOperation.ts:37
Returns: boolean
true, if this operation has been started execution
setBase
▸ setBase(base: Mesh): void
Inherited from CSGMeshOperation.setBase
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:59
Parameters:
| Name | Type |
|---|---|
base |
Mesh |
Returns: void
setCandidates
▸ setCandidates(candidates: Mesh[]): void
Inherited from CSGMeshOperation.setCandidates
Defined in src/model/data/Concepts/Mesh/CSGMeshOperation.ts:68
Parameters:
| Name | Type |
|---|---|
candidates |
Mesh[] |
Returns: void