editor › Globals › Polygon3DFixing
Class: Polygon3DFixing
Preprocess 3D polygons to increase the probability that HalfEdgeMeshImplementation.fromPolygons will successfully build itself.
Hierarchy
- Polygon3DFixing
Index
Properties
Methods
Properties
Static Private steps
▪ steps: (Anonymous function)[] = [ replacements => Polygon3DFixing._allPolygonsStep(replacements, polygon => new FilterPolygonEdgeCycles(FilterDegeneratedEdges.execute).execute(polygon), ), replacements => Polygon3DFixing._allPolygonsStep(replacements, polygon => new FilterPolygonEdgeCycles(FilterCollinearEdges.execute).execute(polygon), ), replacements => Polygon3DFixing._allPolygonsStep(replacements, polygon => FixTouchingCycles.execute(polygon)), replacements => Polygon3DFixing._allPolygonsStep(replacements, polygon => { if (MeshValidation.vectorCycleIsDegenerated(polygon[0])) { return null; } return polygon.filter(cycle => !MeshValidation.vectorCycleIsDegenerated(cycle)); }), replacements => { const allPoints: Vector3[] = flattenDeep(Array.from(replacements.values())).filter(p => p != null) as Vector3[]; Polygon3DFixing._allPolygonsStep(replacements, polygon => AddCollinearPoints.execute(polygon, allPoints)); }, ]
Defined in src/util/Polygon3DFixing/Polygon3DFixing.ts:18
When adding new cleaning step remember to add it to this array.
Methods
Static Private _allPolygonsStep
▸ _allPolygonsStep(replacements: Map‹ReadonlyVectorPolygon3D, VectorPolygon3D | null›, polygonFunc: function): void
Defined in src/util/Polygon3DFixing/Polygon3DFixing.ts:68
Parameters:
▪ replacements: Map‹ReadonlyVectorPolygon3D, VectorPolygon3D | null›
▪ polygonFunc: function
▸ (ReadonlyVectorPolygon3D: any): VectorPolygon3D | null
Parameters:
| Name | Type |
|---|---|
ReadonlyVectorPolygon3D |
any |
Returns: void
Static fixPolygon
▸ fixPolygon(polygon: ReadonlyVectorPolygon3D): ReadonlyVectorPolygon3D | null
Defined in src/util/Polygon3DFixing/Polygon3DFixing.ts:63
Parameters:
| Name | Type |
|---|---|
polygon |
ReadonlyVectorPolygon3D |
Returns: ReadonlyVectorPolygon3D | null
Static fixPolygons
▸ fixPolygons(polygons: ReadonlyVectorPolygon3D[]): VectorPolygon3D[]
Defined in src/util/Polygon3DFixing/Polygon3DFixing.ts:47
Fixes polygons. Does not care about identities, hence returns an array containing all new polygons. Applies various filter to the polygons. Changes their identities, hence returns a map from old to new polygons. Map contains null if the polygon vanished (e.g. it degenerated).
Parameters:
| Name | Type | Description |
|---|---|---|
polygons |
ReadonlyVectorPolygon3D[] | - |
Returns: VectorPolygon3D[]
Static fixPolygonsWithReplacements
▸ fixPolygonsWithReplacements(polygons: ReadonlyVectorPolygon3D[]): Map‹ReadonlyVectorPolygon3D, VectorPolygon3D | null›
Defined in src/util/Polygon3DFixing/Polygon3DFixing.ts:52
Parameters:
| Name | Type |
|---|---|
polygons |
ReadonlyVectorPolygon3D[] |
Returns: Map‹ReadonlyVectorPolygon3D, VectorPolygon3D | null›