@itwin/core-geometry 3.6.0-dev.8 → 4.0.0-dev.10
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 +28 -1
- package/LICENSE.md +1 -1
- package/lib/cjs/Geometry.d.ts +28 -17
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +52 -25
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +10 -6
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +29 -31
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.d.ts +11 -8
- package/lib/cjs/curve/CurveCurve.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurve.js +16 -12
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.d.ts +5 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js +11 -10
- package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.d.ts +19 -0
- package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Angle.js +39 -0
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -0
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +1 -0
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts +1 -0
- package/lib/cjs/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js +3 -0
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +369 -254
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +807 -660
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.d.ts +71 -14
- package/lib/cjs/geometry3d/OrderedRotationAngles.d.ts.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.js +204 -114
- package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +1 -0
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +1 -0
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +16 -16
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +21 -18
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/Segment1d.d.ts +1 -1
- package/lib/cjs/geometry3d/Segment1d.js +1 -1
- package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts +49 -25
- package/lib/cjs/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js +146 -50
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +12 -0
- package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +14 -0
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +5 -4
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +50 -10
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +82 -0
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +150 -1
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts +202 -0
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -0
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js +1038 -0
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -0
- package/lib/cjs/serialization/GeometrySamples.d.ts +4 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +14 -6
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +113 -7
- package/lib/cjs/topology/Graph.d.ts.map +1 -1
- package/lib/cjs/topology/Graph.js +185 -7
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +38 -0
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -0
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js +82 -0
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -0
- package/lib/esm/Geometry.d.ts +28 -17
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +52 -25
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +10 -6
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +30 -32
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCurve.d.ts +11 -8
- package/lib/esm/curve/CurveCurve.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurve.js +16 -12
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.d.ts +5 -1
- package/lib/esm/curve/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js +11 -10
- package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/geometry3d/Angle.d.ts +19 -0
- package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
- package/lib/esm/geometry3d/Angle.js +39 -0
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +1 -0
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +1 -0
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts +1 -0
- package/lib/esm/geometry3d/CoincidentGeometryOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.js +3 -0
- package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +369 -254
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +807 -660
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.d.ts +71 -14
- package/lib/esm/geometry3d/OrderedRotationAngles.d.ts.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.js +205 -115
- package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +1 -0
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +1 -0
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +16 -16
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +21 -18
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/Segment1d.d.ts +1 -1
- package/lib/esm/geometry3d/Segment1d.js +1 -1
- package/lib/esm/geometry3d/Segment1d.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.d.ts +49 -25
- package/lib/esm/geometry3d/YawPitchRollAngles.d.ts.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js +146 -50
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +12 -0
- package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +14 -0
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +5 -4
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +50 -10
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +82 -0
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +148 -0
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts +202 -0
- package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -0
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js +1032 -0
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -0
- package/lib/esm/serialization/GeometrySamples.d.ts +4 -1
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +14 -6
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +113 -7
- package/lib/esm/topology/Graph.d.ts.map +1 -1
- package/lib/esm/topology/Graph.js +185 -7
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts +38 -0
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.d.ts.map +1 -0
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js +78 -0
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -0
- package/package.json +4 -4
|
@@ -8,6 +8,7 @@ import { Plane3dByOriginAndUnitNormal } from "../geometry3d/Plane3dByOriginAndUn
|
|
|
8
8
|
import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
|
|
9
9
|
import { Matrix4d } from "../geometry4d/Matrix4d";
|
|
10
10
|
import { MomentData } from "../geometry4d/MomentData";
|
|
11
|
+
import { HalfEdgeGraph } from "../topology/Graph";
|
|
11
12
|
import { IndexedEdgeMatcher, SortableEdgeCluster } from "./IndexedEdgeMatcher";
|
|
12
13
|
import { IndexedPolyface, Polyface, PolyfaceVisitor } from "./Polyface";
|
|
13
14
|
import { RangeLengthData } from "./RangeLengthData";
|
|
@@ -27,6 +28,45 @@ export interface HoleFillOptions {
|
|
|
27
28
|
/** requests that all content from the original mesh be copied to the mesh with filled holes. */
|
|
28
29
|
includeOriginalMesh?: boolean;
|
|
29
30
|
}
|
|
31
|
+
/** Selective output options for PolyfaceQuery.cloneOffset:
|
|
32
|
+
* * undefined means the usual facets in the expected offset mesh.
|
|
33
|
+
* * if present as a json object, the various booleans select respective outputs.
|
|
34
|
+
* * @public
|
|
35
|
+
*/
|
|
36
|
+
export interface OffsetMeshSelectiveOutputOptions {
|
|
37
|
+
outputOffsetsFromFacesBeforeChamfers?: boolean;
|
|
38
|
+
outputOffsetsFromFaces?: boolean;
|
|
39
|
+
outputOffsetsFromEdges?: boolean;
|
|
40
|
+
outputOffsetsFromVertices?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Options carrier for [[PolyfaceQuery.cloneOffset]].
|
|
44
|
+
* * Default options are strongly recommended.
|
|
45
|
+
* * The option most likely to be changed is chamferTurnAngle
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export declare class OffsetMeshOptions {
|
|
49
|
+
/** max angle between normals to be considered smooth */
|
|
50
|
+
smoothSingleAngleBetweenNormals: Angle;
|
|
51
|
+
/** max accumulation of angle between normals to be considered smooth */
|
|
52
|
+
smoothAccumulatedAngleBetweenNormals: Angle;
|
|
53
|
+
/** When crossing an edge, this turn angle (typically 120 degrees) triggers a chamfer */
|
|
54
|
+
chamferAngleBetweenNormals: Angle;
|
|
55
|
+
/** optional control structure for selective output.
|
|
56
|
+
* * If undefined, output all expected offset facets.
|
|
57
|
+
*/
|
|
58
|
+
outputSelector?: OffsetMeshSelectiveOutputOptions;
|
|
59
|
+
/** Constructor -- CAPTURE parameters ... */
|
|
60
|
+
private constructor();
|
|
61
|
+
/** construct and return an OffsetMeshOptions with given parameters.
|
|
62
|
+
* * Angles are forced to minimum values.
|
|
63
|
+
* * Clones of the angles are given to the constructor.
|
|
64
|
+
* @param smoothSingleRadiansBetweenNormals an angle larger than this (between facets) is considered a sharp edge
|
|
65
|
+
* @param smoothAccumulatedAngleBetweenNormals angles that sum to this much may be consolidated for average normal
|
|
66
|
+
* @param chamferTurnAngleBetweenNormals when facets meet with larger angle, a chamfer edge may be added if the angle between facet normals is larger than this.
|
|
67
|
+
*/
|
|
68
|
+
static create(smoothSingleAngleBetweenNormals?: Angle, smoothAccumulatedAngleBetweenNormals?: Angle, chamferTurnAngleBetweenNormals?: Angle): OffsetMeshOptions;
|
|
69
|
+
}
|
|
30
70
|
/**
|
|
31
71
|
* Structure to return multiple results from volume between facets and plane
|
|
32
72
|
* @public
|
|
@@ -97,6 +137,34 @@ export declare class PolyfaceQuery {
|
|
|
97
137
|
* * There is no test for closure. Use `PolyfaceQuery.isPolyfaceClosedByEdgePairing(polyface)` to test for closure.
|
|
98
138
|
*/
|
|
99
139
|
static computePrincipalVolumeMoments(source: Polyface): MomentData | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Test for convex volume by dihedral angle tests on all edges.
|
|
142
|
+
* * This tests if all dihedral angles are positive.
|
|
143
|
+
* * In a closed solid, this is a strong test for overall convexity.
|
|
144
|
+
* * With `ignoreBoundaries` true, this may be a useful test when all the facets are in a single edge-connected component, such as a pyramid with no underside.
|
|
145
|
+
* * It is not a correct test if there are multiple, disjoint components.
|
|
146
|
+
* * Take the above-mentioned pyramid with no underside.
|
|
147
|
+
* * Within the same mesh, have a second pyramid placed to the side, still facing upward.
|
|
148
|
+
* * The angles will pass the dihedral convexity test, but the composite thing surely is not convex.
|
|
149
|
+
* @param source mesh to examine
|
|
150
|
+
* @param ignoreBoundaries if true, ignore simple boundary edges, i.e. allow unclosed meshes.
|
|
151
|
+
* @returns true if the mesh is closed and has all dihedral angles (angle across edge) positive
|
|
152
|
+
*/
|
|
153
|
+
static isConvexByDihedralAngleCount(source: Polyface, ignoreBoundaries?: boolean): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Compute a number summarizing the dihedral angles in the mesh.
|
|
156
|
+
* @see [[isConvexByDihedralAngleCount]] for comments about ignoreBoundaries===true when there are multiple connected components.
|
|
157
|
+
* @param source mesh to examine
|
|
158
|
+
* @param ignoreBoundaries if true, ignore simple boundary edges, i.e. allow unclosed meshes.
|
|
159
|
+
* @returns a number summarizing the dihedral angles in the mesh.
|
|
160
|
+
* * Return 1 if all angles are positive or planar. The mesh is probably convex with outward normals.
|
|
161
|
+
* * Return -1 if all angles are negative or planar. The mesh is probably convex with inward normals.
|
|
162
|
+
* * Return 0 if
|
|
163
|
+
* * angles area mixed
|
|
164
|
+
* * any edge has other than 1 incident facet or more than 2 incident facets.
|
|
165
|
+
* * (but null edges are permitted -- These occur naturally at edges of quads at north or south pole)
|
|
166
|
+
*/
|
|
167
|
+
static dihedralAngleSummary(source: Polyface, ignoreBoundaries?: boolean): number;
|
|
100
168
|
/**
|
|
101
169
|
* Test if the facets in `source` occur in perfectly mated pairs, as is required for a closed manifold volume.
|
|
102
170
|
*/
|
|
@@ -355,6 +423,12 @@ export declare class PolyfaceQuery {
|
|
|
355
423
|
* @param value true for visible, false for hidden
|
|
356
424
|
*/
|
|
357
425
|
static markAllEdgeVisibility(mesh: IndexedPolyface, value: boolean): void;
|
|
426
|
+
/**
|
|
427
|
+
* Create a HalfEdgeGraph with a face for each facet of the IndexedPolyface
|
|
428
|
+
* @param mesh mesh to convert
|
|
429
|
+
* @internal
|
|
430
|
+
*/
|
|
431
|
+
static convertToHalfEdgeGraph(mesh: IndexedPolyface): HalfEdgeGraph;
|
|
358
432
|
/**
|
|
359
433
|
* * Examine adjacent facet orientations throughout the mesh
|
|
360
434
|
* * If possible, reverse a subset to achieve proper pairing.
|
|
@@ -377,6 +451,14 @@ export declare class PolyfaceQuery {
|
|
|
377
451
|
* @param toleranceAngle averaging is done between normals up to this angle.
|
|
378
452
|
*/
|
|
379
453
|
static buildAverageNormals(polyface: IndexedPolyface, toleranceAngle?: Angle): void;
|
|
454
|
+
/**
|
|
455
|
+
* Offset the faces of the mesh.
|
|
456
|
+
* @param source original mesh
|
|
457
|
+
* @param signedOffsetDistance distance to offset
|
|
458
|
+
* @param offsetOptions angle options. The default options are recommended.
|
|
459
|
+
* @returns shifted mesh.
|
|
460
|
+
*/
|
|
461
|
+
static cloneOffset(source: IndexedPolyface, signedOffsetDistance: number, offsetOptions?: OffsetMeshOptions): IndexedPolyface;
|
|
380
462
|
}
|
|
381
463
|
/** Announce the points on a drape panel.
|
|
382
464
|
* * The first two points in the array are always along the draped line segment.
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,EAA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ACY,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,cAAc,GAAE,KAAiC;IAI9G;;;;;;OAMG;WACW,WAAW,CAAC,MAAM,EAAE,eAAe,EAC/C,oBAAoB,EAAE,MAAM,EAC5B,aAAa,GAAE,iBAA8C,GAAG,eAAe;CAOlF;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"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.PolyfaceQuery = exports.DuplicateFacetClusterSelector = void 0;
|
|
7
|
+
exports.PolyfaceQuery = exports.DuplicateFacetClusterSelector = exports.OffsetMeshOptions = void 0;
|
|
8
8
|
/** @packageDocumentation
|
|
9
9
|
* @module Polyface
|
|
10
10
|
*/
|
|
@@ -40,6 +40,42 @@ const Polyface_1 = require("./Polyface");
|
|
|
40
40
|
const PolyfaceBuilder_1 = require("./PolyfaceBuilder");
|
|
41
41
|
const RangeLengthData_1 = require("./RangeLengthData");
|
|
42
42
|
const SpaceTriangulation_1 = require("../topology/SpaceTriangulation");
|
|
43
|
+
const HalfEdgeGraphFromIndexedLoopsContext_1 = require("../topology/HalfEdgeGraphFromIndexedLoopsContext");
|
|
44
|
+
const OffsetMeshContext_1 = require("./multiclip/OffsetMeshContext");
|
|
45
|
+
/**
|
|
46
|
+
* Options carrier for [[PolyfaceQuery.cloneOffset]].
|
|
47
|
+
* * Default options are strongly recommended.
|
|
48
|
+
* * The option most likely to be changed is chamferTurnAngle
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
class OffsetMeshOptions {
|
|
52
|
+
/** Constructor -- CAPTURE parameters ... */
|
|
53
|
+
constructor(smoothSingleAngleBetweenNormals = Angle_1.Angle.createDegrees(25), smoothAccumulatedAngleBetweenNormals = Angle_1.Angle.createDegrees(60), chamferTurnAngle = Angle_1.Angle.createDegrees(90)) {
|
|
54
|
+
this.smoothSingleAngleBetweenNormals = smoothSingleAngleBetweenNormals.clone();
|
|
55
|
+
this.smoothAccumulatedAngleBetweenNormals = smoothAccumulatedAngleBetweenNormals.clone();
|
|
56
|
+
this.chamferAngleBetweenNormals = chamferTurnAngle.clone();
|
|
57
|
+
}
|
|
58
|
+
/** construct and return an OffsetMeshOptions with given parameters.
|
|
59
|
+
* * Angles are forced to minimum values.
|
|
60
|
+
* * Clones of the angles are given to the constructor.
|
|
61
|
+
* @param smoothSingleRadiansBetweenNormals an angle larger than this (between facets) is considered a sharp edge
|
|
62
|
+
* @param smoothAccumulatedAngleBetweenNormals angles that sum to this much may be consolidated for average normal
|
|
63
|
+
* @param chamferTurnAngleBetweenNormals when facets meet with larger angle, a chamfer edge may be added if the angle between facet normals is larger than this.
|
|
64
|
+
*/
|
|
65
|
+
static create(smoothSingleAngleBetweenNormals = Angle_1.Angle.createDegrees(25), smoothAccumulatedAngleBetweenNormals = Angle_1.Angle.createDegrees(60), chamferTurnAngleBetweenNormals = Angle_1.Angle.createDegrees(120)) {
|
|
66
|
+
const mySmoothSingleRadiansBetweenNormals = smoothSingleAngleBetweenNormals.clone();
|
|
67
|
+
const mySmoothAccumulatedRadiansBetweenNormals = smoothAccumulatedAngleBetweenNormals.clone();
|
|
68
|
+
const myChamferTurnAngleBetweenNormals = chamferTurnAngleBetweenNormals.clone();
|
|
69
|
+
if (mySmoothSingleRadiansBetweenNormals.degrees < 1)
|
|
70
|
+
mySmoothAccumulatedRadiansBetweenNormals.setDegrees(1.0);
|
|
71
|
+
if (mySmoothAccumulatedRadiansBetweenNormals.degrees < 1.0)
|
|
72
|
+
mySmoothAccumulatedRadiansBetweenNormals.setDegrees(1.0);
|
|
73
|
+
if (mySmoothAccumulatedRadiansBetweenNormals.degrees < 15.0)
|
|
74
|
+
mySmoothAccumulatedRadiansBetweenNormals.setDegrees(15.0);
|
|
75
|
+
return new OffsetMeshOptions(mySmoothSingleRadiansBetweenNormals, mySmoothAccumulatedRadiansBetweenNormals, myChamferTurnAngleBetweenNormals);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.OffsetMeshOptions = OffsetMeshOptions;
|
|
43
79
|
/**
|
|
44
80
|
* Enumeration of cases for retaining facets among duplicates
|
|
45
81
|
* @public
|
|
@@ -239,6 +275,85 @@ class PolyfaceQuery {
|
|
|
239
275
|
const inertiaProducts = PolyfaceQuery.sumFacetSecondVolumeMomentProducts(source, origin);
|
|
240
276
|
return MomentData_1.MomentData.inertiaProductsToPrincipalAxes(origin, inertiaProducts);
|
|
241
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* Test for convex volume by dihedral angle tests on all edges.
|
|
280
|
+
* * This tests if all dihedral angles are positive.
|
|
281
|
+
* * In a closed solid, this is a strong test for overall convexity.
|
|
282
|
+
* * With `ignoreBoundaries` true, this may be a useful test when all the facets are in a single edge-connected component, such as a pyramid with no underside.
|
|
283
|
+
* * It is not a correct test if there are multiple, disjoint components.
|
|
284
|
+
* * Take the above-mentioned pyramid with no underside.
|
|
285
|
+
* * Within the same mesh, have a second pyramid placed to the side, still facing upward.
|
|
286
|
+
* * The angles will pass the dihedral convexity test, but the composite thing surely is not convex.
|
|
287
|
+
* @param source mesh to examine
|
|
288
|
+
* @param ignoreBoundaries if true, ignore simple boundary edges, i.e. allow unclosed meshes.
|
|
289
|
+
* @returns true if the mesh is closed and has all dihedral angles (angle across edge) positive
|
|
290
|
+
*/
|
|
291
|
+
static isConvexByDihedralAngleCount(source, ignoreBoundaries = false) {
|
|
292
|
+
return this.dihedralAngleSummary(source, ignoreBoundaries) > 0;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Compute a number summarizing the dihedral angles in the mesh.
|
|
296
|
+
* @see [[isConvexByDihedralAngleCount]] for comments about ignoreBoundaries===true when there are multiple connected components.
|
|
297
|
+
* @param source mesh to examine
|
|
298
|
+
* @param ignoreBoundaries if true, ignore simple boundary edges, i.e. allow unclosed meshes.
|
|
299
|
+
* @returns a number summarizing the dihedral angles in the mesh.
|
|
300
|
+
* * Return 1 if all angles are positive or planar. The mesh is probably convex with outward normals.
|
|
301
|
+
* * Return -1 if all angles are negative or planar. The mesh is probably convex with inward normals.
|
|
302
|
+
* * Return 0 if
|
|
303
|
+
* * angles area mixed
|
|
304
|
+
* * any edge has other than 1 incident facet or more than 2 incident facets.
|
|
305
|
+
* * (but null edges are permitted -- These occur naturally at edges of quads at north or south pole)
|
|
306
|
+
*/
|
|
307
|
+
static dihedralAngleSummary(source, ignoreBoundaries = false) {
|
|
308
|
+
const edges = new IndexedEdgeMatcher_1.IndexedEdgeMatcher();
|
|
309
|
+
const visitor = source.createVisitor(1);
|
|
310
|
+
visitor.reset();
|
|
311
|
+
const centroidNormal = [];
|
|
312
|
+
let normalCounter = 0;
|
|
313
|
+
while (visitor.moveToNextFacet()) {
|
|
314
|
+
const numEdges = visitor.pointCount - 1;
|
|
315
|
+
const normal = PolygonOps_1.PolygonOps.centroidAreaNormal(visitor.point);
|
|
316
|
+
if (normal === undefined)
|
|
317
|
+
return 0;
|
|
318
|
+
centroidNormal.push(normal);
|
|
319
|
+
for (let i = 0; i < numEdges; i++) {
|
|
320
|
+
edges.addEdge(visitor.clientPointIndex(i), visitor.clientPointIndex(i + 1), normalCounter);
|
|
321
|
+
}
|
|
322
|
+
normalCounter++;
|
|
323
|
+
}
|
|
324
|
+
const badClusters = [];
|
|
325
|
+
const manifoldClusters = [];
|
|
326
|
+
edges.sortAndCollectClusters(manifoldClusters, ignoreBoundaries ? undefined : badClusters, undefined, badClusters);
|
|
327
|
+
if (badClusters.length > 0)
|
|
328
|
+
return 0;
|
|
329
|
+
let numPositive = 0;
|
|
330
|
+
let numPlanar = 0;
|
|
331
|
+
let numNegative = 0;
|
|
332
|
+
const edgeVector = Point3dVector3d_1.Vector3d.create();
|
|
333
|
+
for (const cluster of manifoldClusters) {
|
|
334
|
+
const sideA = cluster[0];
|
|
335
|
+
const sideB = cluster[1];
|
|
336
|
+
if (sideA instanceof IndexedEdgeMatcher_1.SortableEdge
|
|
337
|
+
&& sideB instanceof IndexedEdgeMatcher_1.SortableEdge
|
|
338
|
+
&& source.data.point.vectorIndexIndex(sideA.vertexIndexA, sideA.vertexIndexB, edgeVector)) {
|
|
339
|
+
const dihedralAngle = centroidNormal[sideA.facetIndex].direction.signedAngleTo(centroidNormal[sideB.facetIndex].direction, edgeVector);
|
|
340
|
+
if (dihedralAngle.isAlmostZero)
|
|
341
|
+
numPlanar++;
|
|
342
|
+
else if (dihedralAngle.radians > 0.0)
|
|
343
|
+
numPositive++;
|
|
344
|
+
else
|
|
345
|
+
numNegative++;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (numPositive > 0 && numNegative === 0)
|
|
349
|
+
return 1;
|
|
350
|
+
if (numNegative > 0 && numPositive === 0)
|
|
351
|
+
return -1;
|
|
352
|
+
// problem case: if all edges have zero dihedral angle, record it as convex.
|
|
353
|
+
if (numPlanar > 0 && numPositive === 0 && numNegative === 0)
|
|
354
|
+
return 1;
|
|
355
|
+
return 0;
|
|
356
|
+
}
|
|
242
357
|
/**
|
|
243
358
|
* Test if the facets in `source` occur in perfectly mated pairs, as is required for a closed manifold volume.
|
|
244
359
|
*/
|
|
@@ -1158,6 +1273,27 @@ class PolyfaceQuery {
|
|
|
1158
1273
|
for (let i = 0; i < data.edgeVisible.length; i++)
|
|
1159
1274
|
data.edgeVisible[i] = value;
|
|
1160
1275
|
}
|
|
1276
|
+
/**
|
|
1277
|
+
* Create a HalfEdgeGraph with a face for each facet of the IndexedPolyface
|
|
1278
|
+
* @param mesh mesh to convert
|
|
1279
|
+
* @internal
|
|
1280
|
+
*/
|
|
1281
|
+
static convertToHalfEdgeGraph(mesh) {
|
|
1282
|
+
const builder = new HalfEdgeGraphFromIndexedLoopsContext_1.HalfEdgeGraphFromIndexedLoopsContext();
|
|
1283
|
+
const visitor = mesh.createVisitor(0);
|
|
1284
|
+
for (visitor.reset(); visitor.moveToNextFacet();) {
|
|
1285
|
+
builder.insertLoop(visitor.pointIndex);
|
|
1286
|
+
}
|
|
1287
|
+
const graph = builder.graph;
|
|
1288
|
+
const xyz = Point3dVector3d_1.Point3d.create();
|
|
1289
|
+
graph.announceNodes((_graph, halfEdge) => {
|
|
1290
|
+
const vertexIndex = halfEdge.i;
|
|
1291
|
+
mesh.data.getPoint(vertexIndex, xyz);
|
|
1292
|
+
halfEdge.setXYZ(xyz);
|
|
1293
|
+
return true;
|
|
1294
|
+
});
|
|
1295
|
+
return graph;
|
|
1296
|
+
}
|
|
1161
1297
|
/**
|
|
1162
1298
|
* * Examine adjacent facet orientations throughout the mesh
|
|
1163
1299
|
* * If possible, reverse a subset to achieve proper pairing.
|
|
@@ -1186,6 +1322,19 @@ class PolyfaceQuery {
|
|
|
1186
1322
|
static buildAverageNormals(polyface, toleranceAngle = Angle_1.Angle.createDegrees(31.0)) {
|
|
1187
1323
|
BuildAverageNormalsContext_1.BuildAverageNormalsContext.buildFastAverageNormals(polyface, toleranceAngle);
|
|
1188
1324
|
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Offset the faces of the mesh.
|
|
1327
|
+
* @param source original mesh
|
|
1328
|
+
* @param signedOffsetDistance distance to offset
|
|
1329
|
+
* @param offsetOptions angle options. The default options are recommended.
|
|
1330
|
+
* @returns shifted mesh.
|
|
1331
|
+
*/
|
|
1332
|
+
static cloneOffset(source, signedOffsetDistance, offsetOptions = OffsetMeshOptions.create()) {
|
|
1333
|
+
const strokeOptions = StrokeOptions_1.StrokeOptions.createForFacets();
|
|
1334
|
+
const offsetBuilder = PolyfaceBuilder_1.PolyfaceBuilder.create(strokeOptions);
|
|
1335
|
+
OffsetMeshContext_1.OffsetMeshContext.buildOffsetMeshWithEdgeChamfers(source, offsetBuilder, signedOffsetDistance, offsetOptions);
|
|
1336
|
+
return offsetBuilder.claimPolyface();
|
|
1337
|
+
}
|
|
1189
1338
|
}
|
|
1190
1339
|
exports.PolyfaceQuery = PolyfaceQuery;
|
|
1191
1340
|
// amount of computation to do per step of async methods.
|