@itwin/core-geometry 5.0.0-dev.113 → 5.0.0-dev.114
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/lib/cjs/clipping/ClipPlane.d.ts +7 -5
- package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js +9 -5
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +12 -23
- 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/Arc3d.d.ts +53 -31
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +55 -36
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +2 -0
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +14 -0
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js +1 -0
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js +10 -5
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js +7 -2
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/RegionOps.d.ts +38 -28
- package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
- package/lib/cjs/curve/RegionOps.js +38 -28
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +14 -11
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +14 -11
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +7 -2
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +20 -2
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +2 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +7 -3
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.d.ts +2 -0
- package/lib/cjs/geometry3d/Plane3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.js +6 -1
- package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js +18 -10
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +3 -3
- package/lib/cjs/geometry3d/Point3dVector3d.js +3 -3
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts +7 -7
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +66 -26
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +49 -2
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +38 -2
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +5 -4
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +5 -4
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js +11 -23
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts +21 -2
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js +32 -13
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.d.ts +4 -2
- package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js +17 -13
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/polyface/FacetOrientation.d.ts +1 -1
- package/lib/cjs/polyface/FacetOrientation.js +1 -1
- package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +55 -40
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js +83 -75
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +47 -38
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts +26 -19
- package/lib/cjs/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js +47 -32
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +17 -3
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +16 -0
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +2 -2
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.d.ts +19 -18
- package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js +39 -42
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +116 -75
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +312 -228
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +3 -3
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.d.ts +1 -1
- package/lib/cjs/topology/ChainMerge.js +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.d.ts +7 -5
- package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
- package/lib/esm/clipping/ClipPlane.js +9 -5
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +12 -23
- 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/Arc3d.d.ts +53 -31
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +55 -36
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +2 -0
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +14 -0
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
- package/lib/esm/curve/LineSegment3d.js +1 -0
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.d.ts.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js +10 -5
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js +7 -2
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/RegionOps.d.ts +38 -28
- package/lib/esm/curve/RegionOps.d.ts.map +1 -1
- package/lib/esm/curve/RegionOps.js +38 -28
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +14 -11
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +14 -11
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +7 -2
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +20 -2
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +2 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +7 -3
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/Plane3d.d.ts +2 -0
- package/lib/esm/geometry3d/Plane3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3d.js +6 -1
- package/lib/esm/geometry3d/Plane3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts +2 -0
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +6 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts +8 -2
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.d.ts.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js +18 -10
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +3 -3
- package/lib/esm/geometry3d/Point3dVector3d.js +3 -3
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts +7 -7
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +66 -26
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +49 -2
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +38 -2
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts +13 -6
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +16 -9
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +5 -4
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +5 -4
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js +11 -23
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts +21 -2
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js +32 -13
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.d.ts +4 -2
- package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
- package/lib/esm/geometry4d/Point4d.js +17 -13
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/polyface/FacetOrientation.d.ts +1 -1
- package/lib/esm/polyface/FacetOrientation.js +1 -1
- package/lib/esm/polyface/FacetOrientation.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +55 -40
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js +83 -75
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +15 -14
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +47 -38
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts +26 -19
- package/lib/esm/polyface/IndexedPolyfaceWalker.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.js +47 -32
- package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +17 -3
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +16 -0
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +2 -2
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.d.ts +19 -18
- package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js +39 -42
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +116 -75
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +313 -229
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +3 -3
- package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js +3 -3
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts +7 -6
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +8 -9
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/topology/ChainMerge.d.ts +1 -1
- package/lib/esm/topology/ChainMerge.js +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/package.json +3 -3
|
@@ -110,7 +110,7 @@ export declare class ChainMergeContext {
|
|
|
110
110
|
* * Return the number of excisions.
|
|
111
111
|
*/
|
|
112
112
|
private exciseAndMarkSlingEdges;
|
|
113
|
-
/** Collect chains which have maximum edge count, broken at
|
|
113
|
+
/** Collect chains which have maximum edge count, broken at vertices with more than 2 edges.
|
|
114
114
|
* * This is assumed to be preceded by a call to a vertex-cluster step such as `clusterAndMergeVerticesYXZ`
|
|
115
115
|
*/
|
|
116
116
|
collectMaximalChains(): LineString3d[];
|
|
@@ -250,7 +250,7 @@ class ChainMergeContext {
|
|
|
250
250
|
}
|
|
251
251
|
return n;
|
|
252
252
|
}
|
|
253
|
-
/** Collect chains which have maximum edge count, broken at
|
|
253
|
+
/** Collect chains which have maximum edge count, broken at vertices with more than 2 edges.
|
|
254
254
|
* * This is assumed to be preceded by a call to a vertex-cluster step such as `clusterAndMergeVerticesYXZ`
|
|
255
255
|
*/
|
|
256
256
|
collectMaximalChains() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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AC;YAC7C,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpD,IAAI,CAAC,uCAAuC,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;QACD,+CAA+C;QAC/C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,CAAC,uCAAuC,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACM,+BAA+B;QACpC,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,oBAAY,CAAC,OAAO,CAAC;QACvC,6CAA6C;QAC7C,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACjC,2FAA2F;QAC3F,yDAAyD;QACzD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpD,IAAI,CAAC,2CAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;QACD,+CAA+C;QAC/C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,CAAC,2CAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjOD,8CAiOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Topology\n */\n\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"./Graph\";\nimport { HalfEdgeGraphOps } from \"./Merging\";\n\n/**\n * interface containing various options appropriate to merging lines segments into chains.\n * @internal\n */\nexport interface ChainMergeContextOptions {\n /**\n * Tolerance for declaring points equal\n * * Default is `Geometry.smallMetricDistance`\n */\n tolerance?: number;\n /**\n * Direction for primary sort.\n * * Default is `Vector3d.create(0.294234298, 0.72391399, 0.45234328798)`\n * * this vector should NOT be along a principal x,y,z direction.\n * * The internal form will be normalized.\n */\n primarySortDirection?: Vector3d;\n}\n/** Internal form of ChainMergeContextOptions -- same field names, but required to have contents. */\nclass ChainMergeContextValidatedOptions {\n /**\n * Tolerance for declaring points equal.\n */\n public tolerance: number;\n /** UNNORMALIZED base vector for sorting.\n * * Actual vector hoisted into an instance is normalized.\n */\n private static readonly _defaultPrimarySortDirection = Vector3d.create(0.294234298, 0.72391399, 0.45234328798);\n /**\n * Direction for primary sort. This is normalized !!!\n */\n public primarySortDirection: Vector3d;\n /** return a unit vector aligned with optional direction.\n * * Default return is into the first quadrant at a quirky angle so any perpendicular plane is unlikely to hit many points\n */\n public static createPrimarySortVector(vector?: Vector3d): Vector3d {\n if (vector === undefined) {\n vector = this._defaultPrimarySortDirection.clone();\n }\n return vector.normalizeWithDefault(\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.x,\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.y,\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.z);\n }\n /**\n * PRIVATE constructor -- assumes all inputs are validated in public create method !!!!\n * @param tolerance\n * @param unitVectorForPrimarySort\n */\n private constructor(tolerance: number, unitVectorForPrimarySort: Vector3d) {\n this.tolerance = tolerance;\n this.primarySortDirection = unitVectorForPrimarySort;\n }\n /** return the default option set. */\n public static createFromUnValidated(options?: ChainMergeContextOptions): ChainMergeContextValidatedOptions {\n const result = new ChainMergeContextValidatedOptions(Geometry.smallMetricDistance, ChainMergeContextValidatedOptions.createPrimarySortVector());\n if (options !== undefined) {\n if (options.tolerance !== undefined)\n result.tolerance = options.tolerance;\n if (options.primarySortDirection !== undefined)\n result.primarySortDirection = ChainMergeContextValidatedOptions.createPrimarySortVector();\n }\n return result;\n }\n /** Clone this context. */\n public clone(): ChainMergeContextValidatedOptions {\n return new ChainMergeContextValidatedOptions(this.tolerance, this.primarySortDirection);\n }\n}\n/**\n * * Context for assembling line segments into chains.\n * * Use the context in phases:\n * * Create the context: `context = ChainMergeContext.create ()`\n * * Add line with any combination of:\n * * `context.addSegment(pointA, pointB)`\n * * `context.addLineSegment3dArray (segments)`\n * * Scan all coordinate data for common coordinates. Twist nodes together to form chains:\n * * `context.clusterAndMergeVerticesXYZ ()`\n * * Collect the chains:\n * * myLinestringArray = context.collectMaximalChains();\n * * The context carries an optional plane which is used by addSegmentsOnPlane\n *\n * @internal\n */\nexport class ChainMergeContext {\n\n private _graph: HalfEdgeGraph;\n private _options: ChainMergeContextValidatedOptions;\n private _plane?: PlaneAltitudeEvaluator;\n private _convexClipper?: ConvexClipPlaneSet;\n private constructor(options: ChainMergeContextValidatedOptions) {\n this._graph = new HalfEdgeGraph();\n this._options = options;\n }\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\n public set plane(value: PlaneAltitudeEvaluator | undefined) { this._plane = value; }\n /** Property access for the reference plane. */\n public get plane(): PlaneAltitudeEvaluator | undefined { return this._plane; }\n\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\n public set convexClipper(value: ConvexClipPlaneSet | undefined) { this._convexClipper = value; }\n /** Property access for the reference plane. */\n public get convexClipper(): ConvexClipPlaneSet | undefined { return this._convexClipper; }\n\n /**\n * * Construct an empty chain merge graph.\n * * The options parameter may contain any combination of the options values.\n * * tolerance = absolute tolerance for declaring points equal.\n * * Default is `Geometry.smallMetricDistance`\n * * primarySortDirection = direction for first sort.\n * * To minimize clash among points on primary sort, this should NOT be perpendicular to any principal plane.\n * * The default points into the first octant with non-obvious components.\n */\n public static create(options?: ChainMergeContextOptions): ChainMergeContext {\n const validatedOptions = ChainMergeContextValidatedOptions.createFromUnValidated(options);\n return new ChainMergeContext(validatedOptions);\n }\n /** Add a segment to the evolving graph. */\n public addSegment(pointA: Point3d, pointB: Point3d) {\n this._graph.createEdgeXYZXYZ(pointA.x, pointA.y, pointA.z, 0, pointB.x, pointB.y, pointB.z, 0);\n }\n /** Add all segments from an array to the graph. */\n public addLineSegment3dArray(data: LineSegment3d[]) {\n for (const segment of data) {\n this.addSegment(segment.point0Ref, segment.point1Ref);\n }\n }\n /** Add edges for all segments that are \"on\" the plane.\n * * No action if `this.plane` is undefined.\n */\n public addSegmentsOnPlane(points: GrowableXYZArray, addClosure: boolean = false) {\n if (!this._plane)\n return;\n const plane = this._plane;\n let i0 = addClosure ? points.length - 1 : 0;\n let a0 = points.evaluateUncheckedIndexPlaneAltitude(i0, plane);\n let i1 = addClosure ? 0 : 1;\n let a1;\n for (; i1 < points.length; i0 = i1++ , a0 = a1) {\n a1 = points.evaluateUncheckedIndexPlaneAltitude(i1, plane);\n if (Geometry.isSmallMetricDistance(a0) && Geometry.isSmallMetricDistance(a1))\n this._graph.createEdgeXYZXYZ(\n points.getXAtUncheckedPointIndex(i0), points.getYAtUncheckedPointIndex(i0), points.getZAtUncheckedPointIndex(i0), 0,\n points.getXAtUncheckedPointIndex(i1), points.getYAtUncheckedPointIndex(i1), points.getZAtUncheckedPointIndex(i1), 0);\n }\n }\n /**\n * Return a numeric value to be used for sorting, with little chance widely separated nodes will have identical key.\n * * Any single x,y,z component is a poor choice because horizontal and vertical alignment is common.\n * * Hence take dot product of x,y,z with non-trivial fraction values.\n * @param node node with x,y,z coordinates\n */\n private primarySortKey(node: HalfEdge): number {\n return this._options.primarySortDirection.dotProductXYZ(node.x, node.y, node.z);\n }\n /** Return difference of sortData members as sort comparison */\n private static nodeCompareSortData(nodeA: HalfEdge, nodeB: HalfEdge): number {\n return nodeA.sortData! - nodeB.sortData!;\n }\n /** test if nodeA is a dangling edge end (i.e. edges around vertex equal 1, but detect it without walking all the way around. */\n private static isIsolatedEnd(nodeA: HalfEdge): boolean {\n return nodeA.vertexSuccessor === nodeA;\n }\n\n /** test if nodeA is at a vertex with exactly 2 edges (i.e. edges around vertex equal w, but detect it without walking all the way around. */\n private static isChainInteriorVertex(nodeA: HalfEdge): boolean {\n const nodeB = nodeA.vertexSuccessor;\n return nodeB !== nodeA && nodeB.vertexSuccessor === nodeA;\n }\n\n /**\n * * isolate all edge ends.\n * * perform cluster analysis to determine nearly coincident points.\n * * pinch all edges together at each vertex.\n */\n public clusterAndMergeVerticesXYZ() {\n HalfEdgeGraphOps.isolateAllEdges(this._graph);\n for (const p of this._graph.allHalfEdges) {\n p.sortData = this.primarySortKey(p);\n }\n const sortArray = this._graph.allHalfEdges.slice();\n sortArray.sort((nodeA, nodeB) => ChainMergeContext.nodeCompareSortData(nodeA, nodeB));\n const xyzTolerance = this._options.tolerance;\n // A node is unvisited if it is its own vertex successor !!!\n // otherwise the node has already been twisted into a base vertex.\n const n = sortArray.length;\n for (let i0 = 0; i0 < n; i0++) {\n const node0 = sortArray[i0];\n const qMin = node0.sortData!;\n const qMax = qMin + xyzTolerance;\n if (ChainMergeContext.isIsolatedEnd(node0)) {\n for (let i1 = i0 + 1; i1 < n; i1++) {\n const node1 = sortArray[i1];\n if (ChainMergeContext.isIsolatedEnd(node1)) {\n if (node1.sortData! > qMax)\n break;\n if (node0.distanceXYZ(node1) <= xyzTolerance) {\n HalfEdge.pinch(node0, node1);\n node1.setXYZFrom(node0); // force true equal coordinates.\n }\n }\n }\n }\n }\n }\n /**\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\n * @param chains growing array of chains.\n * @param node0 start node for search.\n */\n private collectMaximalLineString3dFromStartNode(chains: LineString3d[], node0: HalfEdge, visitMask: HalfEdgeMask) {\n if (!node0.isMaskSet(visitMask)) {\n const ls = LineString3d.create();\n ls.addPointXYZ(node0.x, node0.y, node0.z);\n for (; ;) {\n node0.setMask(visitMask);\n node0.edgeMate.setMask(visitMask);\n node0 = node0.faceSuccessor;\n ls.addPointXYZ(node0.x, node0.y, node0.z);\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\n break;\n }\n chains.push(ls);\n }\n }\n /**\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\n * @param chains growing array of chains.\n * @param node0 start node for search.\n */\n private collectMaximalGrowableXYXArrayFromStartNode(result: GrowableXYZArray[], node0: HalfEdge, visitMask: HalfEdgeMask) {\n if (!node0.isMaskSet(visitMask)) {\n const points = new GrowableXYZArray();\n points.pushXYZ(node0.x, node0.y, node0.z);\n for (; ;) {\n node0.setMask(visitMask);\n node0.edgeMate.setMask(visitMask);\n node0 = node0.faceSuccessor;\n points.pushXYZ(node0.x, node0.y, node0.z);\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\n break;\n }\n if (points.length > 0)\n result.push(points);\n }\n }\n\n /**\n * * find edges with start, end in same vertex loop.\n * * pinch them away from the loop\n * * set mask on both sides.\n * * Return the number of excisions.\n */\n private exciseAndMarkSlingEdges(mask: HalfEdgeMask): number {\n let n = 0;\n for (const p of this._graph.allHalfEdges) {\n if (p.distanceXYZ(p.edgeMate) < this._options.tolerance\n && !p.isMaskSet(mask)) {\n const q = p.edgeMate;\n HalfEdge.pinch(p, p.vertexPredecessor);\n HalfEdge.pinch(q, q.vertexPredecessor);\n p.setMask(mask);\n q.setMask(mask);\n n++;\n }\n }\n return n;\n }\n /** Collect chains which have maximum edge count, broken at an vertex with other than 2 edges.\n * * This is assumed to be preceded by a call to a vertex-cluster step such as `clusterAndMergeVerticesYXZ`\n */\n public collectMaximalChains(): LineString3d[] {\n const result: LineString3d[] = [];\n const visitMask = HalfEdgeMask.VISITED;\n // Pass 0: excise and mark zero-length edges.\n this.exciseAndMarkSlingEdges(visitMask);\n this._graph.clearMask(visitMask);\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\n // (Note that collectMaximalChain checks the visit mask.)\n for (const node0 of this._graph.allHalfEdges) {\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\n }\n }\n // Pass 2: start anywhere in an unvisited loop.\n for (const node0 of this._graph.allHalfEdges) {\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\n }\n return result;\n }\n public collectMaximalGrowableXYZArrays(): GrowableXYZArray[] {\n const result: GrowableXYZArray[] = [];\n const visitMask = HalfEdgeMask.VISITED;\n // Pass 0: excise and mark zero-length edges.\n this.exciseAndMarkSlingEdges(visitMask);\n this._graph.clearMask(visitMask);\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\n // (Note that collectMaximalChain checks the visit mask.)\n for (const node0 of this._graph.allHalfEdges) {\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\n }\n }\n // Pass 2: start anywhere in an unvisited loop.\n for (const node0 of this._graph.allHalfEdges) {\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\n }\n return result;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ChainMerge.js","sourceRoot":"","sources":["../../../src/topology/ChainMerge.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,wDAAqD;AACrD,0CAA+D;AAC/D,qEAAkE;AAClE,mEAAkE;AAClE,mCAAgE;AAChE,uCAA6C;AAoB7C,oGAAoG;AACpG,MAAM,iCAAiC;I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AI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,CAAC,uCAAuC,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACM,+BAA+B;QACpC,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,oBAAY,CAAC,OAAO,CAAC;QACvC,6CAA6C;QAC7C,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACjC,2FAA2F;QAC3F,yDAAyD;QACzD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpD,IAAI,CAAC,2CAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;QACD,+CAA+C;QAC/C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,CAAC,2CAA2C,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjOD,8CAiOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Topology\n */\n\nimport { ConvexClipPlaneSet } from \"../clipping/ConvexClipPlaneSet\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { HalfEdge, HalfEdgeGraph, HalfEdgeMask } from \"./Graph\";\nimport { HalfEdgeGraphOps } from \"./Merging\";\n\n/**\n * interface containing various options appropriate to merging lines segments into chains.\n * @internal\n */\nexport interface ChainMergeContextOptions {\n /**\n * Tolerance for declaring points equal\n * * Default is `Geometry.smallMetricDistance`\n */\n tolerance?: number;\n /**\n * Direction for primary sort.\n * * Default is `Vector3d.create(0.294234298, 0.72391399, 0.45234328798)`\n * * this vector should NOT be along a principal x,y,z direction.\n * * The internal form will be normalized.\n */\n primarySortDirection?: Vector3d;\n}\n/** Internal form of ChainMergeContextOptions -- same field names, but required to have contents. */\nclass ChainMergeContextValidatedOptions {\n /**\n * Tolerance for declaring points equal.\n */\n public tolerance: number;\n /** UNNORMALIZED base vector for sorting.\n * * Actual vector hoisted into an instance is normalized.\n */\n private static readonly _defaultPrimarySortDirection = Vector3d.create(0.294234298, 0.72391399, 0.45234328798);\n /**\n * Direction for primary sort. This is normalized !!!\n */\n public primarySortDirection: Vector3d;\n /** return a unit vector aligned with optional direction.\n * * Default return is into the first quadrant at a quirky angle so any perpendicular plane is unlikely to hit many points\n */\n public static createPrimarySortVector(vector?: Vector3d): Vector3d {\n if (vector === undefined) {\n vector = this._defaultPrimarySortDirection.clone();\n }\n return vector.normalizeWithDefault(\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.x,\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.y,\n ChainMergeContextValidatedOptions._defaultPrimarySortDirection.z);\n }\n /**\n * PRIVATE constructor -- assumes all inputs are validated in public create method !!!!\n * @param tolerance\n * @param unitVectorForPrimarySort\n */\n private constructor(tolerance: number, unitVectorForPrimarySort: Vector3d) {\n this.tolerance = tolerance;\n this.primarySortDirection = unitVectorForPrimarySort;\n }\n /** return the default option set. */\n public static createFromUnValidated(options?: ChainMergeContextOptions): ChainMergeContextValidatedOptions {\n const result = new ChainMergeContextValidatedOptions(Geometry.smallMetricDistance, ChainMergeContextValidatedOptions.createPrimarySortVector());\n if (options !== undefined) {\n if (options.tolerance !== undefined)\n result.tolerance = options.tolerance;\n if (options.primarySortDirection !== undefined)\n result.primarySortDirection = ChainMergeContextValidatedOptions.createPrimarySortVector();\n }\n return result;\n }\n /** Clone this context. */\n public clone(): ChainMergeContextValidatedOptions {\n return new ChainMergeContextValidatedOptions(this.tolerance, this.primarySortDirection);\n }\n}\n/**\n * * Context for assembling line segments into chains.\n * * Use the context in phases:\n * * Create the context: `context = ChainMergeContext.create ()`\n * * Add line with any combination of:\n * * `context.addSegment(pointA, pointB)`\n * * `context.addLineSegment3dArray (segments)`\n * * Scan all coordinate data for common coordinates. Twist nodes together to form chains:\n * * `context.clusterAndMergeVerticesXYZ ()`\n * * Collect the chains:\n * * myLinestringArray = context.collectMaximalChains();\n * * The context carries an optional plane which is used by addSegmentsOnPlane\n *\n * @internal\n */\nexport class ChainMergeContext {\n\n private _graph: HalfEdgeGraph;\n private _options: ChainMergeContextValidatedOptions;\n private _plane?: PlaneAltitudeEvaluator;\n private _convexClipper?: ConvexClipPlaneSet;\n private constructor(options: ChainMergeContextValidatedOptions) {\n this._graph = new HalfEdgeGraph();\n this._options = options;\n }\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\n public set plane(value: PlaneAltitudeEvaluator | undefined) { this._plane = value; }\n /** Property access for the reference plane. */\n public get plane(): PlaneAltitudeEvaluator | undefined { return this._plane; }\n\n /** Save a reference plane for later use, e.g. in addSegmentsOnPlane */\n public set convexClipper(value: ConvexClipPlaneSet | undefined) { this._convexClipper = value; }\n /** Property access for the reference plane. */\n public get convexClipper(): ConvexClipPlaneSet | undefined { return this._convexClipper; }\n\n /**\n * * Construct an empty chain merge graph.\n * * The options parameter may contain any combination of the options values.\n * * tolerance = absolute tolerance for declaring points equal.\n * * Default is `Geometry.smallMetricDistance`\n * * primarySortDirection = direction for first sort.\n * * To minimize clash among points on primary sort, this should NOT be perpendicular to any principal plane.\n * * The default points into the first octant with non-obvious components.\n */\n public static create(options?: ChainMergeContextOptions): ChainMergeContext {\n const validatedOptions = ChainMergeContextValidatedOptions.createFromUnValidated(options);\n return new ChainMergeContext(validatedOptions);\n }\n /** Add a segment to the evolving graph. */\n public addSegment(pointA: Point3d, pointB: Point3d) {\n this._graph.createEdgeXYZXYZ(pointA.x, pointA.y, pointA.z, 0, pointB.x, pointB.y, pointB.z, 0);\n }\n /** Add all segments from an array to the graph. */\n public addLineSegment3dArray(data: LineSegment3d[]) {\n for (const segment of data) {\n this.addSegment(segment.point0Ref, segment.point1Ref);\n }\n }\n /** Add edges for all segments that are \"on\" the plane.\n * * No action if `this.plane` is undefined.\n */\n public addSegmentsOnPlane(points: GrowableXYZArray, addClosure: boolean = false) {\n if (!this._plane)\n return;\n const plane = this._plane;\n let i0 = addClosure ? points.length - 1 : 0;\n let a0 = points.evaluateUncheckedIndexPlaneAltitude(i0, plane);\n let i1 = addClosure ? 0 : 1;\n let a1;\n for (; i1 < points.length; i0 = i1++ , a0 = a1) {\n a1 = points.evaluateUncheckedIndexPlaneAltitude(i1, plane);\n if (Geometry.isSmallMetricDistance(a0) && Geometry.isSmallMetricDistance(a1))\n this._graph.createEdgeXYZXYZ(\n points.getXAtUncheckedPointIndex(i0), points.getYAtUncheckedPointIndex(i0), points.getZAtUncheckedPointIndex(i0), 0,\n points.getXAtUncheckedPointIndex(i1), points.getYAtUncheckedPointIndex(i1), points.getZAtUncheckedPointIndex(i1), 0);\n }\n }\n /**\n * Return a numeric value to be used for sorting, with little chance widely separated nodes will have identical key.\n * * Any single x,y,z component is a poor choice because horizontal and vertical alignment is common.\n * * Hence take dot product of x,y,z with non-trivial fraction values.\n * @param node node with x,y,z coordinates\n */\n private primarySortKey(node: HalfEdge): number {\n return this._options.primarySortDirection.dotProductXYZ(node.x, node.y, node.z);\n }\n /** Return difference of sortData members as sort comparison */\n private static nodeCompareSortData(nodeA: HalfEdge, nodeB: HalfEdge): number {\n return nodeA.sortData! - nodeB.sortData!;\n }\n /** test if nodeA is a dangling edge end (i.e. edges around vertex equal 1, but detect it without walking all the way around. */\n private static isIsolatedEnd(nodeA: HalfEdge): boolean {\n return nodeA.vertexSuccessor === nodeA;\n }\n\n /** test if nodeA is at a vertex with exactly 2 edges (i.e. edges around vertex equal w, but detect it without walking all the way around. */\n private static isChainInteriorVertex(nodeA: HalfEdge): boolean {\n const nodeB = nodeA.vertexSuccessor;\n return nodeB !== nodeA && nodeB.vertexSuccessor === nodeA;\n }\n\n /**\n * * isolate all edge ends.\n * * perform cluster analysis to determine nearly coincident points.\n * * pinch all edges together at each vertex.\n */\n public clusterAndMergeVerticesXYZ() {\n HalfEdgeGraphOps.isolateAllEdges(this._graph);\n for (const p of this._graph.allHalfEdges) {\n p.sortData = this.primarySortKey(p);\n }\n const sortArray = this._graph.allHalfEdges.slice();\n sortArray.sort((nodeA, nodeB) => ChainMergeContext.nodeCompareSortData(nodeA, nodeB));\n const xyzTolerance = this._options.tolerance;\n // A node is unvisited if it is its own vertex successor !!!\n // otherwise the node has already been twisted into a base vertex.\n const n = sortArray.length;\n for (let i0 = 0; i0 < n; i0++) {\n const node0 = sortArray[i0];\n const qMin = node0.sortData!;\n const qMax = qMin + xyzTolerance;\n if (ChainMergeContext.isIsolatedEnd(node0)) {\n for (let i1 = i0 + 1; i1 < n; i1++) {\n const node1 = sortArray[i1];\n if (ChainMergeContext.isIsolatedEnd(node1)) {\n if (node1.sortData! > qMax)\n break;\n if (node0.distanceXYZ(node1) <= xyzTolerance) {\n HalfEdge.pinch(node0, node1);\n node1.setXYZFrom(node0); // force true equal coordinates.\n }\n }\n }\n }\n }\n }\n /**\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\n * @param chains growing array of chains.\n * @param node0 start node for search.\n */\n private collectMaximalLineString3dFromStartNode(chains: LineString3d[], node0: HalfEdge, visitMask: HalfEdgeMask) {\n if (!node0.isMaskSet(visitMask)) {\n const ls = LineString3d.create();\n ls.addPointXYZ(node0.x, node0.y, node0.z);\n for (; ;) {\n node0.setMask(visitMask);\n node0.edgeMate.setMask(visitMask);\n node0 = node0.faceSuccessor;\n ls.addPointXYZ(node0.x, node0.y, node0.z);\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\n break;\n }\n chains.push(ls);\n }\n }\n /**\n * If node0 is not visited, creating a linestring with that starting edge and all successive edges along a chain.\n * @param chains growing array of chains.\n * @param node0 start node for search.\n */\n private collectMaximalGrowableXYXArrayFromStartNode(result: GrowableXYZArray[], node0: HalfEdge, visitMask: HalfEdgeMask) {\n if (!node0.isMaskSet(visitMask)) {\n const points = new GrowableXYZArray();\n points.pushXYZ(node0.x, node0.y, node0.z);\n for (; ;) {\n node0.setMask(visitMask);\n node0.edgeMate.setMask(visitMask);\n node0 = node0.faceSuccessor;\n points.pushXYZ(node0.x, node0.y, node0.z);\n if (node0.isMaskSet(visitMask) || !ChainMergeContext.isChainInteriorVertex(node0))\n break;\n }\n if (points.length > 0)\n result.push(points);\n }\n }\n\n /**\n * * find edges with start, end in same vertex loop.\n * * pinch them away from the loop\n * * set mask on both sides.\n * * Return the number of excisions.\n */\n private exciseAndMarkSlingEdges(mask: HalfEdgeMask): number {\n let n = 0;\n for (const p of this._graph.allHalfEdges) {\n if (p.distanceXYZ(p.edgeMate) < this._options.tolerance\n && !p.isMaskSet(mask)) {\n const q = p.edgeMate;\n HalfEdge.pinch(p, p.vertexPredecessor);\n HalfEdge.pinch(q, q.vertexPredecessor);\n p.setMask(mask);\n q.setMask(mask);\n n++;\n }\n }\n return n;\n }\n /** Collect chains which have maximum edge count, broken at vertices with more than 2 edges.\n * * This is assumed to be preceded by a call to a vertex-cluster step such as `clusterAndMergeVerticesYXZ`\n */\n public collectMaximalChains(): LineString3d[] {\n const result: LineString3d[] = [];\n const visitMask = HalfEdgeMask.VISITED;\n // Pass 0: excise and mark zero-length edges.\n this.exciseAndMarkSlingEdges(visitMask);\n this._graph.clearMask(visitMask);\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\n // (Note that collectMaximalChain checks the visit mask.)\n for (const node0 of this._graph.allHalfEdges) {\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\n }\n }\n // Pass 2: start anywhere in an unvisited loop.\n for (const node0 of this._graph.allHalfEdges) {\n this.collectMaximalLineString3dFromStartNode(result, node0, visitMask);\n }\n return result;\n }\n public collectMaximalGrowableXYZArrays(): GrowableXYZArray[] {\n const result: GrowableXYZArray[] = [];\n const visitMask = HalfEdgeMask.VISITED;\n // Pass 0: excise and mark zero-length edges.\n this.exciseAndMarkSlingEdges(visitMask);\n this._graph.clearMask(visitMask);\n // Pass 1: only start at non-interior edges -- vertices with one edge or more than 2 edges.\n // (Note that collectMaximalChain checks the visit mask.)\n for (const node0 of this._graph.allHalfEdges) {\n if (!ChainMergeContext.isChainInteriorVertex(node0)) {\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\n }\n }\n // Pass 2: start anywhere in an unvisited loop.\n for (const node0 of this._graph.allHalfEdges) {\n this.collectMaximalGrowableXYXArrayFromStartNode(result, node0, visitMask);\n }\n return result;\n }\n}\n"]}
|
|
@@ -27,9 +27,9 @@ export interface ClipPlaneProps {
|
|
|
27
27
|
normal?: XYZProps;
|
|
28
28
|
/** The plane's signed distance from the origin. */
|
|
29
29
|
dist?: number;
|
|
30
|
-
/** Defaults to `false`. */
|
|
30
|
+
/** Defaults to `false`. Interpretation of this flag is algorithm-specific. */
|
|
31
31
|
invisible?: boolean;
|
|
32
|
-
/** Defaults to `false`. */
|
|
32
|
+
/** Defaults to `false`. Interpretation of this flag is algorithm-specific. */
|
|
33
33
|
interior?: boolean;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
@@ -113,9 +113,9 @@ export declare class ClipPlane extends Plane3d implements Clipper, PolygonClippe
|
|
|
113
113
|
get distance(): number;
|
|
114
114
|
/** * Return the stored inward normal property. */
|
|
115
115
|
get inwardNormalRef(): Vector3d;
|
|
116
|
-
/** Return the "interior" property
|
|
116
|
+
/** Return the "interior" property flag. Interpretation of this flag is algorithm-specific. */
|
|
117
117
|
get interior(): boolean;
|
|
118
|
-
/** Return the "invisible" property
|
|
118
|
+
/** Return the "invisible" property flag. Interpretation of this flag is algorithm-specific. */
|
|
119
119
|
get invisible(): boolean;
|
|
120
120
|
/**
|
|
121
121
|
* Create a plane defined by two points, an up vector, and a tilt angle relative to the up vector.
|
|
@@ -222,7 +222,7 @@ export declare class ClipPlane extends Plane3d implements Clipper, PolygonClippe
|
|
|
222
222
|
getBoundedSegmentSimpleIntersection(pointA: Point3d, pointB: Point3d): number | undefined;
|
|
223
223
|
/** Apply transform to the origin. Apply inverse transpose of the matrix part to th normal vector. */
|
|
224
224
|
transformInPlace(transform: Transform): boolean;
|
|
225
|
-
/** Set the invisible flag. Interpretation of this is
|
|
225
|
+
/** Set the invisible flag. Interpretation of this flag is algorithm-specific. */
|
|
226
226
|
setInvisible(invisible: boolean): void;
|
|
227
227
|
/** Reverse the sign of all coefficients, so outside and inside reverse */
|
|
228
228
|
negateInPlace(): void;
|
|
@@ -280,5 +280,7 @@ export declare class ClipPlane extends Plane3d implements Clipper, PolygonClippe
|
|
|
280
280
|
appendPolygonClip(xyz: IndexedXYZCollection, insideFragments: GrowableXYZArray[], outsideFragments: GrowableXYZArray[], arrayCache: GrowableXYZArrayCache): void;
|
|
281
281
|
/** Project a point in space to the plane. */
|
|
282
282
|
projectPointToPlane(spacePoint: Point3d, result?: Point3d): Point3d;
|
|
283
|
+
/** Return the projection of (x,y,z) onto the plane. */
|
|
284
|
+
projectXYZToPlane(x: number, y: number, z: number, result?: Point3d): Point3d;
|
|
283
285
|
}
|
|
284
286
|
//# sourceMappingURL=ClipPlane.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClipPlane.d.ts","sourceRoot":"","sources":["../../../src/clipping/Clip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AAO;IAe5G,uFAAuF;IAChF,+BAA+B,CACpC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,GAClH,OAAO;IAuBV;;;;;OAKG;IACI,QAAQ,IAAI,SAAS;IAM5B;;;;OAIG;IACI,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,eAAe,GAAE,OAAe,GAAG,gBAAgB,GAAG,SAAS;IAuBrG;;;;;;;;OAQG;IACI,iBAAiB,CACtB,GAAG,EAAE,oBAAoB,EACzB,eAAe,EAAE,gBAAgB,EAAE,EACnC,gBAAgB,EAAE,gBAAgB,EAAE,EACpC,UAAU,EAAE,qBAAqB,GAChC,IAAI;IAUP,6CAA6C;IACtC,mBAAmB,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAG1E,uDAAuD;IACvC,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;CAI9F"}
|
|
@@ -194,11 +194,11 @@ export class ClipPlane extends Plane3d {
|
|
|
194
194
|
get inwardNormalRef() {
|
|
195
195
|
return this._inwardNormal;
|
|
196
196
|
}
|
|
197
|
-
/** Return the "interior" property
|
|
197
|
+
/** Return the "interior" property flag. Interpretation of this flag is algorithm-specific. */
|
|
198
198
|
get interior() {
|
|
199
199
|
return this._interior;
|
|
200
200
|
}
|
|
201
|
-
/** Return the "invisible" property
|
|
201
|
+
/** Return the "invisible" property flag. Interpretation of this flag is algorithm-specific. */
|
|
202
202
|
get invisible() {
|
|
203
203
|
return this._invisible;
|
|
204
204
|
}
|
|
@@ -417,7 +417,7 @@ export class ClipPlane extends Plane3d {
|
|
|
417
417
|
this._distanceFromOrigin = this._inwardNormal.dotProduct(plane.getOriginRef());
|
|
418
418
|
return true;
|
|
419
419
|
}
|
|
420
|
-
/** Set the invisible flag. Interpretation of this is
|
|
420
|
+
/** Set the invisible flag. Interpretation of this flag is algorithm-specific. */
|
|
421
421
|
setInvisible(invisible) {
|
|
422
422
|
this._invisible = invisible;
|
|
423
423
|
}
|
|
@@ -561,8 +561,12 @@ export class ClipPlane extends Plane3d {
|
|
|
561
561
|
}
|
|
562
562
|
/** Project a point in space to the plane. */
|
|
563
563
|
projectPointToPlane(spacePoint, result) {
|
|
564
|
-
|
|
565
|
-
|
|
564
|
+
return this.projectXYZToPlane(spacePoint.x, spacePoint.y, spacePoint.z, result);
|
|
565
|
+
}
|
|
566
|
+
/** Return the projection of (x,y,z) onto the plane. */
|
|
567
|
+
projectXYZToPlane(x, y, z, result) {
|
|
568
|
+
const scale = -this.altitudeXYZ(x, y, z);
|
|
569
|
+
return Point3d.create(x + scale * this._inwardNormal.x, y + scale * this._inwardNormal.y, z + scale * this._inwardNormal.z, result);
|
|
566
570
|
}
|
|
567
571
|
}
|
|
568
572
|
//# sourceMappingURL=ClipPlane.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClipPlane.js","sourceRoot":"","sources":["../../../src/clipping/ClipPlane.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAQ/F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAA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BAAoC,EACpC,UAAiC;QAEjC,MAAM,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QAChD,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC;QAC9C,8BAA8B,CAAC,oCAAoC,CACjE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,CACrD,CAAC;QACF,aAAa,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QACvE,aAAa,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;IACD,6CAA6C;IACtC,mBAAmB,CAAC,UAAmB,EAAE,MAAgB;QAC9D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACrC,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Plane3d } from \"../geometry3d/Plane3d\";\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { IndexedXYZCollectionPolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { XYZProps } from \"../geometry3d/XYZProps\";\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\nimport { Point4d } from \"../geometry4d/Point4d\";\nimport { AnalyticRoots } from \"../numerics/Polynomials\";\nimport { Clipper, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\n\n/**\n * Wire format describing a [[ClipPlane]].\n * If either [[normal]] or [[dist]] are omitted, defaults to a normal of [[Vector3d.unitZ]] and a distance of zero.\n * @public\n */\nexport interface ClipPlaneProps {\n /** The plane's inward normal. */\n normal?: XYZProps;\n /** The plane's signed distance from the origin. */\n dist?: number;\n /** Defaults to `false`. */\n invisible?: boolean;\n /** Defaults to `false`. */\n interior?: boolean;\n}\n\n/**\n * A ClipPlane is a single plane represented as\n * * An inward unit normal (u,v,w)\n * * A signedDistance\n * More details can be found at docs/learning/geometry/Clipping.md\n *\n * Hence\n * * The halfspace function evaluation for \"point\" (x,y,z) is `(x,y,z) DOT (u,v,w) - signedDistance`.\n * * POSITIVE values of the halfspace function are \"inside\".\n * * ZERO value of the halfspace function is \"on\".\n * * NEGATIVE value of the halfspace function is \"outside\".\n * * A representative point on the plane is (signedDistance * u, signedDistance * v, signedDistance * w).\n * * Given a point on the plane and the inward normal of the plane, `signedDistance = point DOT normal`.\n * @public\n */\nexport class ClipPlane extends Plane3d implements Clipper, PolygonClipper {\n private _inwardNormal: Vector3d;\n /**\n * Construct a parallel plane through the origin.\n * * Move it to the actual position.\n * * _distanceFromOrigin is the distance it moved, with the (inward) normal direction as positive\n */\n private _distanceFromOrigin: number;\n private _invisible: boolean;\n private _interior: boolean;\n\n private constructor(normal: Vector3d, distance: number, invisible: boolean, interior: boolean) {\n super();\n this._invisible = invisible;\n this._interior = interior;\n this._inwardNormal = normal;\n this._distanceFromOrigin = distance;\n }\n /*\n private safeSetXYZDistance(nx: number, ny: number, nz: number, d: number) {\n this._inwardNormal.set(nx, ny, nz);\n this._distanceFromOrigin = d;\n }\n */\n /**\n * Return true if all members are almostEqual to corresponding members of other.\n * @param other clip plane to compare\n */\n public isAlmostEqual(other: ClipPlane): boolean {\n return Geometry.isSameCoordinate(this._distanceFromOrigin, other._distanceFromOrigin)\n && this._inwardNormal.isAlmostEqual(other._inwardNormal)\n && this._interior === other._interior\n && this._invisible === other._invisible;\n }\n /** Return a cloned plane */\n public clone(): ClipPlane {\n const result = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\n return result;\n }\n /** Return a cloned plane with coordinate data negated. */\n public cloneNegated(): ClipPlane {\n const plane = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\n plane.negateInPlace();\n return plane;\n }\n /** Create a ClipPlane from Plane3dByOriginAndUnitNormal. */\n public static createPlane(\n plane: Plane3dByOriginAndUnitNormal, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane {\n const distance = plane.getNormalRef().dotProduct(plane.getOriginRef());\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = plane.getNormalRef().clone();\n result._distanceFromOrigin = distance;\n return result;\n }\n return new ClipPlane(plane.getNormalRef().clone(), distance, invisible, interior);\n }\n /**\n * Create a ClipPlane with direct normal and signedDistance.\n * * The vector is normalized for storage.\n */\n public static createNormalAndDistance(\n normal: Vector3d, distance: number, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = normal.normalize();\n if (normalized) {\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = normalized;\n result._distanceFromOrigin = distance;\n }\n return new ClipPlane(normalized, distance, invisible, interior);\n }\n return undefined;\n }\n /**\n * Create a ClipPlane\n * * \"normal\" is the inward normal of the plane (it is internally normalized).\n * * \"point\" is any point of the plane.\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz as\n * a vector from the origin.)\n */\n public static createNormalAndPoint(\n normal: Vector3d, point: Point3d, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = normal.normalize();\n if (normalized) {\n const distance = normalized.dotProduct(point);\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = normalized;\n result._distanceFromOrigin = distance;\n }\n return new ClipPlane(normalized, distance, invisible, interior);\n }\n return undefined;\n }\n /**\n * Create a clip plane\n * @param origin any point on the plane.\n * @param vectorA any vector in the plane\n * @param vectorB any vector in the plane\n * @return undefined if the vectors are not independent.\n * * The stored inward normal is vectorB.crossProduct(vectorA).\n * * That is, the vectors are considered as a right-handed pair when viewed from the outside.\n */\n public static createOriginAndVectors(\n origin: Point3d,\n vectorA: Vector3d,\n vectorB: Vector3d,\n invisible: boolean = false,\n interior: boolean = false,\n result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = vectorB.crossProduct(vectorA);\n return this.createNormalAndPoint(normalized, origin, invisible, interior, result);\n }\n /**\n * Create a ClipPlane\n * * \"normal\" (normalX, normalY, normalZ) is the inward normal of the plane.\n * * \"point\" (originX,originY,originZ) is any point of the plane.\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz\n * as a vector from the origin.)\n */\n public static createNormalAndPointXYZXYZ(\n normalX: number, normalY: number, normalZ: number,\n originX: number, originY: number, originZ: number,\n invisible: boolean = false, interior: boolean = false,\n result?: ClipPlane,\n ): ClipPlane | undefined {\n const q = Geometry.hypotenuseXYZ(normalX, normalY, normalZ);\n const r = Geometry.conditionalDivideFraction(1, q);\n if (r !== undefined) {\n if (result) {\n result._inwardNormal.set(normalX * r, normalY * r, normalZ * r);\n result._distanceFromOrigin = result._inwardNormal.dotProductXYZ(originX, originY, originZ);\n result._invisible = invisible;\n result._interior = interior;\n return result;\n }\n const normal = Vector3d.create(normalX * r, normalY * r, normalZ * r);\n return new ClipPlane(normal, normal.dotProductXYZ(originX, originY, originZ), invisible, interior);\n }\n return undefined;\n }\n /**\n * Return a json object of the form\n * `{\"normal\":[u,v,w],\"dist\":signedDistanceValue,\"interior\":true,\"invisible\":true}`\n */\n public toJSON(): ClipPlaneProps {\n const props: ClipPlaneProps = {\n normal: this.inwardNormalRef.toJSON(),\n dist: this.distance,\n };\n if (this.interior)\n props.interior = true;\n if (this.invisible)\n props.invisible = true;\n return props;\n }\n /** Parse json object to ClipPlane instance */\n public static fromJSON(json: ClipPlaneProps, result?: ClipPlane): ClipPlane | undefined {\n if (json && json.normal && undefined !== json.dist && Number.isFinite(json.dist))\n return ClipPlane.createNormalAndDistance(\n Vector3d.fromJSON(json.normal), json.dist, !!json.invisible, !!json.interior,\n );\n return ClipPlane.createNormalAndDistance(Vector3d.unitZ(), 0, false, false, result);\n }\n /** Set both the invisible and interior flags. */\n public setFlags(invisible: boolean, interior: boolean) {\n this._invisible = invisible;\n this._interior = interior;\n }\n /** Return the stored distanceFromOrigin property. */\n public get distance() {\n return this._distanceFromOrigin;\n }\n /** * Return the stored inward normal property. */\n public get inwardNormalRef(): Vector3d {\n return this._inwardNormal;\n }\n /** Return the \"interior\" property bit */\n public get interior() {\n return this._interior;\n }\n /** Return the \"invisible\" property bit. */\n public get invisible() {\n return this._invisible;\n }\n /**\n * Create a plane defined by two points, an up vector, and a tilt angle relative to the up vector.\n * @param point0 start point of the edge\n * @param point1 end point of the edge\n * @param upVector vector perpendicular to the plane\n * @param tiltAngle angle to tilt the plane around the edge in the direction of the up vector.\n * @param result optional preallocated plane\n */\n public static createEdgeAndUpVector(\n point0: Point3d, point1: Point3d, upVector: Vector3d, tiltAngle?: Angle, result?: ClipPlane,\n ): ClipPlane | undefined {\n const edgeVector = Vector3d.createFrom(point1.minus(point0));\n let normal = (upVector.crossProduct(edgeVector)).normalize();\n\n if (normal) {\n if (tiltAngle !== undefined && !tiltAngle.isAlmostZero) {\n const tiltNormal = Vector3d.createRotateVectorAroundVector(normal, edgeVector, tiltAngle);\n if (tiltNormal) {\n normal = tiltNormal.clone();\n }\n }\n normal.negate(normal);\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\n }\n return undefined;\n }\n /** Create a plane perpendicular to the edge between the xy parts of point0 and point1. */\n public static createEdgeXY(point0: Point3d, point1: Point3d, result?: ClipPlane): ClipPlane | undefined {\n const normal = Vector3d.create(point0.y - point1.y, point1.x - point0.x);\n if (normal.normalizeInPlace())\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\n return undefined;\n }\n /**\n * Return the Plane3d form of the plane.\n * * The plane origin is the point `distance * inwardNormal`\n * * The plane normal is the inward normal of the ClipPlane.\n */\n public getPlane3d(): Plane3dByOriginAndUnitNormal {\n const d = this._distanceFromOrigin;\n // normal should be normalized, will not return undefined\n return Plane3dByOriginAndUnitNormal.create(\n Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d),\n this._inwardNormal,\n )!;\n }\n /**\n * Return the Point4d d form of the plane.\n * * The homogeneous xyz are the inward normal xyz.\n * * The homogeneous weight is the negated ClipPlane distance.\n */\n public getPlane4d(): Point4d {\n return Point4d.create(\n this._inwardNormal.x, this._inwardNormal.y, this._inwardNormal.z, - this._distanceFromOrigin,\n );\n }\n /**\n * Set the plane from DPoint4d style plane.\n * * The saved plane has its direction normalized.\n * * This preserves the plane itself as a zero set but make plane evaluations act as true distances (even if the\n * plane coefficients are scaled otherwise).\n * @param plane the DPoint4d style plane.\n */\n public setPlane4d(plane: Point4d) {\n const a = Math.sqrt(plane.x * plane.x + plane.y * plane.y + plane.z * plane.z);\n const r = a === 0.0 ? 1.0 : 1.0 / a;\n this._inwardNormal.x = r * plane.x;\n this._inwardNormal.y = r * plane.y;\n this._inwardNormal.z = r * plane.z;\n this._distanceFromOrigin = -r * plane.w;\n }\n /**\n * Evaluate the altitude in weighted space, i.e. (dot product with inward normal) minus distance, with point.w\n * scale applied to distance.\n * @param point space point to test.\n */\n public weightedAltitude(point: Point4d): number {\n return point.x * this._inwardNormal.x\n + point.y * this._inwardNormal.y\n + point.z * this._inwardNormal.z\n - point.w * this._distanceFromOrigin;\n }\n /**\n * Evaluate the distance from the plane to a point in space, i.e. (dot product with inward normal) minus distance.\n * @param point space point to test.\n */\n public altitude(point: Point3d): number {\n return point.x * this._inwardNormal.x\n + point.y * this._inwardNormal.y\n + point.z * this._inwardNormal.z\n - this._distanceFromOrigin;\n }\n /**\n * Evaluate the distance from the plane to a point in space with point given as x,y,z, i.e. (dot product with\n * inward normal) minus distance.\n * @param point space point to test.\n */\n public altitudeXYZ(x: number, y: number, z: number): number {\n return x * this._inwardNormal.x\n + y * this._inwardNormal.y\n + z * this._inwardNormal.z\n - this._distanceFromOrigin;\n }\n /** Return the x component of the normal used to evaluate altitude. */\n public normalX(): number {\n return this._inwardNormal.x;\n }\n /** Return the x component of the normal used to evaluate altitude. */\n public normalY(): number {\n return this._inwardNormal.y;\n }\n /** Return the z component of the normal used to evaluate altitude. */\n public normalZ(): number {\n return this._inwardNormal.z;\n }\n /** Return the dot product of the plane normal with the vector (NOT using the plane's distanceFromOrigin). */\n public velocity(vector: Vector3d): number {\n return vector.x * this._inwardNormal.x + vector.y * this._inwardNormal.y + vector.z * this._inwardNormal.z;\n }\n /**\n * Return the dot product of the plane normal with the x,yz, vector components (NOT using the plane's\n * distanceFromOrigin).\n */\n public velocityXYZ(x: number, y: number, z: number): number {\n return x * this._inwardNormal.x + y * this._inwardNormal.y + z * this._inwardNormal.z;\n }\n /**\n * Return the dot product of the plane normal with the point (treating the point xyz as a vector, and NOT\n * using the plane's distanceFromOrigin).\n */\n public dotProductPlaneNormalPoint(point: Point3d): number {\n return point.x * this._inwardNormal.x + point.y * this._inwardNormal.y + point.z * this._inwardNormal.z;\n }\n /**\n * Return true if spacePoint is inside or on the plane, with tolerance applied to \"on\".\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointOnOrInside(spacePoint: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n let value = this.altitude(spacePoint);\n if (tolerance) { value += tolerance; }\n return value >= 0.0;\n }\n /**\n * Return true if spacePoint is strictly inside the halfspace, with tolerance applied to \"on\".\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointInside(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n let value = this.altitude(point);\n if (tolerance) { value -= tolerance; }\n return value > 0.0;\n }\n /**\n * Return true if spacePoint is strictly on the plane, within tolerance\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointOn(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n return Math.abs(this.altitude(point)) <= tolerance;\n }\n /**\n * Compute intersections of an (UNBOUNDED) arc with the plane. Append them (as radians) to a growing array.\n * @param arc arc to test. The angle limits of the arc are NOT considered.\n * @param intersectionRadians array to receive results\n */\n public appendIntersectionRadians(arc: Arc3d, intersectionRadians: GrowableFloat64Array) {\n const arcVectors = arc.toVectors();\n const alpha = this.altitude(arc.center);\n const beta = this.velocity(arcVectors.vector0);\n const gamma = this.velocity(arcVectors.vector90);\n AnalyticRoots.appendImplicitLineUnitCircleIntersections(\n alpha, beta, gamma, undefined, undefined, intersectionRadians,\n );\n }\n private static _clipArcFractionArray = new GrowableFloat64Array();\n /**\n * Announce fractional intervals of arc clip.\n * * Each call to `announce(fraction0, fraction1, arc)` announces one interval that is inside the clip plane.\n */\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\n const breaks = ClipPlane._clipArcFractionArray;\n breaks.clear();\n this.appendIntersectionRadians(arc, breaks);\n arc.sweep.radiansArrayToPositivePeriodicFractions(breaks);\n return ClipUtilities.selectIntervals01(arc, breaks, this, announce);\n }\n /**\n * Compute intersection of (unbounded) segment with the plane.\n * * If the ends are on the same side of the plane, return undefined.\n * * If the intersection is an endpoint or interior to the segment return the fraction.\n * * If both ends are on, return undefined.\n */\n public getBoundedSegmentSimpleIntersection(pointA: Point3d, pointB: Point3d): number | undefined {\n const h0 = this.altitude(pointA);\n const h1 = this.altitude(pointB);\n if (h0 * h1 > 0.0)\n return undefined;\n if (h0 === 0.0 && h1 === 0.0) {\n return undefined;\n }\n return - h0 / (h1 - h0);\n }\n /** Apply transform to the origin. Apply inverse transpose of the matrix part to th normal vector. */\n public transformInPlace(transform: Transform): boolean {\n const plane: Plane3dByOriginAndUnitNormal = this.getPlane3d();\n const matrix: Matrix3d = transform.matrix;\n const newPoint = transform.multiplyPoint3d(plane.getOriginRef());\n // Normal transforms as the inverse transpose of the matrix part\n // BTW: If the matrix is orthogonal, this is a long way to multiply by the matrix part (mumble grumble)\n const newNormal = matrix.multiplyInverseTranspose(plane.getNormalRef());\n if (!newNormal)\n return false;\n\n plane.set(newPoint, newNormal);\n const normalized = (plane.getNormalRef()).normalize();\n if (!normalized)\n return false;\n this._inwardNormal = normalized;\n this._distanceFromOrigin = this._inwardNormal.dotProduct(plane.getOriginRef());\n return true;\n }\n /** Set the invisible flag. Interpretation of this is up to the use code algorithms. */\n public setInvisible(invisible: boolean) {\n this._invisible = invisible;\n }\n /** Reverse the sign of all coefficients, so outside and inside reverse */\n public negateInPlace() {\n this._inwardNormal = this._inwardNormal.negate();\n this._distanceFromOrigin = - this._distanceFromOrigin;\n }\n /**\n * Move the plane INWARD by given distance\n * @param offset distance of shift inwards\n */\n public offsetDistance(offset: number) {\n this._distanceFromOrigin += offset;\n }\n /**\n * Clip a polygon to the inside or outside of the plane.\n * * Results with 2 or fewer points are ignored.\n * * Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.\n * @param xyz input points.\n * @param work work buffer\n * @param tolerance tolerance for \"on plane\" decision.\n */\n public clipConvexPolygonInPlace(\n xyz: GrowableXYZArray,\n work: GrowableXYZArray,\n inside: boolean = true,\n tolerance: number = Geometry.smallMetricDistance,\n ) {\n return IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(this, xyz, work, inside, tolerance);\n }\n /**\n * Multiply the ClipPlane's DPoint4d by matrix.\n * @param matrix matrix to apply.\n * @param invert if true, use in verse of the matrix.\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\n * @param matrix matrix to apply\n * @return false if unable to invert\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding\n * effect on the plane is the inverse transpose of matrixA\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\n * * Both params default to true to get the full effect of transforming space.\n */\n public multiplyPlaneByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\n const plane: Point4d = this.getPlane4d();\n if (invert) {\n const inverse = matrix.createInverse();\n if (inverse)\n return this.multiplyPlaneByMatrix4d(inverse, false, transpose);\n return false;\n }\n if (transpose)\n matrix.multiplyTransposePoint4d(plane, plane);\n else\n matrix.multiplyPoint4d(plane, plane);\n this.setPlane4d(plane);\n return true;\n }\n /** Announce the interval (if any) where a line is within the clip plane half space. */\n public announceClippedSegmentIntervals(\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: (fraction0: number, fraction1: number) => void,\n ): boolean {\n if (f1 < f0)\n return false;\n const h0 = - this.altitude(pointA);\n const h1 = - this.altitude(pointB);\n const delta = h1 - h0;\n const f = Geometry.conditionalDivideFraction(-h0, delta);\n if (f === undefined) { // The segment is parallel to the plane.\n if (h0 <= 0.0) { if (announce) announce(f0, f1); return true; }\n return false;\n }\n if (delta > 0) { // segment aims OUT\n if (f < f1) f1 = f;\n } else {\n // segment aims IN\n if (f > f0)\n f0 = f;\n }\n if (f1 < f0)\n return false;\n if (announce) announce(f0, f1);\n return true;\n }\n /**\n * Return a coordinate frame with\n * * origin at closest point to global origin\n * * z axis points in\n * * x and y are \"in plane\"\n */\n public getFrame(): Transform {\n const d = this._distanceFromOrigin;\n const origin = Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d);\n const matrix = Matrix3d.createRigidHeadsUp(this._inwardNormal, AxisOrder.ZXY);\n return Transform.createOriginAndMatrix(origin, matrix);\n }\n /**\n * Return the intersection of the plane with a range cube.\n * @param range\n * @param xyzOut intersection polygon. This is convex.\n */\n public intersectRange(range: Range3d, addClosurePoint: boolean = false): GrowableXYZArray | undefined {\n if (range.isNull)\n return undefined;\n const corners = range.corners();\n const frameOnPlane = this.getFrame();\n frameOnPlane.multiplyInversePoint3dArrayInPlace(corners);\n const localRange = Range3d.createArray(corners);\n if (localRange.low.z * localRange.high.z > 0.0)\n return undefined;\n // oversized polygon on local z= 0\n const xyzOut = new GrowableXYZArray();\n xyzOut.pushXYZ(localRange.low.x, localRange.low.y, 0);\n xyzOut.pushXYZ(localRange.high.x, localRange.low.y, 0);\n xyzOut.pushXYZ(localRange.high.x, localRange.high.y, 0);\n xyzOut.pushXYZ(localRange.low.x, localRange.high.y, 0);\n xyzOut.multiplyTransformInPlace(frameOnPlane);\n IndexedXYZCollectionPolygonOps.intersectRangeConvexPolygonInPlace(range, xyzOut);\n if (xyzOut.length === 0)\n return undefined;\n if (addClosurePoint)\n xyzOut.pushWrap(1);\n return xyzOut;\n }\n /**\n * Implement appendPolygonClip, as defined in interface PolygonClipper.\n * @param xyz convex polygon. This is not changed.\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed\n * from the cache. This is NOT cleared.\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed\n * from the cache. This is NOT cleared.\n * @param arrayCache cache for reusable GrowableXYZArray.\n */\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ): void {\n const perpendicularRange = Range1d.createNull();\n const newInside = arrayCache.grabFromCache();\n const newOutside = arrayCache.grabFromCache();\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(\n this, xyz, newInside, newOutside, perpendicularRange,\n );\n ClipUtilities.captureOrDrop(newInside, 3, insideFragments, arrayCache);\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\n }\n /** Project a point in space to the plane. */\n public projectPointToPlane(spacePoint: Point3d, result?: Point3d): Point3d {\n const d = -this.altitude(spacePoint);\n return spacePoint.plusXYZ(d * this._inwardNormal.x, d * this._inwardNormal.y, d * this._inwardNormal.z, result);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ClipPlane.js","sourceRoot":"","sources":["../../../src/clipping/ClipPlane.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAQ/F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAy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,EAAE,kBAAkB,CACrD,CAAC;QACF,aAAa,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QACvE,aAAa,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;IACD,6CAA6C;IACtC,mBAAmB,CAAC,UAAmB,EAAE,MAAgB;QAC9D,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClF,CAAC;IACD,uDAAuD;IACvC,iBAAiB,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,MAAgB;QACjF,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACtI,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { AnnounceNumberNumberCurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { AxisOrder, Geometry } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { GrowableFloat64Array } from \"../geometry3d/GrowableFloat64Array\";\nimport { GrowableXYZArray } from \"../geometry3d/GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Plane3d } from \"../geometry3d/Plane3d\";\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { IndexedXYZCollectionPolygonOps } from \"../geometry3d/PolygonOps\";\nimport { Range1d, Range3d } from \"../geometry3d/Range\";\nimport { GrowableXYZArrayCache } from \"../geometry3d/ReusableObjectCache\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { XYZProps } from \"../geometry3d/XYZProps\";\nimport { Matrix4d } from \"../geometry4d/Matrix4d\";\nimport { Point4d } from \"../geometry4d/Point4d\";\nimport { AnalyticRoots } from \"../numerics/Polynomials\";\nimport { Clipper, ClipUtilities, PolygonClipper } from \"./ClipUtils\";\n\n/**\n * Wire format describing a [[ClipPlane]].\n * If either [[normal]] or [[dist]] are omitted, defaults to a normal of [[Vector3d.unitZ]] and a distance of zero.\n * @public\n */\nexport interface ClipPlaneProps {\n /** The plane's inward normal. */\n normal?: XYZProps;\n /** The plane's signed distance from the origin. */\n dist?: number;\n /** Defaults to `false`. Interpretation of this flag is algorithm-specific. */\n invisible?: boolean;\n /** Defaults to `false`. Interpretation of this flag is algorithm-specific. */\n interior?: boolean;\n}\n\n/**\n * A ClipPlane is a single plane represented as\n * * An inward unit normal (u,v,w)\n * * A signedDistance\n * More details can be found at docs/learning/geometry/Clipping.md\n *\n * Hence\n * * The halfspace function evaluation for \"point\" (x,y,z) is `(x,y,z) DOT (u,v,w) - signedDistance`.\n * * POSITIVE values of the halfspace function are \"inside\".\n * * ZERO value of the halfspace function is \"on\".\n * * NEGATIVE value of the halfspace function is \"outside\".\n * * A representative point on the plane is (signedDistance * u, signedDistance * v, signedDistance * w).\n * * Given a point on the plane and the inward normal of the plane, `signedDistance = point DOT normal`.\n * @public\n */\nexport class ClipPlane extends Plane3d implements Clipper, PolygonClipper {\n private _inwardNormal: Vector3d;\n /**\n * Construct a parallel plane through the origin.\n * * Move it to the actual position.\n * * _distanceFromOrigin is the distance it moved, with the (inward) normal direction as positive\n */\n private _distanceFromOrigin: number;\n private _invisible: boolean;\n private _interior: boolean;\n\n private constructor(normal: Vector3d, distance: number, invisible: boolean, interior: boolean) {\n super();\n this._invisible = invisible;\n this._interior = interior;\n this._inwardNormal = normal;\n this._distanceFromOrigin = distance;\n }\n /*\n private safeSetXYZDistance(nx: number, ny: number, nz: number, d: number) {\n this._inwardNormal.set(nx, ny, nz);\n this._distanceFromOrigin = d;\n }\n */\n /**\n * Return true if all members are almostEqual to corresponding members of other.\n * @param other clip plane to compare\n */\n public isAlmostEqual(other: ClipPlane): boolean {\n return Geometry.isSameCoordinate(this._distanceFromOrigin, other._distanceFromOrigin)\n && this._inwardNormal.isAlmostEqual(other._inwardNormal)\n && this._interior === other._interior\n && this._invisible === other._invisible;\n }\n /** Return a cloned plane */\n public clone(): ClipPlane {\n const result = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\n return result;\n }\n /** Return a cloned plane with coordinate data negated. */\n public cloneNegated(): ClipPlane {\n const plane = new ClipPlane(this._inwardNormal.clone(), this._distanceFromOrigin, this._invisible, this._interior);\n plane.negateInPlace();\n return plane;\n }\n /** Create a ClipPlane from Plane3dByOriginAndUnitNormal. */\n public static createPlane(\n plane: Plane3dByOriginAndUnitNormal, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane {\n const distance = plane.getNormalRef().dotProduct(plane.getOriginRef());\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = plane.getNormalRef().clone();\n result._distanceFromOrigin = distance;\n return result;\n }\n return new ClipPlane(plane.getNormalRef().clone(), distance, invisible, interior);\n }\n /**\n * Create a ClipPlane with direct normal and signedDistance.\n * * The vector is normalized for storage.\n */\n public static createNormalAndDistance(\n normal: Vector3d, distance: number, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = normal.normalize();\n if (normalized) {\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = normalized;\n result._distanceFromOrigin = distance;\n }\n return new ClipPlane(normalized, distance, invisible, interior);\n }\n return undefined;\n }\n /**\n * Create a ClipPlane\n * * \"normal\" is the inward normal of the plane (it is internally normalized).\n * * \"point\" is any point of the plane.\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz as\n * a vector from the origin.)\n */\n public static createNormalAndPoint(\n normal: Vector3d, point: Point3d, invisible: boolean = false, interior: boolean = false, result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = normal.normalize();\n if (normalized) {\n const distance = normalized.dotProduct(point);\n if (result) {\n result._invisible = invisible;\n result._interior = interior;\n result._inwardNormal = normalized;\n result._distanceFromOrigin = distance;\n }\n return new ClipPlane(normalized, distance, invisible, interior);\n }\n return undefined;\n }\n /**\n * Create a clip plane\n * @param origin any point on the plane.\n * @param vectorA any vector in the plane\n * @param vectorB any vector in the plane\n * @return undefined if the vectors are not independent.\n * * The stored inward normal is vectorB.crossProduct(vectorA).\n * * That is, the vectors are considered as a right-handed pair when viewed from the outside.\n */\n public static createOriginAndVectors(\n origin: Point3d,\n vectorA: Vector3d,\n vectorB: Vector3d,\n invisible: boolean = false,\n interior: boolean = false,\n result?: ClipPlane,\n ): ClipPlane | undefined {\n const normalized = vectorB.crossProduct(vectorA);\n return this.createNormalAndPoint(normalized, origin, invisible, interior, result);\n }\n /**\n * Create a ClipPlane\n * * \"normal\" (normalX, normalY, normalZ) is the inward normal of the plane.\n * * \"point\" (originX,originY,originZ) is any point of the plane.\n * * The stored distance for the plane is the dot product of the point with the normal (i.e. treat the point's xyz\n * as a vector from the origin.)\n */\n public static createNormalAndPointXYZXYZ(\n normalX: number, normalY: number, normalZ: number,\n originX: number, originY: number, originZ: number,\n invisible: boolean = false, interior: boolean = false,\n result?: ClipPlane,\n ): ClipPlane | undefined {\n const q = Geometry.hypotenuseXYZ(normalX, normalY, normalZ);\n const r = Geometry.conditionalDivideFraction(1, q);\n if (r !== undefined) {\n if (result) {\n result._inwardNormal.set(normalX * r, normalY * r, normalZ * r);\n result._distanceFromOrigin = result._inwardNormal.dotProductXYZ(originX, originY, originZ);\n result._invisible = invisible;\n result._interior = interior;\n return result;\n }\n const normal = Vector3d.create(normalX * r, normalY * r, normalZ * r);\n return new ClipPlane(normal, normal.dotProductXYZ(originX, originY, originZ), invisible, interior);\n }\n return undefined;\n }\n /**\n * Return a json object of the form\n * `{\"normal\":[u,v,w],\"dist\":signedDistanceValue,\"interior\":true,\"invisible\":true}`\n */\n public toJSON(): ClipPlaneProps {\n const props: ClipPlaneProps = {\n normal: this.inwardNormalRef.toJSON(),\n dist: this.distance,\n };\n if (this.interior)\n props.interior = true;\n if (this.invisible)\n props.invisible = true;\n return props;\n }\n /** Parse json object to ClipPlane instance */\n public static fromJSON(json: ClipPlaneProps, result?: ClipPlane): ClipPlane | undefined {\n if (json && json.normal && undefined !== json.dist && Number.isFinite(json.dist))\n return ClipPlane.createNormalAndDistance(\n Vector3d.fromJSON(json.normal), json.dist, !!json.invisible, !!json.interior,\n );\n return ClipPlane.createNormalAndDistance(Vector3d.unitZ(), 0, false, false, result);\n }\n /** Set both the invisible and interior flags. */\n public setFlags(invisible: boolean, interior: boolean) {\n this._invisible = invisible;\n this._interior = interior;\n }\n /** Return the stored distanceFromOrigin property. */\n public get distance() {\n return this._distanceFromOrigin;\n }\n /** * Return the stored inward normal property. */\n public get inwardNormalRef(): Vector3d {\n return this._inwardNormal;\n }\n /** Return the \"interior\" property flag. Interpretation of this flag is algorithm-specific. */\n public get interior() {\n return this._interior;\n }\n /** Return the \"invisible\" property flag. Interpretation of this flag is algorithm-specific. */\n public get invisible() {\n return this._invisible;\n }\n /**\n * Create a plane defined by two points, an up vector, and a tilt angle relative to the up vector.\n * @param point0 start point of the edge\n * @param point1 end point of the edge\n * @param upVector vector perpendicular to the plane\n * @param tiltAngle angle to tilt the plane around the edge in the direction of the up vector.\n * @param result optional preallocated plane\n */\n public static createEdgeAndUpVector(\n point0: Point3d, point1: Point3d, upVector: Vector3d, tiltAngle?: Angle, result?: ClipPlane,\n ): ClipPlane | undefined {\n const edgeVector = Vector3d.createFrom(point1.minus(point0));\n let normal = (upVector.crossProduct(edgeVector)).normalize();\n\n if (normal) {\n if (tiltAngle !== undefined && !tiltAngle.isAlmostZero) {\n const tiltNormal = Vector3d.createRotateVectorAroundVector(normal, edgeVector, tiltAngle);\n if (tiltNormal) {\n normal = tiltNormal.clone();\n }\n }\n normal.negate(normal);\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\n }\n return undefined;\n }\n /** Create a plane perpendicular to the edge between the xy parts of point0 and point1. */\n public static createEdgeXY(point0: Point3d, point1: Point3d, result?: ClipPlane): ClipPlane | undefined {\n const normal = Vector3d.create(point0.y - point1.y, point1.x - point0.x);\n if (normal.normalizeInPlace())\n return ClipPlane.createNormalAndPoint(normal, point0, false, false, result);\n return undefined;\n }\n /**\n * Return the Plane3d form of the plane.\n * * The plane origin is the point `distance * inwardNormal`\n * * The plane normal is the inward normal of the ClipPlane.\n */\n public getPlane3d(): Plane3dByOriginAndUnitNormal {\n const d = this._distanceFromOrigin;\n // normal should be normalized, will not return undefined\n return Plane3dByOriginAndUnitNormal.create(\n Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d),\n this._inwardNormal,\n )!;\n }\n /**\n * Return the Point4d d form of the plane.\n * * The homogeneous xyz are the inward normal xyz.\n * * The homogeneous weight is the negated ClipPlane distance.\n */\n public getPlane4d(): Point4d {\n return Point4d.create(\n this._inwardNormal.x, this._inwardNormal.y, this._inwardNormal.z, - this._distanceFromOrigin,\n );\n }\n /**\n * Set the plane from DPoint4d style plane.\n * * The saved plane has its direction normalized.\n * * This preserves the plane itself as a zero set but make plane evaluations act as true distances (even if the\n * plane coefficients are scaled otherwise).\n * @param plane the DPoint4d style plane.\n */\n public setPlane4d(plane: Point4d) {\n const a = Math.sqrt(plane.x * plane.x + plane.y * plane.y + plane.z * plane.z);\n const r = a === 0.0 ? 1.0 : 1.0 / a;\n this._inwardNormal.x = r * plane.x;\n this._inwardNormal.y = r * plane.y;\n this._inwardNormal.z = r * plane.z;\n this._distanceFromOrigin = -r * plane.w;\n }\n /**\n * Evaluate the altitude in weighted space, i.e. (dot product with inward normal) minus distance, with point.w\n * scale applied to distance.\n * @param point space point to test.\n */\n public weightedAltitude(point: Point4d): number {\n return point.x * this._inwardNormal.x\n + point.y * this._inwardNormal.y\n + point.z * this._inwardNormal.z\n - point.w * this._distanceFromOrigin;\n }\n /**\n * Evaluate the distance from the plane to a point in space, i.e. (dot product with inward normal) minus distance.\n * @param point space point to test.\n */\n public altitude(point: Point3d): number {\n return point.x * this._inwardNormal.x\n + point.y * this._inwardNormal.y\n + point.z * this._inwardNormal.z\n - this._distanceFromOrigin;\n }\n /**\n * Evaluate the distance from the plane to a point in space with point given as x,y,z, i.e. (dot product with\n * inward normal) minus distance.\n * @param point space point to test.\n */\n public altitudeXYZ(x: number, y: number, z: number): number {\n return x * this._inwardNormal.x\n + y * this._inwardNormal.y\n + z * this._inwardNormal.z\n - this._distanceFromOrigin;\n }\n /** Return the x component of the normal used to evaluate altitude. */\n public normalX(): number {\n return this._inwardNormal.x;\n }\n /** Return the x component of the normal used to evaluate altitude. */\n public normalY(): number {\n return this._inwardNormal.y;\n }\n /** Return the z component of the normal used to evaluate altitude. */\n public normalZ(): number {\n return this._inwardNormal.z;\n }\n /** Return the dot product of the plane normal with the vector (NOT using the plane's distanceFromOrigin). */\n public velocity(vector: Vector3d): number {\n return vector.x * this._inwardNormal.x + vector.y * this._inwardNormal.y + vector.z * this._inwardNormal.z;\n }\n /**\n * Return the dot product of the plane normal with the x,yz, vector components (NOT using the plane's\n * distanceFromOrigin).\n */\n public velocityXYZ(x: number, y: number, z: number): number {\n return x * this._inwardNormal.x + y * this._inwardNormal.y + z * this._inwardNormal.z;\n }\n /**\n * Return the dot product of the plane normal with the point (treating the point xyz as a vector, and NOT\n * using the plane's distanceFromOrigin).\n */\n public dotProductPlaneNormalPoint(point: Point3d): number {\n return point.x * this._inwardNormal.x + point.y * this._inwardNormal.y + point.z * this._inwardNormal.z;\n }\n /**\n * Return true if spacePoint is inside or on the plane, with tolerance applied to \"on\".\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointOnOrInside(spacePoint: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n let value = this.altitude(spacePoint);\n if (tolerance) { value += tolerance; }\n return value >= 0.0;\n }\n /**\n * Return true if spacePoint is strictly inside the halfspace, with tolerance applied to \"on\".\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointInside(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n let value = this.altitude(point);\n if (tolerance) { value -= tolerance; }\n return value > 0.0;\n }\n /**\n * Return true if spacePoint is strictly on the plane, within tolerance\n * @param spacePoint point to test.\n * @param tolerance tolerance for considering \"near plane\" to be \"on plane\"\n */\n public isPointOn(point: Point3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n return Math.abs(this.altitude(point)) <= tolerance;\n }\n /**\n * Compute intersections of an (UNBOUNDED) arc with the plane. Append them (as radians) to a growing array.\n * @param arc arc to test. The angle limits of the arc are NOT considered.\n * @param intersectionRadians array to receive results\n */\n public appendIntersectionRadians(arc: Arc3d, intersectionRadians: GrowableFloat64Array) {\n const arcVectors = arc.toVectors();\n const alpha = this.altitude(arc.center);\n const beta = this.velocity(arcVectors.vector0);\n const gamma = this.velocity(arcVectors.vector90);\n AnalyticRoots.appendImplicitLineUnitCircleIntersections(\n alpha, beta, gamma, undefined, undefined, intersectionRadians,\n );\n }\n private static _clipArcFractionArray = new GrowableFloat64Array();\n /**\n * Announce fractional intervals of arc clip.\n * * Each call to `announce(fraction0, fraction1, arc)` announces one interval that is inside the clip plane.\n */\n public announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean {\n const breaks = ClipPlane._clipArcFractionArray;\n breaks.clear();\n this.appendIntersectionRadians(arc, breaks);\n arc.sweep.radiansArrayToPositivePeriodicFractions(breaks);\n return ClipUtilities.selectIntervals01(arc, breaks, this, announce);\n }\n /**\n * Compute intersection of (unbounded) segment with the plane.\n * * If the ends are on the same side of the plane, return undefined.\n * * If the intersection is an endpoint or interior to the segment return the fraction.\n * * If both ends are on, return undefined.\n */\n public getBoundedSegmentSimpleIntersection(pointA: Point3d, pointB: Point3d): number | undefined {\n const h0 = this.altitude(pointA);\n const h1 = this.altitude(pointB);\n if (h0 * h1 > 0.0)\n return undefined;\n if (h0 === 0.0 && h1 === 0.0) {\n return undefined;\n }\n return - h0 / (h1 - h0);\n }\n /** Apply transform to the origin. Apply inverse transpose of the matrix part to th normal vector. */\n public transformInPlace(transform: Transform): boolean {\n const plane: Plane3dByOriginAndUnitNormal = this.getPlane3d();\n const matrix: Matrix3d = transform.matrix;\n const newPoint = transform.multiplyPoint3d(plane.getOriginRef());\n // Normal transforms as the inverse transpose of the matrix part\n // BTW: If the matrix is orthogonal, this is a long way to multiply by the matrix part (mumble grumble)\n const newNormal = matrix.multiplyInverseTranspose(plane.getNormalRef());\n if (!newNormal)\n return false;\n\n plane.set(newPoint, newNormal);\n const normalized = (plane.getNormalRef()).normalize();\n if (!normalized)\n return false;\n this._inwardNormal = normalized;\n this._distanceFromOrigin = this._inwardNormal.dotProduct(plane.getOriginRef());\n return true;\n }\n /** Set the invisible flag. Interpretation of this flag is algorithm-specific. */\n public setInvisible(invisible: boolean) {\n this._invisible = invisible;\n }\n /** Reverse the sign of all coefficients, so outside and inside reverse */\n public negateInPlace() {\n this._inwardNormal = this._inwardNormal.negate();\n this._distanceFromOrigin = - this._distanceFromOrigin;\n }\n /**\n * Move the plane INWARD by given distance\n * @param offset distance of shift inwards\n */\n public offsetDistance(offset: number) {\n this._distanceFromOrigin += offset;\n }\n /**\n * Clip a polygon to the inside or outside of the plane.\n * * Results with 2 or fewer points are ignored.\n * * Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.\n * @param xyz input points.\n * @param work work buffer\n * @param tolerance tolerance for \"on plane\" decision.\n */\n public clipConvexPolygonInPlace(\n xyz: GrowableXYZArray,\n work: GrowableXYZArray,\n inside: boolean = true,\n tolerance: number = Geometry.smallMetricDistance,\n ) {\n return IndexedXYZCollectionPolygonOps.clipConvexPolygonInPlace(this, xyz, work, inside, tolerance);\n }\n /**\n * Multiply the ClipPlane's DPoint4d by matrix.\n * @param matrix matrix to apply.\n * @param invert if true, use in verse of the matrix.\n * @param transpose if true, use the transpose of the matrix (or inverse, per invert parameter)\n * @param matrix matrix to apply\n * @return false if unable to invert\n * * Note that if matrixA is applied to all of space, the matrix to send to this method to get a corresponding\n * effect on the plane is the inverse transpose of matrixA\n * * Callers that will apply the same matrix to many planes should pre-invert the matrix for efficiency.\n * * Both params default to true to get the full effect of transforming space.\n */\n public multiplyPlaneByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean {\n const plane: Point4d = this.getPlane4d();\n if (invert) {\n const inverse = matrix.createInverse();\n if (inverse)\n return this.multiplyPlaneByMatrix4d(inverse, false, transpose);\n return false;\n }\n if (transpose)\n matrix.multiplyTransposePoint4d(plane, plane);\n else\n matrix.multiplyPoint4d(plane, plane);\n this.setPlane4d(plane);\n return true;\n }\n /** Announce the interval (if any) where a line is within the clip plane half space. */\n public announceClippedSegmentIntervals(\n f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: (fraction0: number, fraction1: number) => void,\n ): boolean {\n if (f1 < f0)\n return false;\n const h0 = - this.altitude(pointA);\n const h1 = - this.altitude(pointB);\n const delta = h1 - h0;\n const f = Geometry.conditionalDivideFraction(-h0, delta);\n if (f === undefined) { // The segment is parallel to the plane.\n if (h0 <= 0.0) { if (announce) announce(f0, f1); return true; }\n return false;\n }\n if (delta > 0) { // segment aims OUT\n if (f < f1) f1 = f;\n } else {\n // segment aims IN\n if (f > f0)\n f0 = f;\n }\n if (f1 < f0)\n return false;\n if (announce) announce(f0, f1);\n return true;\n }\n /**\n * Return a coordinate frame with\n * * origin at closest point to global origin\n * * z axis points in\n * * x and y are \"in plane\"\n */\n public getFrame(): Transform {\n const d = this._distanceFromOrigin;\n const origin = Point3d.create(this._inwardNormal.x * d, this._inwardNormal.y * d, this._inwardNormal.z * d);\n const matrix = Matrix3d.createRigidHeadsUp(this._inwardNormal, AxisOrder.ZXY);\n return Transform.createOriginAndMatrix(origin, matrix);\n }\n /**\n * Return the intersection of the plane with a range cube.\n * @param range\n * @param xyzOut intersection polygon. This is convex.\n */\n public intersectRange(range: Range3d, addClosurePoint: boolean = false): GrowableXYZArray | undefined {\n if (range.isNull)\n return undefined;\n const corners = range.corners();\n const frameOnPlane = this.getFrame();\n frameOnPlane.multiplyInversePoint3dArrayInPlace(corners);\n const localRange = Range3d.createArray(corners);\n if (localRange.low.z * localRange.high.z > 0.0)\n return undefined;\n // oversized polygon on local z= 0\n const xyzOut = new GrowableXYZArray();\n xyzOut.pushXYZ(localRange.low.x, localRange.low.y, 0);\n xyzOut.pushXYZ(localRange.high.x, localRange.low.y, 0);\n xyzOut.pushXYZ(localRange.high.x, localRange.high.y, 0);\n xyzOut.pushXYZ(localRange.low.x, localRange.high.y, 0);\n xyzOut.multiplyTransformInPlace(frameOnPlane);\n IndexedXYZCollectionPolygonOps.intersectRangeConvexPolygonInPlace(range, xyzOut);\n if (xyzOut.length === 0)\n return undefined;\n if (addClosurePoint)\n xyzOut.pushWrap(1);\n return xyzOut;\n }\n /**\n * Implement appendPolygonClip, as defined in interface PolygonClipper.\n * @param xyz convex polygon. This is not changed.\n * @param insideFragments Array to receive \"inside\" fragments. Each fragment is a GrowableXYZArray grabbed\n * from the cache. This is NOT cleared.\n * @param outsideFragments Array to receive \"outside\" fragments. Each fragment is a GrowableXYZArray grabbed\n * from the cache. This is NOT cleared.\n * @param arrayCache cache for reusable GrowableXYZArray.\n */\n public appendPolygonClip(\n xyz: IndexedXYZCollection,\n insideFragments: GrowableXYZArray[],\n outsideFragments: GrowableXYZArray[],\n arrayCache: GrowableXYZArrayCache,\n ): void {\n const perpendicularRange = Range1d.createNull();\n const newInside = arrayCache.grabFromCache();\n const newOutside = arrayCache.grabFromCache();\n IndexedXYZCollectionPolygonOps.splitConvexPolygonInsideOutsidePlane(\n this, xyz, newInside, newOutside, perpendicularRange,\n );\n ClipUtilities.captureOrDrop(newInside, 3, insideFragments, arrayCache);\n ClipUtilities.captureOrDrop(newOutside, 3, outsideFragments, arrayCache);\n }\n /** Project a point in space to the plane. */\n public projectPointToPlane(spacePoint: Point3d, result?: Point3d): Point3d {\n return this.projectXYZToPlane(spacePoint.x, spacePoint.y, spacePoint.z, result);\n }\n /** Return the projection of (x,y,z) onto the plane. */\n public override projectXYZToPlane(x: number, y: number, z: number, result?: Point3d): Point3d {\n const scale = -this.altitudeXYZ(x, y, z);\n return Point3d.create(x + scale * this._inwardNormal.x, y + scale * this._inwardNormal.y, z + scale * this._inwardNormal.z, result);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConvexClipPlaneSet.d.ts","sourceRoot":"","sources":["../../../src/clipping/ConvexClipPlaneSet.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,kCAAkC,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MA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;;;;OAQG;IACI,iBAAiB,CACtB,GAAG,EAAE,oBAAoB,EACzB,eAAe,EAAE,gBAAgB,EAAE,EACnC,gBAAgB,EAAE,gBAAgB,EAAE,EACpC,UAAU,EAAE,qBAAqB,GAChC,IAAI;IAKP;;;;;;;;;;MAUE;WACY,oBAAoB,CAChC,UAAU,EAAE,QAAQ,GAAG,eAAe,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAClE;QAAE,OAAO,EAAE,kBAAkB,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CA4BnD"}
|
|
@@ -735,29 +735,18 @@ export class ConvexClipPlaneSet {
|
|
|
735
735
|
static createConvexPolyface(convexMesh, result) {
|
|
736
736
|
result = this.createEmpty(result);
|
|
737
737
|
let vol = 0;
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
if
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
vol = PolyfaceQuery.sumTetrahedralVolumes(myVisitor);
|
|
751
|
-
const scale = vol > 0.0 ? -1.0 : 1.0; // point clipper normals inward if mesh normals point outward
|
|
752
|
-
const normal = Vector3d.create();
|
|
753
|
-
const plane = Plane3dByOriginAndUnitNormal.createXYPlane();
|
|
754
|
-
myVisitor.reset();
|
|
755
|
-
while (myVisitor.moveToNextFacet()) {
|
|
756
|
-
if (undefined !== PolygonOps.areaNormalGo(myVisitor.point, normal)) {
|
|
757
|
-
normal.scaleInPlace(scale);
|
|
758
|
-
if (undefined !== Plane3dByOriginAndUnitNormal.create(myVisitor.point.front(), normal, plane))
|
|
759
|
-
result.addPlaneToConvexSet(plane);
|
|
760
|
-
}
|
|
738
|
+
if (PolyfaceQuery.isPolyfaceClosedByEdgePairing(convexMesh))
|
|
739
|
+
vol = PolyfaceQuery.sumTetrahedralVolumes(convexMesh);
|
|
740
|
+
const scale = vol > 0.0 ? -1.0 : 1.0; // point clipper normals inward if mesh normals point outward
|
|
741
|
+
const normal = Vector3d.create();
|
|
742
|
+
const plane = Plane3dByOriginAndUnitNormal.createXYPlane();
|
|
743
|
+
const visitor = convexMesh instanceof Polyface ? convexMesh.createVisitor(0) : convexMesh;
|
|
744
|
+
visitor.setNumWrap(0);
|
|
745
|
+
for (visitor.reset(); visitor.moveToNextFacet();) {
|
|
746
|
+
if (undefined !== PolygonOps.areaNormalGo(visitor.point, normal)) {
|
|
747
|
+
normal.scaleInPlace(scale);
|
|
748
|
+
if (undefined !== Plane3dByOriginAndUnitNormal.create(visitor.point.front(), normal, plane))
|
|
749
|
+
result.addPlaneToConvexSet(plane);
|
|
761
750
|
}
|
|
762
751
|
}
|
|
763
752
|
return { clipper: result, volume: vol };
|