@itwin/core-geometry 3.4.0-dev.9 → 3.5.0-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -1
- package/lib/cjs/clipping/ClipPrimitive.d.ts +3 -3
- package/lib/cjs/clipping/ClipPrimitive.js +3 -3
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.d.ts +1 -1
- package/lib/cjs/clipping/ClipUtils.js +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.d.ts +1 -1
- package/lib/cjs/clipping/ClipVector.js +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +16 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +43 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/core-geometry.d.ts +1 -0
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +1 -0
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +3 -0
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +24 -0
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +16 -4
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts +4 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js +26 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +3 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +3 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +8 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +37 -3
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +11 -3
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +44 -6
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -0
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +20 -0
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.d.ts +4 -4
- package/lib/cjs/numerics/ClusterableArray.js +5 -5
- package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +3 -3
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +8 -6
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +69 -11
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +163 -15
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js +1 -0
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +11 -0
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +51 -0
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +23 -15
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +17 -8
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/solid/Box.d.ts +4 -4
- package/lib/cjs/solid/Box.d.ts.map +1 -1
- package/lib/cjs/solid/Box.js +7 -7
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +3 -3
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +2 -2
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts +2 -2
- package/lib/cjs/topology/HalfEdgeGraphSearch.js +2 -2
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/Merging.d.ts +5 -1
- package/lib/cjs/topology/Merging.d.ts.map +1 -1
- package/lib/cjs/topology/Merging.js +27 -15
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/SpaceTriangulation.d.ts +47 -0
- package/lib/cjs/topology/SpaceTriangulation.d.ts.map +1 -0
- package/lib/cjs/topology/SpaceTriangulation.js +135 -0
- package/lib/cjs/topology/SpaceTriangulation.js.map +1 -0
- package/lib/esm/clipping/ClipPrimitive.d.ts +3 -3
- package/lib/esm/clipping/ClipPrimitive.js +3 -3
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.d.ts +1 -1
- package/lib/esm/clipping/ClipUtils.js +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.d.ts +1 -1
- package/lib/esm/clipping/ClipVector.js +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +16 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +43 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/core-geometry.d.ts +1 -0
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +1 -0
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +3 -0
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +24 -0
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +16 -4
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts +4 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js +26 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +1 -1
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +3 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +3 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +8 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +37 -3
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +11 -3
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +44 -6
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +5 -0
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +20 -0
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.d.ts +4 -4
- package/lib/esm/numerics/ClusterableArray.js +5 -5
- package/lib/esm/numerics/ClusterableArray.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +3 -3
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +8 -6
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +69 -11
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +164 -16
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js +1 -0
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +11 -0
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +51 -0
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +23 -15
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +17 -8
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/solid/Box.d.ts +4 -4
- package/lib/esm/solid/Box.d.ts.map +1 -1
- package/lib/esm/solid/Box.js +7 -7
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +3 -3
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +2 -2
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.d.ts +2 -2
- package/lib/esm/topology/HalfEdgeGraphSearch.js +2 -2
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/Merging.d.ts +5 -1
- package/lib/esm/topology/Merging.d.ts.map +1 -1
- package/lib/esm/topology/Merging.js +27 -15
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/SpaceTriangulation.d.ts +47 -0
- package/lib/esm/topology/SpaceTriangulation.d.ts.map +1 -0
- package/lib/esm/topology/SpaceTriangulation.js +131 -0
- package/lib/esm/topology/SpaceTriangulation.js.map +1 -0
- package/package.json +8 -6
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Polyface
|
|
3
|
-
*/
|
|
4
1
|
import { BagOfCurves, CurveCollection } from "../curve/CurveCollection";
|
|
5
2
|
import { LineSegment3d } from "../curve/LineSegment3d";
|
|
6
3
|
import { LineString3d } from "../curve/LineString3d";
|
|
@@ -14,6 +11,22 @@ import { MomentData } from "../geometry4d/MomentData";
|
|
|
14
11
|
import { IndexedEdgeMatcher } from "./IndexedEdgeMatcher";
|
|
15
12
|
import { IndexedPolyface, Polyface, PolyfaceVisitor } from "./Polyface";
|
|
16
13
|
import { RangeLengthData } from "./RangeLengthData";
|
|
14
|
+
/**
|
|
15
|
+
* Options carrier for cloneWithHolesFilled
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export interface HoleFillOptions {
|
|
19
|
+
/** REJECT hole candidates if its boundary chain is longer than this limit. */
|
|
20
|
+
maxPerimeter?: number;
|
|
21
|
+
/** REJECT hole candidates if they have more than this number of edges */
|
|
22
|
+
maxEdgesAroundHole?: number;
|
|
23
|
+
/** REJECT hole candidates if their orientation is not COUNTERCLOCKWISE around this vector.
|
|
24
|
+
* * For instance, use an upward Z vector for a DTM whose facets face upward. This suppresses incorrectly treating the outer boundary as a hole.
|
|
25
|
+
*/
|
|
26
|
+
upVector?: Vector3d;
|
|
27
|
+
/** requests that all content from the original mesh be copied to the mesh with filled holes. */
|
|
28
|
+
includeOriginalMesh?: boolean;
|
|
29
|
+
}
|
|
17
30
|
/**
|
|
18
31
|
* Structure to return multiple results from volume between facets and plane
|
|
19
32
|
* @public
|
|
@@ -96,11 +109,25 @@ export declare class PolyfaceQuery {
|
|
|
96
109
|
*/
|
|
97
110
|
static isPolyfaceManifold(source: Polyface, allowSimpleBoundaries?: boolean): boolean;
|
|
98
111
|
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
* construct a CurveCollection containing boundary edges.
|
|
113
|
+
* * each edge is a LineSegment3d
|
|
114
|
+
* @param source polyface or visitor
|
|
115
|
+
* @param includeDanglers true to in include typical boundary edges with a single incident facet
|
|
116
|
+
* @param includeMismatch true to include edges with more than 2 incident facets
|
|
117
|
+
* @param includeNull true to include edges with identical start and end vertex indices.
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
103
120
|
static boundaryEdges(source: Polyface | PolyfaceVisitor | undefined, includeDanglers?: boolean, includeMismatch?: boolean, includeNull?: boolean): CurveCollection | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Test if the facets in `source` occur in perfectly mated pairs, as is required for a closed manifold volume.
|
|
123
|
+
* If not, extract the boundary edges as lines.
|
|
124
|
+
* @param source polyface or visitor
|
|
125
|
+
* @param announceEdge function to be called with each boundary edge. The announcement is start and end points, start and end indices, and facet index.
|
|
126
|
+
* @param includeDanglers true to in include typical boundary edges with a single incident facet
|
|
127
|
+
* @param includeMismatch true to include edges with more than 2 incident facets
|
|
128
|
+
* @param includeNull true to include edges with identical start and end vertex indices.
|
|
129
|
+
*/
|
|
130
|
+
static announceBoundaryEdges(source: Polyface | PolyfaceVisitor | undefined, announceEdge: (pointA: Point3d, pointB: Point3d, indexA: number, indexB: number, facetIndex: number) => void, includeDanglers?: boolean, includeMismatch?: boolean, includeNull?: boolean): void;
|
|
104
131
|
/** Find segments (within the linestring) which project to facets.
|
|
105
132
|
* * Announce each pair of linestring segment and on-facet segment through a callback.
|
|
106
133
|
* * Facets are ASSUMED to be convex and planar.
|
|
@@ -154,9 +181,40 @@ export declare class PolyfaceQuery {
|
|
|
154
181
|
* @param sideAngleTolerance
|
|
155
182
|
*/
|
|
156
183
|
static boundaryOfVisibleSubset(polyface: IndexedPolyface, visibilitySelect: 0 | 1 | 2, vectorToEye: Vector3d, sideAngleTolerance?: Angle): CurveCollection | undefined;
|
|
157
|
-
/**
|
|
158
|
-
*
|
|
184
|
+
/**
|
|
185
|
+
* Search for edges with only 1 incident facet.
|
|
186
|
+
* * chain them into loops
|
|
187
|
+
* * emit the loops to the announceLoop function
|
|
188
|
+
* @param mesh
|
|
159
189
|
*/
|
|
190
|
+
static announceBoundaryChainsAsLineString3d(mesh: Polyface | PolyfaceVisitor, announceLoop: (points: LineString3d) => void): void;
|
|
191
|
+
/**
|
|
192
|
+
* Return a mesh with
|
|
193
|
+
* * clusters of adjacent, coplanar facets merged into larger facets.
|
|
194
|
+
* * other facets included unchanged.
|
|
195
|
+
* @param mesh existing mesh
|
|
196
|
+
* @returns
|
|
197
|
+
*/
|
|
198
|
+
static cloneWithMaximalPlanarFacets(mesh: IndexedPolyface): IndexedPolyface | undefined;
|
|
199
|
+
/**
|
|
200
|
+
* Return a mesh with "some" holes filled in with new facets.
|
|
201
|
+
* * The candidates to be filled are all loops returned by boundaryChainsAsLineString3d
|
|
202
|
+
* * unclosed chains are rejected.
|
|
203
|
+
* * optionally also copy the original mesh, so the composite is a clone with holes filled.
|
|
204
|
+
* * The options structure enforces restrictions on how complicated the hole filling can be:
|
|
205
|
+
* * maxEdgesAroundHole -- holes with more edges are skipped
|
|
206
|
+
* * maxPerimeter -- holes with larger summed edge lengths are skipped.
|
|
207
|
+
* * upVector -- holes that do not have positive area along this view are skipped.
|
|
208
|
+
* * includeOriginalMesh -- includes the original mesh in the output mesh.
|
|
209
|
+
* @param mesh existing mesh
|
|
210
|
+
* @param options options controlling the hole fill.
|
|
211
|
+
* @param unfilledChains optional array to receive the points around holes that were not filled.
|
|
212
|
+
* @returns
|
|
213
|
+
*/
|
|
214
|
+
static fillSimpleHoles(mesh: IndexedPolyface | PolyfaceVisitor, options: HoleFillOptions, unfilledChains?: LineString3d[]): IndexedPolyface | undefined;
|
|
215
|
+
/** Clone the facets in each partition to a separate polyface.
|
|
216
|
+
*
|
|
217
|
+
*/
|
|
160
218
|
static clonePartitions(polyface: Polyface | PolyfaceVisitor, partitions: number[][]): Polyface[];
|
|
161
219
|
/** Clone facets that pass an filter function
|
|
162
220
|
*/
|
|
@@ -168,7 +226,7 @@ export declare class PolyfaceQuery {
|
|
|
168
226
|
/** Search the facets for facet subsets that are connected with at least edge contact.
|
|
169
227
|
* * Return array of arrays of facet indices.
|
|
170
228
|
*/
|
|
171
|
-
static partitionFacetIndicesByEdgeConnectedComponent(polyface: Polyface | PolyfaceVisitor): number[][];
|
|
229
|
+
static partitionFacetIndicesByEdgeConnectedComponent(polyface: Polyface | PolyfaceVisitor, stopAtVisibleEdges?: boolean): number[][];
|
|
172
230
|
/** Find segments (within the linestring) which project to facets.
|
|
173
231
|
* * Assemble each segment pair as a facet in a new polyface
|
|
174
232
|
* * Facets are ASSUMED to be convex and planar.
|
|
@@ -252,7 +310,7 @@ export declare class PolyfaceQuery {
|
|
|
252
310
|
/**
|
|
253
311
|
* * Find mated pairs among facet edges.
|
|
254
312
|
* * Mated pairs have the same vertex indices appearing in opposite order.
|
|
255
|
-
* * Mark all non-mated pairs
|
|
313
|
+
* * Mark all non-mated pairs visible.
|
|
256
314
|
* * At mated pairs
|
|
257
315
|
* * if angle across the edge is larger than `sharpEdgeAngle`, mark visible
|
|
258
316
|
* * otherwise mark invisible.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolyfaceQuery.d.ts","sourceRoot":"","sources":["../../../src/polyface/PolyfaceQuery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PolyfaceQuery.d.ts","sourceRoot":"","sources":["../../../src/polyface/PolyfaceQuery.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGxE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAOtD,OAAO,EAAE,kBAAkB,EAAqC,MAAM,sBAAsB,CAAC;AAK7F,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,gGAAgG;IAChG,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AACD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E;WACY,wBAAwB,CAAC,IAAI,EAAE,eAAe,EAAE,cAAc,CAAC,EAAE,KAAK;IA4BpF;;OAEG;WACW,sBAAsB,CAAC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;IAS3H;;;;MAIE;WAEY,qBAAqB,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO;IAKzE;;;;OAIG;WACW,uDAAuD,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO;IAIrG;;;OAGG;WACW,mBAAmB,CAAC,QAAQ,EAAE,eAAe;IAI3D;;;;;;;;;MASE;WACY,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,cAAc,GAAE,KAAiC;CAI/G;AAED;;;;;;;;;GASG;AACH,oBAAY,kBAAkB,GAAG,CAAC,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAClF,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,GAAG,CAAC"}
|
|
@@ -10,13 +10,16 @@ exports.PolyfaceQuery = exports.DuplicateFacetClusterSelector = void 0;
|
|
|
10
10
|
*/
|
|
11
11
|
// import { Point2d } from "./Geometry2d";
|
|
12
12
|
/* eslint-disable @typescript-eslint/naming-convention, no-empty */
|
|
13
|
+
const PointHelpers_1 = require("../geometry3d/PointHelpers");
|
|
13
14
|
const CurveCollection_1 = require("../curve/CurveCollection");
|
|
15
|
+
const MultiChainCollector_1 = require("../curve/internalContexts/MultiChainCollector");
|
|
14
16
|
const LineSegment3d_1 = require("../curve/LineSegment3d");
|
|
15
17
|
const LineString3d_1 = require("../curve/LineString3d");
|
|
16
18
|
const Loop_1 = require("../curve/Loop");
|
|
17
19
|
const StrokeOptions_1 = require("../curve/StrokeOptions");
|
|
18
20
|
const Geometry_1 = require("../Geometry");
|
|
19
21
|
const Angle_1 = require("../geometry3d/Angle");
|
|
22
|
+
const FrameBuilder_1 = require("../geometry3d/FrameBuilder");
|
|
20
23
|
const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
|
|
21
24
|
const PolygonOps_1 = require("../geometry3d/PolygonOps");
|
|
22
25
|
const Range_1 = require("../geometry3d/Range");
|
|
@@ -24,6 +27,9 @@ const Matrix4d_1 = require("../geometry4d/Matrix4d");
|
|
|
24
27
|
const MomentData_1 = require("../geometry4d/MomentData");
|
|
25
28
|
const UnionFind_1 = require("../numerics/UnionFind");
|
|
26
29
|
const ChainMerge_1 = require("../topology/ChainMerge");
|
|
30
|
+
const Graph_1 = require("../topology/Graph");
|
|
31
|
+
const HalfEdgeGraphSearch_1 = require("../topology/HalfEdgeGraphSearch");
|
|
32
|
+
const Merging_1 = require("../topology/Merging");
|
|
27
33
|
const FacetOrientation_1 = require("./FacetOrientation");
|
|
28
34
|
const IndexedEdgeMatcher_1 = require("./IndexedEdgeMatcher");
|
|
29
35
|
const IndexedPolyfaceVisitor_1 = require("./IndexedPolyfaceVisitor");
|
|
@@ -33,6 +39,7 @@ const XYPointBuckets_1 = require("./multiclip/XYPointBuckets");
|
|
|
33
39
|
const Polyface_1 = require("./Polyface");
|
|
34
40
|
const PolyfaceBuilder_1 = require("./PolyfaceBuilder");
|
|
35
41
|
const RangeLengthData_1 = require("./RangeLengthData");
|
|
42
|
+
const SpaceTriangulation_1 = require("../topology/SpaceTriangulation");
|
|
36
43
|
/**
|
|
37
44
|
* Enumeration of cases for retaining facets among duplicates
|
|
38
45
|
* @public
|
|
@@ -259,15 +266,39 @@ class PolyfaceQuery {
|
|
|
259
266
|
return badClusters.length === 0;
|
|
260
267
|
}
|
|
261
268
|
/**
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
269
|
+
* construct a CurveCollection containing boundary edges.
|
|
270
|
+
* * each edge is a LineSegment3d
|
|
271
|
+
* @param source polyface or visitor
|
|
272
|
+
* @param includeDanglers true to in include typical boundary edges with a single incident facet
|
|
273
|
+
* @param includeMismatch true to include edges with more than 2 incident facets
|
|
274
|
+
* @param includeNull true to include edges with identical start and end vertex indices.
|
|
275
|
+
* @returns
|
|
276
|
+
*/
|
|
266
277
|
static boundaryEdges(source, includeDanglers = true, includeMismatch = true, includeNull = true) {
|
|
278
|
+
const result = new CurveCollection_1.BagOfCurves();
|
|
279
|
+
const announceEdge = (pointA, pointB, _indexA, _indexB, _readIndex) => {
|
|
280
|
+
result.tryAddChild(LineSegment3d_1.LineSegment3d.create(pointA, pointB));
|
|
281
|
+
};
|
|
282
|
+
PolyfaceQuery.announceBoundaryEdges(source, announceEdge, includeDanglers, includeMismatch, includeNull);
|
|
283
|
+
if (result.children.length === 0)
|
|
284
|
+
return undefined;
|
|
285
|
+
return result;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Test if the facets in `source` occur in perfectly mated pairs, as is required for a closed manifold volume.
|
|
289
|
+
* If not, extract the boundary edges as lines.
|
|
290
|
+
* @param source polyface or visitor
|
|
291
|
+
* @param announceEdge function to be called with each boundary edge. The announcement is start and end points, start and end indices, and facet index.
|
|
292
|
+
* @param includeDanglers true to in include typical boundary edges with a single incident facet
|
|
293
|
+
* @param includeMismatch true to include edges with more than 2 incident facets
|
|
294
|
+
* @param includeNull true to include edges with identical start and end vertex indices.
|
|
295
|
+
*/
|
|
296
|
+
static announceBoundaryEdges(source, announceEdge, includeDanglers = true, includeMismatch = true, includeNull = true) {
|
|
267
297
|
if (source === undefined)
|
|
268
298
|
return undefined;
|
|
269
299
|
const edges = new IndexedEdgeMatcher_1.IndexedEdgeMatcher();
|
|
270
300
|
const visitor = source instanceof Polyface_1.Polyface ? source.createVisitor(1) : source;
|
|
301
|
+
visitor.setNumWrap(1);
|
|
271
302
|
visitor.reset();
|
|
272
303
|
while (visitor.moveToNextFacet()) {
|
|
273
304
|
const numEdges = visitor.pointCount - 1;
|
|
@@ -289,7 +320,6 @@ class PolyfaceQuery {
|
|
|
289
320
|
if (badList.length === 0)
|
|
290
321
|
return undefined;
|
|
291
322
|
const sourcePolyface = visitor.clientPolyface();
|
|
292
|
-
const result = new CurveCollection_1.BagOfCurves();
|
|
293
323
|
for (const list of badList) {
|
|
294
324
|
for (const e of list) {
|
|
295
325
|
const e1 = e instanceof IndexedEdgeMatcher_1.SortableEdge ? e : e[0];
|
|
@@ -298,10 +328,9 @@ class PolyfaceQuery {
|
|
|
298
328
|
const pointA = sourcePolyface.data.getPoint(indexA);
|
|
299
329
|
const pointB = sourcePolyface.data.getPoint(indexB);
|
|
300
330
|
if (pointA && pointB)
|
|
301
|
-
|
|
331
|
+
announceEdge(pointA, pointB, indexA, indexB, visitor.currentReadIndex());
|
|
302
332
|
}
|
|
303
333
|
}
|
|
304
|
-
return result;
|
|
305
334
|
}
|
|
306
335
|
/** Find segments (within the linestring) which project to facets.
|
|
307
336
|
* * Announce each pair of linestring segment and on-facet segment through a callback.
|
|
@@ -444,9 +473,124 @@ class PolyfaceQuery {
|
|
|
444
473
|
const visitor = IndexedPolyfaceVisitor_1.IndexedPolyfaceSubsetVisitor.createSubsetVisitor(polyface, partitionedIndices[visibilitySelect], 1);
|
|
445
474
|
return this.boundaryEdges(visitor, true, false, false);
|
|
446
475
|
}
|
|
447
|
-
/**
|
|
448
|
-
*
|
|
476
|
+
/**
|
|
477
|
+
* Search for edges with only 1 incident facet.
|
|
478
|
+
* * chain them into loops
|
|
479
|
+
* * emit the loops to the announceLoop function
|
|
480
|
+
* @param mesh
|
|
481
|
+
*/
|
|
482
|
+
static announceBoundaryChainsAsLineString3d(mesh, announceLoop) {
|
|
483
|
+
const collector = new MultiChainCollector_1.MultiChainCollector(Geometry_1.Geometry.smallMetricDistance, 1000);
|
|
484
|
+
PolyfaceQuery.announceBoundaryEdges(mesh, (pointA, pointB, _indexA, _indexB) => collector.captureCurve(LineSegment3d_1.LineSegment3d.create(pointA, pointB)), true, false, false);
|
|
485
|
+
collector.announceChainsAsLineString3d(announceLoop);
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Return a mesh with
|
|
489
|
+
* * clusters of adjacent, coplanar facets merged into larger facets.
|
|
490
|
+
* * other facets included unchanged.
|
|
491
|
+
* @param mesh existing mesh
|
|
492
|
+
* @returns
|
|
493
|
+
*/
|
|
494
|
+
static cloneWithMaximalPlanarFacets(mesh) {
|
|
495
|
+
PolyfaceQuery.markPairedEdgesInvisible(mesh, Angle_1.Angle.createRadians(Geometry_1.Geometry.smallAngleRadians));
|
|
496
|
+
const partitions = PolyfaceQuery.partitionFacetIndicesByEdgeConnectedComponent(mesh, true);
|
|
497
|
+
const builder = PolyfaceBuilder_1.PolyfaceBuilder.create();
|
|
498
|
+
const visitor = mesh.createVisitor(0);
|
|
499
|
+
const planarPartitions = [];
|
|
500
|
+
for (const partition of partitions) {
|
|
501
|
+
if (partition.length === 1) {
|
|
502
|
+
if (visitor.moveToReadIndex(partition[0]))
|
|
503
|
+
builder.addFacetFromVisitor(visitor);
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
// This is a non-trivial set of contiguous coplanar facets
|
|
507
|
+
planarPartitions.push(partition);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
const fragmentPolyfaces = PolyfaceQuery.clonePartitions(mesh, planarPartitions);
|
|
511
|
+
const gapTolerance = 1.0e-4;
|
|
512
|
+
const planarityTolerance = 1.0e-4;
|
|
513
|
+
for (const fragment of fragmentPolyfaces) {
|
|
514
|
+
const edges = [];
|
|
515
|
+
const edgeStrings = [];
|
|
516
|
+
PolyfaceQuery.announceBoundaryEdges(fragment, (pointA, pointB, _indexA, _indexB) => {
|
|
517
|
+
edges.push(LineSegment3d_1.LineSegment3d.create(pointA, pointB));
|
|
518
|
+
edgeStrings.push([pointA.clone(), pointB.clone()]);
|
|
519
|
+
});
|
|
520
|
+
const chains = MultiChainCollector_1.OffsetHelpers.collectChains(edges, gapTolerance, planarityTolerance);
|
|
521
|
+
if (chains) {
|
|
522
|
+
const frameBuilder = new FrameBuilder_1.FrameBuilder();
|
|
523
|
+
frameBuilder.announce(chains);
|
|
524
|
+
const frame = frameBuilder.getValidatedFrame(false);
|
|
525
|
+
if (frame !== undefined) {
|
|
526
|
+
const inverseFrame = frame.inverse();
|
|
527
|
+
if (inverseFrame !== undefined) {
|
|
528
|
+
inverseFrame.multiplyPoint3dArrayArrayInPlace(edgeStrings);
|
|
529
|
+
const graph = Merging_1.HalfEdgeGraphMerge.formGraphFromChains(edgeStrings, true, Graph_1.HalfEdgeMask.BOUNDARY_EDGE);
|
|
530
|
+
if (graph) {
|
|
531
|
+
HalfEdgeGraphSearch_1.HalfEdgeGraphSearch.collectConnectedComponentsWithExteriorParityMasks(graph, new HalfEdgeGraphSearch_1.HalfEdgeMaskTester(Graph_1.HalfEdgeMask.BOUNDARY_EDGE), Graph_1.HalfEdgeMask.EXTERIOR);
|
|
532
|
+
// this.purgeNullFaces(HalfEdgeMask.EXTERIOR);
|
|
533
|
+
const polyface1 = PolyfaceBuilder_1.PolyfaceBuilder.graphToPolyface(graph);
|
|
534
|
+
builder.addIndexedPolyface(polyface1, false, frame);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
return builder.claimPolyface(true);
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Return a mesh with "some" holes filled in with new facets.
|
|
544
|
+
* * The candidates to be filled are all loops returned by boundaryChainsAsLineString3d
|
|
545
|
+
* * unclosed chains are rejected.
|
|
546
|
+
* * optionally also copy the original mesh, so the composite is a clone with holes filled.
|
|
547
|
+
* * The options structure enforces restrictions on how complicated the hole filling can be:
|
|
548
|
+
* * maxEdgesAroundHole -- holes with more edges are skipped
|
|
549
|
+
* * maxPerimeter -- holes with larger summed edge lengths are skipped.
|
|
550
|
+
* * upVector -- holes that do not have positive area along this view are skipped.
|
|
551
|
+
* * includeOriginalMesh -- includes the original mesh in the output mesh.
|
|
552
|
+
* @param mesh existing mesh
|
|
553
|
+
* @param options options controlling the hole fill.
|
|
554
|
+
* @param unfilledChains optional array to receive the points around holes that were not filled.
|
|
555
|
+
* @returns
|
|
449
556
|
*/
|
|
557
|
+
static fillSimpleHoles(mesh, options, unfilledChains) {
|
|
558
|
+
if (mesh instanceof Polyface_1.IndexedPolyface)
|
|
559
|
+
return this.fillSimpleHoles(mesh.createVisitor(0), options, unfilledChains);
|
|
560
|
+
const builder = PolyfaceBuilder_1.PolyfaceBuilder.create();
|
|
561
|
+
const chains = [];
|
|
562
|
+
PolyfaceQuery.announceBoundaryChainsAsLineString3d(mesh, (ls) => { ls.reverseInPlace(); chains.push(ls); });
|
|
563
|
+
for (const c of chains) {
|
|
564
|
+
const points = c.points;
|
|
565
|
+
let rejected = false;
|
|
566
|
+
if (!c.isPhysicallyClosed)
|
|
567
|
+
rejected = true;
|
|
568
|
+
else if (options.maxEdgesAroundHole !== undefined && points.length > options.maxEdgesAroundHole)
|
|
569
|
+
rejected = true;
|
|
570
|
+
else if (options.maxPerimeter !== undefined && PointHelpers_1.Point3dArray.sumEdgeLengths(points, false) > options.maxPerimeter)
|
|
571
|
+
rejected = true;
|
|
572
|
+
else if (options.upVector !== undefined && PolygonOps_1.PolygonOps.sumTriangleAreasPerpendicularToUpVector(points, options.upVector) <= 0.0)
|
|
573
|
+
rejected = true;
|
|
574
|
+
if (!rejected && SpaceTriangulation_1.SpacePolygonTriangulation.triangulateSimplestSpaceLoop(points, (_loop, triangles) => {
|
|
575
|
+
for (const t of triangles)
|
|
576
|
+
builder.addPolygon(t);
|
|
577
|
+
})) {
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
rejected = true;
|
|
581
|
+
}
|
|
582
|
+
if (rejected && unfilledChains !== undefined)
|
|
583
|
+
unfilledChains.push(c); // yes, capture it -- this scope owns the chains and has no further use for it.
|
|
584
|
+
}
|
|
585
|
+
if (options.includeOriginalMesh !== undefined && options.includeOriginalMesh) {
|
|
586
|
+
for (mesh.reset(); mesh.moveToNextFacet();)
|
|
587
|
+
builder.addFacetFromVisitor(mesh);
|
|
588
|
+
}
|
|
589
|
+
return builder.claimPolyface(true);
|
|
590
|
+
}
|
|
591
|
+
/** Clone the facets in each partition to a separate polyface.
|
|
592
|
+
*
|
|
593
|
+
*/
|
|
450
594
|
static clonePartitions(polyface, partitions) {
|
|
451
595
|
if (polyface instanceof Polyface_1.Polyface) {
|
|
452
596
|
return this.clonePartitions(polyface.createVisitor(0), partitions);
|
|
@@ -508,9 +652,9 @@ class PolyfaceQuery {
|
|
|
508
652
|
/** Search the facets for facet subsets that are connected with at least edge contact.
|
|
509
653
|
* * Return array of arrays of facet indices.
|
|
510
654
|
*/
|
|
511
|
-
static partitionFacetIndicesByEdgeConnectedComponent(polyface) {
|
|
655
|
+
static partitionFacetIndicesByEdgeConnectedComponent(polyface, stopAtVisibleEdges = false) {
|
|
512
656
|
if (polyface instanceof Polyface_1.Polyface) {
|
|
513
|
-
return this.partitionFacetIndicesByEdgeConnectedComponent(polyface.createVisitor(0));
|
|
657
|
+
return this.partitionFacetIndicesByEdgeConnectedComponent(polyface.createVisitor(0), stopAtVisibleEdges);
|
|
514
658
|
}
|
|
515
659
|
polyface.setNumWrap(1);
|
|
516
660
|
const matcher = new IndexedEdgeMatcher_1.IndexedEdgeMatcher();
|
|
@@ -520,7 +664,11 @@ class PolyfaceQuery {
|
|
|
520
664
|
const numEdges = polyface.pointCount - 1;
|
|
521
665
|
numFacets++;
|
|
522
666
|
for (let i = 0; i < numEdges; i++) {
|
|
523
|
-
|
|
667
|
+
if (stopAtVisibleEdges && polyface.edgeVisible[i]) {
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
matcher.addEdge(polyface.clientPointIndex(i), polyface.clientPointIndex(i + 1), polyface.currentReadIndex());
|
|
671
|
+
}
|
|
524
672
|
}
|
|
525
673
|
}
|
|
526
674
|
const allEdges = [];
|
|
@@ -664,7 +812,7 @@ class PolyfaceQuery {
|
|
|
664
812
|
}
|
|
665
813
|
}
|
|
666
814
|
}
|
|
667
|
-
builder.addFacetFromGrowableArrays(newFacetVisitor.point, newFacetVisitor.normal, newFacetVisitor.param, newFacetVisitor.color);
|
|
815
|
+
builder.addFacetFromGrowableArrays(newFacetVisitor.point, newFacetVisitor.normal, newFacetVisitor.param, newFacetVisitor.color, newFacetVisitor.edgeVisible);
|
|
668
816
|
}
|
|
669
817
|
return builder.claimPolyface();
|
|
670
818
|
}
|
|
@@ -819,7 +967,7 @@ class PolyfaceQuery {
|
|
|
819
967
|
}
|
|
820
968
|
}
|
|
821
969
|
if (newFacetVisitor.point.length > 2)
|
|
822
|
-
builder.addFacetFromGrowableArrays(newFacetVisitor.point, newFacetVisitor.normal, newFacetVisitor.param, newFacetVisitor.color);
|
|
970
|
+
builder.addFacetFromGrowableArrays(newFacetVisitor.point, newFacetVisitor.normal, newFacetVisitor.param, newFacetVisitor.color, newFacetVisitor.edgeVisible);
|
|
823
971
|
}
|
|
824
972
|
return builder.claimPolyface();
|
|
825
973
|
}
|
|
@@ -874,7 +1022,7 @@ class PolyfaceQuery {
|
|
|
874
1022
|
/**
|
|
875
1023
|
* * Find mated pairs among facet edges.
|
|
876
1024
|
* * Mated pairs have the same vertex indices appearing in opposite order.
|
|
877
|
-
* * Mark all non-mated pairs
|
|
1025
|
+
* * Mark all non-mated pairs visible.
|
|
878
1026
|
* * At mated pairs
|
|
879
1027
|
* * if angle across the edge is larger than `sharpEdgeAngle`, mark visible
|
|
880
1028
|
* * otherwise mark invisible.
|