Class: SSDMerger
Hierarchy
- SSDMerger
Index
Properties
Methods
- _arePolygonsIntersecting
- _cleanClipperOperationResult
- _cleanPolygon
- _clipperPolygonToSinglePolygon3d
- _clipperPolygonsToPolygons3d
- _executeClipperBooleanOperation
- _get2DTransformFromSSD
- _get2DTransforms
- _getSurfaceGraph
- _offsetPolygon
- _preparePolygonForBooleanOperation
- _selfUnionClipperPolygon
- _simplifyPointIntersections
- _simplifyPolygon
- _splitAssembly
- _ssdToClipperPolygon
- findCoplanarSSDs
- offsetPolygon
- selfUnionSSD
- subtractSSDs
- unionSSD
Properties
Static Private Readonly defaultOffsetValue
▪ defaultOffsetValue: 0.001 = 0.001
Defined in src/util/SSDMerger.ts:38
Methods
Static Private _arePolygonsIntersecting
▸ _arePolygonsIntersecting(polygon1: ClipperLib.Paths, polygon2: ClipperLib.Paths): boolean
Defined in src/util/SSDMerger.ts:393
Parameters:
| Name | Type |
|---|---|
polygon1 |
ClipperLib.Paths |
polygon2 |
ClipperLib.Paths |
Returns: boolean
Static Private _cleanClipperOperationResult
▸ _cleanClipperOperationResult(operationResult: ClipperLib.Paths, offsetType: OffsetType, offset: number): any
Defined in src/util/SSDMerger.ts:354
Parameters:
| Name | Type | Default |
|---|---|---|
operationResult |
ClipperLib.Paths | - |
offsetType |
OffsetType | - |
offset |
number | this.defaultOffsetValue |
Returns: any
Static Private _cleanPolygon
▸ _cleanPolygon(polygons: ClipperLib.Paths, epsilon: number): ClipperLib.Paths
Defined in src/util/SSDMerger.ts:565
Parameters:
| Name | Type | Default |
|---|---|---|
polygons |
ClipperLib.Paths | - |
epsilon |
number | 0.1 |
Returns: ClipperLib.Paths
Static Private _clipperPolygonToSinglePolygon3d
▸ _clipperPolygonToSinglePolygon3d(polygon: ClipperLib.Paths, transform2D: Transforms): VectorPolygon3D
Defined in src/util/SSDMerger.ts:428
Parameters:
| Name | Type |
|---|---|
polygon |
ClipperLib.Paths |
transform2D |
Transforms |
Returns: VectorPolygon3D
Static Private _clipperPolygonsToPolygons3d
▸ _clipperPolygonsToPolygons3d(polygons: ClipperLib.Paths, transform2D: Transforms): VectorPolygon3D[]
Defined in src/util/SSDMerger.ts:462
Parameters:
| Name | Type |
|---|---|
polygons |
ClipperLib.Paths |
transform2D |
Transforms |
Returns: VectorPolygon3D[]
Static Private _executeClipperBooleanOperation
▸ _executeClipperBooleanOperation(type: OperationType, subjectPolygon: ClipperLib.Paths, clipPolygons: ClipperLib.Paths[]): any
Defined in src/util/SSDMerger.ts:525
Parameters:
| Name | Type |
|---|---|
type |
OperationType |
subjectPolygon |
ClipperLib.Paths |
clipPolygons |
ClipperLib.Paths[] |
Returns: any
Static Private _get2DTransformFromSSD
▸ _get2DTransformFromSSD(baseSSD: SingleSurfaceDescriptor): Transforms
Defined in src/util/SSDMerger.ts:499
Parameters:
| Name | Type |
|---|---|
baseSSD |
SingleSurfaceDescriptor |
Returns: Transforms
Static Private _get2DTransforms
▸ _get2DTransforms(point: ReadonlyVector3, normal: Vector3): Transforms
Defined in src/util/SSDMerger.ts:505
Parameters:
| Name | Type |
|---|---|
point |
ReadonlyVector3 |
normal |
Vector3 |
Returns: Transforms
Static Private _getSurfaceGraph
▸ _getSurfaceGraph(meshes: Mesh[]): Map‹Mesh‹›, Mesh‹›[]›
Defined in src/util/SSDMerger.ts:647
creates a graph (a map) where two meshes have an edge if there surfaces intersect in at least a single point
Parameters:
| Name | Type | Description |
|---|---|---|
meshes |
Mesh[] | the meshes that will be in the graph; all meshes should be in the same assembly |
Returns: Map‹Mesh‹›, Mesh‹›[]›
Static Private _offsetPolygon
▸ _offsetPolygon(polygon: ClipperLib.Paths, offsetType: OffsetType, offset: number): ClipperLib.Paths
Defined in src/util/SSDMerger.ts:539
Parameters:
| Name | Type | Default |
|---|---|---|
polygon |
ClipperLib.Paths | - |
offsetType |
OffsetType | - |
offset |
number | this.defaultOffsetValue |
Returns: ClipperLib.Paths
Static Private _preparePolygonForBooleanOperation
▸ _preparePolygonForBooleanOperation(polygon: ClipperLib.Paths, offsetType: OffsetType, offset: number): ClipperLib.Paths
Defined in src/util/SSDMerger.ts:515
Parameters:
| Name | Type | Default |
|---|---|---|
polygon |
ClipperLib.Paths | - |
offsetType |
OffsetType | - |
offset |
number | this.defaultOffsetValue |
Returns: ClipperLib.Paths
Static Private _selfUnionClipperPolygon
▸ _selfUnionClipperPolygon(clipperPolygon: ClipperLib.Path, offset: number): ClipperLib.Paths
Defined in src/util/SSDMerger.ts:368
Parameters:
| Name | Type | Default |
|---|---|---|
clipperPolygon |
ClipperLib.Path | - |
offset |
number | this.defaultOffsetValue |
Returns: ClipperLib.Paths
null if the cycle couldn't be united or the united cycle
Static Private _simplifyPointIntersections
▸ _simplifyPointIntersections(polygon: ClipperLib.Paths): any
Defined in src/util/SSDMerger.ts:589
this is work around to provide consistent behavior in the following case: if the outline and hole or a hole and hole touch in a single point and we deflate the union result again, we could end up with one or two polygons this ensures that we always have two result polygons that share a point ┌───┐ ┌───┐ │ │ │ │ ┌─── ───┘ and ┌───┐└───┘ │ │ │ │ └───┘ └───┘ one polygon two separate polygons
Parameters:
| Name | Type |
|---|---|
polygon |
ClipperLib.Paths |
Returns: any
Static Private _simplifyPolygon
▸ _simplifyPolygon(polygon: ClipperLib.Paths, fillType: any): ClipperLib.Paths
Defined in src/util/SSDMerger.ts:570
Parameters:
| Name | Type | Default |
|---|---|---|
polygon |
ClipperLib.Paths | - |
fillType |
any | ClipperLib.PolyFillType.pftEvenOdd |
Returns: ClipperLib.Paths
Static Private _splitAssembly
▸ _splitAssembly(assembly: Assembly): Mesh‹›[][]
Defined in src/util/SSDMerger.ts:609
divides the meshes of the assembly into groups, two meshes are in the same group if …
Parameters:
| Name | Type | Description |
|---|---|---|
assembly |
Assembly |
Returns: Mesh‹›[][]
Static Private _ssdToClipperPolygon
▸ _ssdToClipperPolygon(ssd: SingleSurfaceDescriptor, transform2D: Transforms): ClipperLib.Paths
Defined in src/util/SSDMerger.ts:414
Parameters:
| Name | Type |
|---|---|
ssd |
SingleSurfaceDescriptor |
transform2D |
Transforms |
Returns: ClipperLib.Paths
Static findCoplanarSSDs
▸ findCoplanarSSDs(base: SingleSurfaceDescriptor): SingleSurfaceDescriptor[]
Defined in src/util/SSDMerger.ts:45
deprecated - finding candidates for merging/unioning should not be a task of the SSDMerger because it brings up a lot of new issues (some are listed below)
however as long as we dont we have that we offer this simple method for finding coplanar plates that can be used as a candidates for merging
Parameters:
| Name | Type |
|---|---|
base |
SingleSurfaceDescriptor |
Returns: SingleSurfaceDescriptor[]
Static offsetPolygon
▸ offsetPolygon(polygon: ReadonlyVectorPolygon3D, offsetType: OffsetType, offset: number): VectorPolygon3D
Defined in src/util/SSDMerger.ts:72
Parameters:
| Name | Type | Default |
|---|---|---|
polygon |
ReadonlyVectorPolygon3D | - |
offsetType |
OffsetType | OffsetType.INFLATE |
offset |
number | this.defaultOffsetValue |
Returns: VectorPolygon3D
Static selfUnionSSD
▸ selfUnionSSD(ssd: SingleSurfaceDescriptor, offset: number): Promise‹boolean›
Defined in src/util/SSDMerger.ts:209
There are cases where we produce self touching geometry like this donut e.g. with stretch edge ┌──┬─────┐ ┌────────┐ │ │ │ │ │ │ ├──┐ │ fix self-touching │ ┌──┐ │ │ │ │ │ ────────────────► │ │ │ │ │ └──┘ │ │ └──┘ │ │ │ │ │ └────────┘ └────────┘ We process every cycle separately because we want to enforce self-intersections when inflating. If we inflate multiple cycles at the same time, they could intersect and lead to a wrong result.
Parameters:
| Name | Type | Default |
|---|---|---|
ssd |
SingleSurfaceDescriptor | - |
offset |
number | this.defaultOffsetValue |
Returns: Promise‹boolean›
Static subtractSSDs
▸ subtractSSDs(base: SingleSurfaceDescriptor, candidate: SingleSurfaceDescriptor): Promise‹void›
Defined in src/util/SSDMerger.ts:288
subtracts the candidate ssds outline from the base ssds outline. the candidate will be destroyed and removed. because subtracting can split the base up into multiple outlines, the base will also be removed and replaced by any number of succeeding ssds it will not be checked if candidates are coplanar or parallel to the base surface!!! Only the base determines the plane and all other z-values will be ignored!!! to avoid precision errors (e.g the base is fractionally smaller than the candidate) the base will be deflated and the the candidate inflated after merging the result will be inflated to keep the original shape the assembly might be split up into multiple assemblies if there are groups of meshes that are not connected to each other
Parameters:
| Name | Type |
|---|---|
base |
SingleSurfaceDescriptor |
candidate |
SingleSurfaceDescriptor |
Returns: Promise‹void›
- returns a promise that indicates if the base and the candidate have been removed
Static unionSSD
▸ unionSSD(base: SingleSurfaceDescriptor, candidates: SingleSurfaceDescriptor[], alreadyInflated: boolean, offset: number): Promise‹boolean›
Defined in src/util/SSDMerger.ts:105
merges the base and candidate ssd outlines if they touch (in more than a single point) or overlap into the base SSD all merged candidate ssds will be informed of this change and removed it will not be checked if candidates are coplanar or parallel to the base surface!!! Only the base determines the plane and all other z-values will be ignored!!! to avoid precision errors (e.g two ssds slightly not touching) the plates will be first offset by small positive value (inflated) this ensures that all touching ssd now overlap after merging the result will be offsetted by the negated value (deflated) to keep the original shape of the polygon
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
base |
SingleSurfaceDescriptor | - | - |
candidates |
SingleSurfaceDescriptor[] | - | - |
alreadyInflated |
boolean | false | if set the base ssd will not be inflated, most likely it has been inflated before |
offset |
number | this.defaultOffsetValue | the value in mm by which each edge is offset |
Returns: Promise‹boolean›
- a promise that indicates whether there has been a merge or not