@itwin/core-geometry 5.0.0-dev.4 → 5.0.0-dev.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -1
- package/lib/cjs/Constant.js +17 -17
- package/lib/cjs/Constant.js.map +1 -1
- package/lib/cjs/Geometry.js +35 -35
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js +18 -21
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.js +2 -2
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js +2 -2
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js +1 -1
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.js +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js +3 -3
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +40 -8
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +80 -22
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +4 -4
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +16 -2
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +33 -2
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts +87 -53
- package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
- package/lib/cjs/curve/CurveFactory.js +213 -135
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +12 -8
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +34 -13
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.d.ts +12 -6
- package/lib/cjs/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js +12 -6
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.d.ts +8 -6
- package/lib/cjs/curve/Query/CylindricalRange.d.ts.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js +13 -9
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.d.ts +4 -4
- package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js +1 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +5 -5
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +13 -13
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +5 -5
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +29 -23
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +4 -4
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +2 -2
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.js +16 -16
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -1
- package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +14 -8
- package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js +17 -8
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js +4 -4
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts +2 -0
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js +4 -0
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +32 -10
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +54 -16
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +13 -2
- package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js +24 -10
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +11 -8
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +36 -34
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.js +2 -2
- package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +6 -6
- package/lib/cjs/geometry3d/Point3dVector3d.js +6 -6
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +5 -5
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.d.ts +12 -6
- package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js +117 -70
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +3 -3
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.d.ts +9 -5
- package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js +9 -5
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.js +4 -4
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry4d/MomentData.d.ts +72 -73
- package/lib/cjs/geometry4d/MomentData.d.ts.map +1 -1
- package/lib/cjs/geometry4d/MomentData.js +62 -64
- package/lib/cjs/geometry4d/MomentData.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.js +13 -13
- package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
- package/lib/cjs/numerics/PolarData.js +1 -1
- package/lib/cjs/numerics/PolarData.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.d.ts +5 -5
- package/lib/cjs/numerics/Polynomials.js +32 -32
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js +20 -20
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/polyface/AuxData.d.ts +2 -2
- package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
- package/lib/cjs/polyface/AuxData.js +11 -3
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/BoxTopology.js +67 -67
- package/lib/cjs/polyface/BoxTopology.js.map +1 -1
- package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js +2 -2
- package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts +27 -20
- package/lib/cjs/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js +56 -30
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts +2 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js +2 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/Polyface.d.ts +3 -5
- package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
- package/lib/cjs/polyface/Polyface.js +6 -13
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +14 -7
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +59 -64
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.d.ts +13 -3
- package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js +26 -9
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.d.ts +2 -2
- package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js +11 -10
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/multiclip/RangeSearch.js +5 -5
- package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js +22 -22
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.d.ts +5 -5
- package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js +112 -112
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/solid/Box.d.ts +9 -3
- package/lib/cjs/solid/Box.d.ts.map +1 -1
- package/lib/cjs/solid/Box.js +10 -5
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/solid/Cone.d.ts +3 -2
- package/lib/cjs/solid/Cone.d.ts.map +1 -1
- package/lib/cjs/solid/Cone.js +3 -3
- package/lib/cjs/solid/Cone.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.d.ts +9 -3
- package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
- package/lib/cjs/solid/LinearSweep.js +9 -4
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.d.ts +15 -4
- package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js +20 -7
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.d.ts +35 -26
- package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
- package/lib/cjs/solid/RuledSweep.js +41 -28
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.d.ts +12 -11
- package/lib/cjs/solid/SolidPrimitive.d.ts.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.js +8 -5
- package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +17 -7
- package/lib/cjs/solid/Sphere.d.ts.map +1 -1
- package/lib/cjs/solid/Sphere.js +22 -16
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/SweepContour.d.ts +25 -16
- package/lib/cjs/solid/SweepContour.d.ts.map +1 -1
- package/lib/cjs/solid/SweepContour.js +25 -16
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.d.ts +8 -2
- package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
- package/lib/cjs/solid/TorusPipe.js +9 -5
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.js +4 -4
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/Graph.js +5 -5
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +2 -2
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js +11 -11
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Constant.js +17 -17
- package/lib/esm/Constant.js.map +1 -1
- package/lib/esm/Geometry.js +35 -35
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js +18 -21
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/KnotVector.js +2 -2
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js +2 -2
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.js +1 -1
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.js +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.js +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js +3 -3
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +40 -8
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +80 -22
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +4 -4
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +16 -2
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +33 -2
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts +87 -53
- package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
- package/lib/esm/curve/CurveFactory.js +213 -135
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +12 -8
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +34 -13
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.d.ts +12 -6
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js +12 -6
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.d.ts +8 -6
- package/lib/esm/curve/Query/CylindricalRange.d.ts.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js +13 -9
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.d.ts +4 -4
- package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
- package/lib/esm/curve/StrokeOptions.js +1 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +5 -5
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +13 -13
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +5 -5
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +29 -23
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +4 -4
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js +2 -2
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/geometry3d/Angle.js +16 -16
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts +1 -1
- package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js +1 -1
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts +14 -8
- package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js +17 -8
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js +4 -4
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts +2 -0
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js +4 -0
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +32 -10
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +54 -16
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +13 -2
- package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js +24 -10
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +11 -8
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +36 -34
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.js +2 -2
- package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +6 -6
- package/lib/esm/geometry3d/Point3dVector3d.js +6 -6
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +5 -5
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.d.ts +12 -6
- package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js +117 -70
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +3 -3
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.d.ts +9 -5
- package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js +9 -5
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.js +4 -4
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry4d/MomentData.d.ts +72 -73
- package/lib/esm/geometry4d/MomentData.d.ts.map +1 -1
- package/lib/esm/geometry4d/MomentData.js +62 -64
- package/lib/esm/geometry4d/MomentData.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.js +13 -13
- package/lib/esm/numerics/ClusterableArray.js.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.js +1 -1
- package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
- package/lib/esm/numerics/PolarData.js +1 -1
- package/lib/esm/numerics/PolarData.js.map +1 -1
- package/lib/esm/numerics/Polynomials.d.ts +5 -5
- package/lib/esm/numerics/Polynomials.js +32 -32
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js +20 -20
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/polyface/AuxData.d.ts +2 -2
- package/lib/esm/polyface/AuxData.d.ts.map +1 -1
- package/lib/esm/polyface/AuxData.js +11 -3
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/BoxTopology.js +67 -67
- package/lib/esm/polyface/BoxTopology.js.map +1 -1
- package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js +2 -2
- package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts +27 -20
- package/lib/esm/polyface/IndexedEdgeMatcher.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js +56 -30
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts +2 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.d.ts.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js +2 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/Polyface.d.ts +3 -5
- package/lib/esm/polyface/Polyface.d.ts.map +1 -1
- package/lib/esm/polyface/Polyface.js +6 -13
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +14 -7
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +60 -65
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.d.ts +13 -3
- package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js +26 -9
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.d.ts +2 -2
- package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js +11 -10
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/multiclip/RangeSearch.js +5 -5
- package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.js +22 -22
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.d.ts +5 -5
- package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js +112 -112
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/solid/Box.d.ts +9 -3
- package/lib/esm/solid/Box.d.ts.map +1 -1
- package/lib/esm/solid/Box.js +10 -5
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/solid/Cone.d.ts +3 -2
- package/lib/esm/solid/Cone.d.ts.map +1 -1
- package/lib/esm/solid/Cone.js +3 -3
- package/lib/esm/solid/Cone.js.map +1 -1
- package/lib/esm/solid/LinearSweep.d.ts +9 -3
- package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
- package/lib/esm/solid/LinearSweep.js +9 -4
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.d.ts +15 -4
- package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
- package/lib/esm/solid/RotationalSweep.js +20 -7
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.d.ts +35 -26
- package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
- package/lib/esm/solid/RuledSweep.js +41 -28
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SolidPrimitive.d.ts +12 -11
- package/lib/esm/solid/SolidPrimitive.d.ts.map +1 -1
- package/lib/esm/solid/SolidPrimitive.js +8 -5
- package/lib/esm/solid/SolidPrimitive.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +17 -7
- package/lib/esm/solid/Sphere.d.ts.map +1 -1
- package/lib/esm/solid/Sphere.js +22 -16
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/SweepContour.d.ts +25 -16
- package/lib/esm/solid/SweepContour.d.ts.map +1 -1
- package/lib/esm/solid/SweepContour.js +25 -16
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/solid/TorusPipe.d.ts +8 -2
- package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
- package/lib/esm/solid/TorusPipe.js +9 -5
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/lib/esm/topology/ChainMerge.js +4 -4
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/Graph.js +5 -5
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js +2 -2
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/topology/Triangulation.js +11 -11
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarycentricTriangle.js","sourceRoot":"","sources":["../../../src/geometry3d/BarycentricTriangle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAE7C,0CAAwD;AACxD,yCAAsC;AACtC,uDAAsD;AACtD,mCAAgC;AAGhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,sBAAsB;IAiBjC;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACb,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;IAC9B,CAAC;IACD,4DAA4D;IACrD,UAAU;QACf,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACb,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,GAAG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,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,MAAM,KAAK,GAAG,mBAAQ,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IACD,4DAA4D;IACrD,aAAa,CAAC,KAA0B,EAAE,GAAY;QAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eACpD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eAClD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;CACF;AAhiBD,kDAgiBC","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/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { assert } from \"@itwin/core-bentley\";\n\nimport { Geometry, PolygonLocation } from \"../Geometry\";\nimport { Matrix3d } from \"./Matrix3d\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { Ray3d } from \"./Ray3d\";\nimport { Transform } from \"./Transform\";\n\n/**\n * Carries data about a location in the plane of a triangle.\n * * Each instance carries both world and barycentric coordinates for the point, and provides query\n * services on the latter.\n * * No tolerance is used when querying barycentric coordinates (e.g., `isInsideOrOn`, `classify`). Use\n * [[BarycentricTriangle.snapLocationToEdge]] to adjust the barycentric coordinates to a triangle edge\n * if they lie within a distance or parametric tolerance.\n *\n * Properties of the barycentric coordinates `(b0, b1, b2)` of a point `p` in the plane of a triangle\n * `T` with vertices `v0, v1, v2`:\n * * `1 = b0 + b1 + b2`\n * * `p = b0 * v0 + b1 * v1 + b2 * v2`\n * * If T is spanned by the vectors `U = v1 - v0` and `V = v2 - v0`, then the vector `P = p - v0` can\n * be written `P = b1 * U + b2 * V`.\n * * The coordinates are all nonnegative if and only if `p` is inside or on `T`.\n * * Exactly one coordinate is zero if and only if `p` lies on an (infinitely extended) edge of `T`.\n * * Exactly two coordinates are zero if and only if `p` coincides with a vertex of `T`.\n * * Note that if `p` can be written as a linear combination of the vertices of `T` using scales that do\n * NOT sum to 1, then `p` is not coplanar with `T`\n * @public\n */\nexport class TriangleLocationDetail {\n /** The Cartesian coordinates of the point p. */\n public world: Point3d;\n /** The barycentric coordinates of p with respect to the triangle. Assumed to sum to one. */\n public local: Point3d;\n /** Application-specific number */\n public a: number;\n /** Index of the triangle vertex at the start of the closest edge to p. */\n public closestEdgeIndex: number;\n /**\n * The parameter f along the closest edge to p of its projection q.\n * * We have q = v_i + f * (v_j - v_i) where i = closestEdgeIndex and j = (i + 1) % 3 are the indices\n * of the start vertex v_i and end vertex v_j of the closest edge to p.\n * * Note that 0 <= f <= 1.\n */\n public closestEdgeParam: number;\n\n private constructor() {\n this.world = new Point3d();\n this.local = new Point3d();\n this.a = 0.0;\n this.closestEdgeIndex = 0;\n this.closestEdgeParam = 0.0;\n }\n /** Invalidate this detail (set all attributes to zero) . */\n public invalidate() {\n this.world.setZero();\n this.local.setZero();\n this.a = 0.0;\n this.closestEdgeIndex = 0;\n this.closestEdgeParam = 0.0;\n }\n /**\n * Create an invalid detail.\n * @param result optional pre-allocated object to fill and return\n */\n public static create(result?: TriangleLocationDetail): TriangleLocationDetail {\n if (undefined === result)\n result = new TriangleLocationDetail();\n else\n result.invalidate();\n return result;\n }\n /**\n * Set the instance contents from the `other` detail.\n * @param other detail to clone\n */\n public copyContentsFrom(other: TriangleLocationDetail) {\n this.world.setFrom(other.world);\n this.local.setFrom(other.local);\n this.a = other.a;\n this.closestEdgeIndex = other.closestEdgeIndex;\n this.closestEdgeParam = other.closestEdgeParam;\n }\n /** Whether this detail is invalid. */\n public get isValid(): boolean {\n return !this.local.isZero;\n }\n /**\n * Queries the barycentric coordinates to determine whether this instance specifies a location inside or\n * on the triangle.\n * @see classify\n */\n public get isInsideOrOn(): boolean {\n return this.isValid && this.local.x >= 0.0 && this.local.y >= 0.0 && this.local.z >= 0.0;\n }\n /**\n * Queries this detail to classify the location of this instance with respect to the triangle.\n * @returns location code\n * @see isInsideOrOn\n */\n public get classify(): PolygonLocation {\n if (!this.isValid)\n return PolygonLocation.Unknown;\n if (this.isInsideOrOn) {\n let numZero = 0;\n if (Math.abs(this.local.x) === 0.0)\n ++numZero;\n if (Math.abs(this.local.y) === 0.0)\n ++numZero;\n if (Math.abs(this.local.z) === 0.0)\n ++numZero;\n if (2 === numZero)\n return PolygonLocation.OnPolygonVertex;\n if (1 === numZero)\n return PolygonLocation.OnPolygonEdgeInterior;\n return PolygonLocation.InsidePolygonProjectsToEdgeInterior;\n }\n return (this.closestEdgeParam === 0.0) ?\n PolygonLocation.OutsidePolygonProjectsToVertex :\n PolygonLocation.OutsidePolygonProjectsToEdgeInterior;\n }\n}\n\n/**\n * 3 points defining a triangle to be evaluated with barycentric coordinates.\n * @public\n */\nexport class BarycentricTriangle {\n /** Array of 3 point coordinates for the triangle. */\n public points: Point3d[];\n /** Edge length squared cache, indexed by opposite vertex index */\n protected edgeLength2: number[];\n // private attributes\n private static _workPoint?: Point3d;\n private static _workVector0?: Vector3d;\n private static _workVector1?: Vector3d;\n private static _workRay?: Ray3d;\n private static _workMatrix?: Matrix3d;\n /**\n * Constructor.\n * * Point references are CAPTURED\n */\n protected constructor(point0: Point3d, point1: Point3d, point2: Point3d) {\n this.points = [];\n this.points.push(point0);\n this.points.push(point1);\n this.points.push(point2);\n this.edgeLength2 = [];\n this.edgeLength2.push(point1.distanceSquared(point2));\n this.edgeLength2.push(point0.distanceSquared(point2));\n this.edgeLength2.push(point0.distanceSquared(point1));\n }\n /**\n * Copy contents of (not pointers to) the given points. A vertex is zeroed if its corresponding input point\n * is undefined.\n */\n public set(point0: Point3d | undefined, point1: Point3d | undefined, point2: Point3d | undefined) {\n this.points[0].setFromPoint3d(point0);\n this.points[1].setFromPoint3d(point1);\n this.points[2].setFromPoint3d(point2);\n this.edgeLength2[0] = this.points[1].distanceSquared(this.points[2]);\n this.edgeLength2[1] = this.points[0].distanceSquared(this.points[2]);\n this.edgeLength2[2] = this.points[0].distanceSquared(this.points[1]);\n }\n /** Copy all values from `other` */\n public setFrom(other: BarycentricTriangle) {\n for (let i = 0; i < 3; ++i) {\n this.points[i].setFromPoint3d(other.points[i]);\n this.edgeLength2[i] = other.edgeLength2[i];\n }\n }\n /**\n * Create a `BarycentricTriangle` with coordinates given by enumerated x,y,z of the 3 points.\n * @param result optional pre-allocated triangle.\n */\n public static createXYZXYZXYZ(\n x0: number, y0: number, z0: number,\n x1: number, y1: number, z1: number,\n x2: number, y2: number, z2: number,\n result?: BarycentricTriangle,\n ): BarycentricTriangle {\n if (!result)\n return new this(Point3d.create(x0, y0, z0), Point3d.create(x1, y1, z1), Point3d.create(x2, y2, z2));\n result.points[0].set(x0, y0, z0);\n result.points[1].set(x1, y1, z1);\n result.points[2].set(x2, y2, z2);\n return result;\n }\n /** Create a triangle with coordinates cloned from given points. */\n public static create(\n point0: Point3d, point1: Point3d, point2: Point3d, result?: BarycentricTriangle,\n ): BarycentricTriangle {\n if (!result)\n return new this(point0.clone(), point1.clone(), point2.clone());\n result.set(point0, point1, point2);\n return result;\n }\n /** Return a new `BarycentricTriangle` with the same coordinates. */\n public clone(result?: BarycentricTriangle): BarycentricTriangle {\n return BarycentricTriangle.create(this.points[0], this.points[1], this.points[2], result);\n }\n /** Return a clone of the transformed instance */\n public cloneTransformed(transform: Transform, result?: BarycentricTriangle): BarycentricTriangle {\n return BarycentricTriangle.create(\n transform.multiplyPoint3d(this.points[0], result?.points[0]),\n transform.multiplyPoint3d(this.points[1], result?.points[1]),\n transform.multiplyPoint3d(this.points[2], result?.points[2]),\n result,\n );\n }\n /** Return the area of the triangle. */\n public get area(): number {\n // The magnitude of the cross product A × B is the area of the parallelogram spanned by A and B.\n return 0.5 * this.points[0].crossProductToPointsMagnitude(this.points[1], this.points[2]);\n }\n /**\n * Compute squared length of the triangle edge opposite the vertex with the given index.\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\n */\n public edgeLengthSquared(oppositeVertexIndex: number): number {\n return this.edgeLength2[Geometry.cyclic3dAxis(oppositeVertexIndex)];\n }\n /**\n * Compute length of the triangle edge opposite the vertex with the given index.\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\n */\n public edgeLength(oppositeVertexIndex: number): number {\n return Math.sqrt(this.edgeLengthSquared(oppositeVertexIndex));\n }\n /** Return area divided by sum of squared lengths. */\n public get aspectRatio(): number {\n return Geometry.safeDivideFraction(\n this.area, this.edgeLengthSquared(0) + this.edgeLengthSquared(1) + this.edgeLengthSquared(2), 0,\n );\n }\n /** Return the perimeter of the triangle. */\n public get perimeter(): number {\n return this.edgeLength(0) + this.edgeLength(1) + this.edgeLength(2);\n }\n /**\n * Return the unit normal of the triangle.\n * @param result optional pre-allocated vector to fill and return.\n * @returns unit normal, or undefined if cross product length is too small.\n */\n public normal(result?: Vector3d): Vector3d | undefined {\n const cross = this.points[0].crossProductToPoints(this.points[1], this.points[2], result);\n if (cross.tryNormalizeInPlace())\n return cross;\n return undefined;\n }\n /**\n * Sum the triangle points with given scales.\n * * If the scales sum to 1, they are barycentric coordinates, and hence the result point is in the plane of\n * the triangle. If all coordinates are non-negative then the result point is inside the triangle.\n * * If the scales do not sum to 1, the point is inside the triangle scaled (by the scale sum) from the origin.\n * @param b0 scale to apply to vertex 0\n * @param b1 scale to apply to vertex 1\n * @param b2 scale to apply to vertex 2\n * @param result optional pre-allocated point to fill and return\n * @return linear combination of the vertices of this triangle\n * @see [[pointToFraction]]\n */\n public fractionToPoint(b0: number, b1: number, b2: number, result?: Point3d): Point3d {\n // p = b0 * v0 + b1 * v1 + b2 * v2\n return Point3d.createAdd3Scaled(this.points[0], b0, this.points[1], b1, this.points[2], b2, result);\n }\n /**\n * Compute the projection of the given `point` onto the plane of this triangle.\n * @param point point p to project\n * @param result optional pre-allocated object to fill and return\n * @returns details d of the projection point `P = d.world`:\n * * `d.isValid` returns true if and only if `this.normal()` is defined.\n * * `d.classify` can be used to determine where P lies with respect to the triangle.\n * * `d.a` is the signed projection distance: `P = p + a * this.normal()`.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/BarycentricTriangle\n * @see [[fractionToPoint]]\n */\n public pointToFraction(point: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\n const normal = BarycentricTriangle._workVector0 = this.normal(BarycentricTriangle._workVector0);\n if (undefined === normal)\n return TriangleLocationDetail.create(result);\n const ray = BarycentricTriangle._workRay = Ray3d.create(point, normal, BarycentricTriangle._workRay);\n return this.intersectRay3d(ray, result); // intersectRay3d is free to use workVector0\n }\n /** Convert from opposite-vertex to start-vertex edge indexing. */\n public static edgeOppositeVertexIndexToStartVertexIndex(edgeIndex: number): number {\n return Geometry.cyclic3dAxis(edgeIndex + 1);\n }\n /** Convert from start-vertex to opposite-vertex edge indexing. */\n public static edgeStartVertexIndexToOppositeVertexIndex(startVertexIndex: number): number {\n return Geometry.cyclic3dAxis(startVertexIndex - 1);\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle but not on an edge/vertex.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns whether the point with barycentric coordinates is strictly inside the triangle.\n */\n public static isInsideTriangle(b0: number, b1: number, b2: number): boolean {\n return b0 > 0 && b1 > 0 && b2 > 0;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle or on an edge/vertex.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns whether the point with barycentric coordinates is inside or on the triangle.\n */\n public static isInsideOrOnTriangle(b0: number, b1: number, b2: number): boolean {\n return b0 >= 0 && b1 >= 0 && b2 >= 0;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies outside an edge of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns edge index i (opposite vertex i) for which b_i < 0 and b_j >= 0, and b_k >= 0. Otherwise, returns -1.\n */\n private static isInRegionBeyondEdge(b0: number, b1: number, b2: number): number {\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\n // edges to infinity and not by perpendicular lines to the edges (which gives smaller regions)\n if (b0 < 0 && b1 >= 0 && b2 >= 0)\n return 0;\n if (b0 >= 0 && b1 < 0 && b2 >= 0)\n return 1;\n if (b0 >= 0 && b1 >= 0 && b2 < 0)\n return 2;\n return -1;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies outside a vertex of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns index of vertex i for which b_j < 0 and b_k < 0. Otherwise, returns -1.\n */\n private static isInRegionBeyondVertex(b0: number, b1: number, b2: number): number {\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\n // edges to infinity and not by perpendicular lines to the edges (which gives larger regions)\n if (b1 < 0 && b2 < 0)\n return 0;\n if (b0 < 0 && b2 < 0)\n return 1;\n if (b0 < 0 && b1 < 0)\n return 2;\n return -1;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies on a vertex of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns index of vertex i for which b_i = 1 and b_j = b_k = 0. Otherwise, returns -1.\n */\n private static isOnVertex(b0: number, b1: number, b2: number): number {\n if (b0 === 1 && b1 === 0 && b2 === 0)\n return 0;\n if (b0 === 0 && b1 === 1 && b2 === 0)\n return 1;\n if (b0 === 0 && b1 === 0 && b2 === 1)\n return 2;\n return -1;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies on a bounded edge of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns edge index i (opposite vertex i) for which b_i = 0, b_j > 0, and b_k > 0. Otherwise, returns -1.\n */\n private static isOnBoundedEdge(b0: number, b1: number, b2: number): number {\n if (b0 === 0 && b1 > 0 && b2 > 0)\n return 0;\n if (b0 > 0 && b1 === 0 && b2 > 0)\n return 1;\n if (b0 > 0 && b1 > 0 && b2 === 0)\n return 2;\n return -1;\n }\n /** @returns edge/vertex index (0,1,2) for which the function has a minimum value */\n private static indexOfMinimum(fn: (index: number) => number): number {\n let i = 0;\n let min = fn(0);\n const val = fn(1);\n if (min > val) {\n i = 1;\n min = val;\n }\n if (min > fn(2))\n i = 2;\n return i;\n }\n /**\n * Compute the squared distance between two points given by their barycentric coordinates.\n * * It is assumed that a0 + a1 + a2 = b0 + b1 + b2 = 1.\n */\n public distanceSquared(a0: number, a1: number, a2: number, b0: number, b1: number, b2: number): number {\n // The barycentric displacement vector distance formula\n // More details can be found at https://web.evanchen.cc/handouts/bary/bary-full.pdf\n return -this.edgeLengthSquared(0) * (b1 - a1) * (b2 - a2)\n - this.edgeLengthSquared(1) * (b2 - a2) * (b0 - a0)\n - this.edgeLengthSquared(2) * (b0 - a0) * (b1 - a1);\n }\n /** Return the index of the closest triangle vertex to the point given by its barycentric coordinates. */\n public closestVertexIndex(b0: number, b1: number, b2: number): number {\n return BarycentricTriangle.indexOfMinimum((i: number) => {\n const a = BarycentricTriangle._workPoint = Point3d.createZero(BarycentricTriangle._workPoint);\n a.setAt(i, 1.0); // \"a\" is (1,0,0) or (0,1,0) or (0,0,1) so \"a\" represents vertex i\n return this.distanceSquared(a.x, a.y, a.z, b0, b1, b2); // distance between the point and vertex i\n });\n }\n /** Compute dot product of the edge vectors based at the vertex with the given index. */\n public dotProductOfEdgeVectorsAtVertex(baseVertexIndex: number): number {\n const i = Geometry.cyclic3dAxis(baseVertexIndex);\n const j = Geometry.cyclic3dAxis(i + 1);\n const k = Geometry.cyclic3dAxis(j + 1);\n return Geometry.dotProductXYZXYZ(\n this.points[j].x - this.points[i].x, this.points[j].y - this.points[i].y, this.points[j].z - this.points[i].z,\n this.points[k].x - this.points[i].x, this.points[k].y - this.points[i].y, this.points[k].z - this.points[i].z,\n );\n }\n /**\n * Compute the projection of barycentric point p onto the (unbounded) edge e_k(v_i,v_j) of the triangle T(v_i,v_j,v_k).\n * @param k vertex v_k is opposite the edge e_k\n * @param b barycentric coordinates of point to project\n * @returns parameter f along e_k, such that:\n * * the projection point is q = v_i + f * (v_j - v_i)\n * * the barycentric coords of the projection are q_ijk = (1 - f, f, 0)\n */\n private computeProjectionToEdge(k: number, b: number[]): number {\n /**\n * We know p = (b_i*v_i) + (b_j*v_j) + (b_k*v_k) and 1 = b_i + b_j + b_k.\n * Let U = v_j - v_i and V = v_k - v_i and P = p - v_i.\n * First we prove P = b_jU + b_kV.\n * P = (b_i * v_i) + (b_j * v_j) + (b_k * v_k) - v_i\n * = (b_i * v_i) + (b_j * (v_j-v_i)) + (b_j * v_i) + (b_k * (v_k-v_i)) + (b_k * v_i) - v_i\n * = (b_i * v_i) + (b_j * U) + (b_j * v_i) + (b_k * V) + (b_k * v_i) - v_i\n * = (b_j * U) + (b_k * V) + ((b_i + b_j + b_k) * v_i) - v_i\n * = (b_j * U) + (b_k * V) + v_i - v_i\n * = (b_j * U) + (b_k * V)\n * So we know p - v_i = b_jU + b_kV and q - v_i = fU\n * Therefore, 0 = (p - q).(v_j - v_i)\n * = ((p-v_i) - (q-v_i)).(v_j - v_i)\n * = (b_jU + b_kV - fU).U\n * = b_jU.U + b_kU.V - fU.U\n * Thus f = b_j + b_k(U.V/U.U)\n */\n k = Geometry.cyclic3dAxis(k);\n const i = Geometry.cyclic3dAxis(k + 1);\n const j = Geometry.cyclic3dAxis(i + 1);\n return b[j] + b[k] * this.dotProductOfEdgeVectorsAtVertex(i) / this.edgeLengthSquared(k);\n }\n /**\n * Compute the projection of a barycentric point p to the triangle T(v_0,v_1,v_2).\n * @param b0 barycentric coordinate of p corresponding to v_0\n * @param b1 barycentric coordinate of p corresponding to v_1\n * @param b2 barycentric coordinate of p corresponding to v_2\n * @returns closest edge start vertex index i and projection parameter f such that the projection\n * q = v_i + f * (v_j - v_i).\n */\n public closestPoint(b0: number, b1: number, b2: number): { closestEdgeIndex: number, closestEdgeParam: number } {\n const b: number[] = [b0, b1, b2];\n let edgeIndex = -1; // opposite-vertex index\n let edgeParam = 0.0;\n if (BarycentricTriangle.isInsideTriangle(b0, b1, b2)) { // projects to any edge\n edgeIndex = BarycentricTriangle.indexOfMinimum((i: number) => {\n // We want smallest projection distance d_i of p to e_i.\n // Since b_i=d_i|e_i|/2A we can compare quantities b_i/|e_i|.\n return b[i] * b[i] / this.edgeLengthSquared(i); // avoid sqrt\n });\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondVertex(b0, b1, b2)) >= 0) { // projects to other edges, or any vertex\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n if (edgeParam < 0 || edgeParam > 1) {\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n if (edgeParam < 0 || edgeParam > 1) {\n edgeParam = 0.0;\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(this.closestVertexIndex(b0, b1, b2));\n }\n }\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondEdge(b0, b1, b2)) >= 0) { // projects to the edge or its vertices\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n if (edgeParam < 0) {\n edgeParam = 0.0; // start of this edge\n } else if (edgeParam > 1) {\n edgeParam = 0.0;\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1); // end of this edge = start of next edge\n }\n } else if ((edgeIndex = BarycentricTriangle.isOnBoundedEdge(b0, b1, b2)) >= 0) {\n edgeParam = 1 - b[BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex)];\n } else if ((edgeIndex = BarycentricTriangle.isOnVertex(b0, b1, b2)) >= 0) {\n edgeParam = 0.0;\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(edgeIndex);\n }\n // invalid edgeIndex shouldn't happen, but propagate it anyway\n assert(edgeIndex === 0 || edgeIndex === 1 || edgeIndex === 2);\n return {\n closestEdgeIndex: (edgeIndex < 0) ? -1 : BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex),\n closestEdgeParam: edgeParam,\n };\n }\n /**\n * Compute the intersection of a line (parameterized as a ray) with the plane of this triangle.\n * * This method is slower than `Ray3d.intersectionWithTriangle`.\n * @param ray infinite line to intersect, as a ray\n * @param result optional pre-allocated object to fill and return\n * @returns details d of the line-plane intersection point `d.world`:\n * * `d.a` is the intersection parameter along the ray.\n * * The line intersects the plane of the triangle if and only if `d.isValid` returns true.\n * * The ray intersects the plane of the triangle if and only if `d.isValid` returns true and `d.a` >= 0.\n * * The ray intersects the triangle if and only if `d.isValid` returns true, `d.a` >= 0, and `d.isInsideOrOn`\n * returns true.\n * * `d.classify` can be used to determine where the intersection lies with respect to the triangle.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/RayTriangleIntersection\n * @see [[pointToFraction]]\n */\n public intersectRay3d(ray: Ray3d, result?: TriangleLocationDetail): TriangleLocationDetail {\n result = TriangleLocationDetail.create(result);\n /**\n * Let r0 = ray.origin and d = ray.direction. Write intersection point p two ways for unknown scalars s,b0,b1,b2:\n * r0 + s*d = p = b0*v0 + b1*v1 + b2*v2\n * Subtract v0 from both ends, let u=v1-v0, v=v2-v0, c=r0-v0, and enforce b0+b1+b2=1:\n * b1*u + b2*v - s*d = c\n * This is a linear system Mx = c where M has columns u,v,d and solution x=(b1,b2,-s).\n */\n const r0 = ray.origin;\n const d = ray.direction;\n const u = BarycentricTriangle._workVector0 = Vector3d.createStartEnd(\n this.points[0], this.points[1], BarycentricTriangle._workVector0,\n );\n const v = BarycentricTriangle._workVector1 = Vector3d.createStartEnd(\n this.points[0], this.points[2], BarycentricTriangle._workVector1,\n );\n const M = BarycentricTriangle._workMatrix = Matrix3d.createColumns(u, v, d, BarycentricTriangle._workMatrix);\n const c = Vector3d.createStartEnd(this.points[0], r0, BarycentricTriangle._workVector0); // reuse workVector0\n const solution = BarycentricTriangle._workVector1; // reuse workVector1\n if (undefined === M.multiplyInverse(c, solution))\n return result; // invalid\n result.a = -solution.z; // = -(-s) = s\n ray.fractionToPoint(result.a, result.world);\n result.local.set(1.0 - solution.x - solution.y, solution.x, solution.y); // = (1 - b1 - b2, b1, b2) = (b0 , b1, b2)\n const proj = this.closestPoint(result.local.x, result.local.y, result.local.z);\n result.closestEdgeIndex = proj.closestEdgeIndex;\n result.closestEdgeParam = proj.closestEdgeParam;\n return result;\n }\n /**\n * Compute the intersection of a line (parameterized as a line segment) with the plane of this triangle.\n * @param point0 start point of segment on line to intersect\n * @param point1 end point of segment on line to intersect\n * @param result optional pre-allocated object to fill and return\n * @returns details d of the line-plane intersection point `d.world`:\n * * `d.isValid` returns true if and only if the line intersects the plane.\n * * `d.classify` can be used to determine where the intersection lies with respect to the triangle.\n * * `d.a` is the intersection parameter. If `d.a` is in [0,1], the segment intersects the plane of the triangle.\n * @see [[intersectRay3d]]\n */\n public intersectSegment(point0: Point3d, point1: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\n BarycentricTriangle._workRay = Ray3d.createStartEnd(point0, point1, BarycentricTriangle._workRay);\n return this.intersectRay3d(BarycentricTriangle._workRay, result);\n }\n /**\n * Adjust the location to the closest edge of the triangle if within either given tolerance.\n * @param location details of a point in the plane of the triangle (note that `location.local` and\n * `location.world` possibly updated to lie on the triangle closest edge)\n * @param distanceTolerance absolute distance tolerance (or zero to ignore)\n * @param parameterTolerance barycentric coordinate fractional tolerance (or zero to ignore)\n * @return whether the location was adjusted\n */\n public snapLocationToEdge(\n location: TriangleLocationDetail,\n distanceTolerance: number = Geometry.smallMetricDistance,\n parameterTolerance: number = Geometry.smallFloatingPoint,\n ): boolean {\n if (!location.isValid)\n return false;\n // first try parametric tol to zero barycentric coordinate (no vertices or world distances used!)\n if (parameterTolerance > 0.0) {\n let numSnapped = 0;\n let newSum = 0.0;\n for (let i = 0; i < 3; i++) {\n const barycentricDist = Math.abs(location.local.at(i));\n if (barycentricDist > 0.0 && barycentricDist < parameterTolerance) {\n location.local.setAt(i, 0.0);\n numSnapped++;\n }\n newSum += location.local.at(i);\n }\n if (numSnapped > 0 && newSum > 0.0) {\n location.local.scaleInPlace(1.0 / newSum);\n if (1 === numSnapped) {\n location.closestEdgeIndex = BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(\n BarycentricTriangle.isOnBoundedEdge(location.local.x, location.local.y, location.local.z),\n );\n location.closestEdgeParam = 1.0 - location.local.at(location.closestEdgeIndex);\n } else { // 2 snapped, at vertex\n location.closestEdgeIndex = BarycentricTriangle.isOnVertex(\n location.local.x, location.local.y, location.local.z,\n );\n location.closestEdgeParam = 0.0;\n }\n this.fractionToPoint(location.local.x, location.local.y, location.local.z, location.world);\n return true;\n }\n }\n // failing that, try distance tol to closest edge projection\n if (distanceTolerance > 0.0) {\n const i = location.closestEdgeIndex;\n const j = (i + 1) % 3;\n const k = (j + 1) % 3;\n const edgeProjection = BarycentricTriangle._workPoint = this.points[i].interpolate(\n location.closestEdgeParam, this.points[j], BarycentricTriangle._workPoint,\n );\n const dist = location.world.distance(edgeProjection);\n if (dist > 0.0 && dist < distanceTolerance) {\n location.local.setAt(i, 1.0 - location.closestEdgeParam);\n location.local.setAt(j, location.closestEdgeParam);\n location.local.setAt(k, 0.0);\n location.world.setFrom(edgeProjection);\n return true;\n }\n }\n return false;\n }\n /**\n * Return the dot product of the scaled normals of the two triangles.\n * * The sign of the return value is useful for determining the triangles' relative orientation:\n * positive (negative) means the normals point into the same (opposite) half-space determined by\n * one of the triangles' planes; zero means the triangles are perpendicular.\n */\n public dotProductOfCrossProductsFromOrigin(other: BarycentricTriangle): number {\n BarycentricTriangle._workVector0 = this.points[0].crossProductToPoints(\n this.points[1], this.points[2], BarycentricTriangle._workVector0,\n );\n BarycentricTriangle._workVector1 = other.points[0].crossProductToPoints(\n other.points[1], other.points[2], BarycentricTriangle._workVector1,\n );\n return BarycentricTriangle._workVector0.dotProduct(BarycentricTriangle._workVector1);\n }\n /** Return the centroid of the 3 points. */\n public centroid(result?: Point3d): Point3d {\n // Do the scale as true division (rather than multiply by precomputed 1/3). This might protect one bit of result.\n return Point3d.create(\n (this.points[0].x + this.points[1].x + this.points[2].x) / 3.0,\n (this.points[0].y + this.points[1].y + this.points[2].y) / 3.0,\n (this.points[0].z + this.points[1].z + this.points[2].z) / 3.0,\n result,\n );\n }\n /** Return the incenter of the triangle. */\n public incenter(result?: Point3d): Point3d {\n const a = this.edgeLength(0);\n const b = this.edgeLength(1);\n const c = this.edgeLength(2);\n const scale = Geometry.safeDivideFraction(1.0, a + b + c, 0.0);\n return this.fractionToPoint(scale * a, scale * b, scale * c, result);\n }\n /** Return the circumcenter of the triangle. */\n public circumcenter(result?: Point3d): Point3d {\n const a2 = this.edgeLengthSquared(0);\n const b2 = this.edgeLengthSquared(1);\n const c2 = this.edgeLengthSquared(2);\n const x = a2 * (b2 + c2 - a2);\n const y = b2 * (c2 + a2 - b2);\n const z = c2 * (a2 + b2 - c2);\n const scale = Geometry.safeDivideFraction(1.0, x + y + z, 0.0);\n return this.fractionToPoint(scale * x, scale * y, scale * z, result);\n }\n /** Test for point-by-point `isAlmostEqual` relationship. */\n public isAlmostEqual(other: BarycentricTriangle, tol?: number): boolean {\n return this.points[0].isAlmostEqual(other.points[0], tol)\n && this.points[1].isAlmostEqual(other.points[1], tol)\n && this.points[2].isAlmostEqual(other.points[2], tol);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BarycentricTriangle.js","sourceRoot":"","sources":["../../../src/geometry3d/BarycentricTriangle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAE7C,0CAAwD;AACxD,yCAAsC;AACtC,uDAAsD;AACtD,mCAAgC;AAGhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,sBAAsB;IAiBjC;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,yBAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACb,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;IAC9B,CAAC;IACD,4DAA4D;IACrD,UAAU;QACf,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACb,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,GAAG,CAAC;IAC9B,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,MAAM,CAAC,MAA+B;QAClD,IAAI,SAAS,KAAK,MAAM;YACtB,MAAM,GAAG,IAAI,sBAAsB,EAAE,CAAC;;YAEtC,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,OAA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AiB,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,MAAM,KAAK,GAAG,mBAAQ,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IACD,4DAA4D;IACrD,aAAa,CAAC,KAA0B,EAAE,GAAY;QAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eACpD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;eAClD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;CACF;AAziBD,kDAyiBC","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/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { assert } from \"@itwin/core-bentley\";\n\nimport { Geometry, PolygonLocation } from \"../Geometry\";\nimport { Matrix3d } from \"./Matrix3d\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { Ray3d } from \"./Ray3d\";\nimport { Transform } from \"./Transform\";\n\n/**\n * Carries data about a location in the plane of a triangle.\n * * Each instance carries both world and barycentric coordinates for the point, and provides query\n * services on the latter.\n * * No tolerance is used when querying barycentric coordinates (e.g., `isInsideOrOn`, `classify`). Use\n * [[BarycentricTriangle.snapLocationToEdge]] to adjust the barycentric coordinates to a triangle edge\n * if they lie within a distance or parametric tolerance.\n *\n * Properties of the barycentric coordinates `(b0, b1, b2)` of a point `p` in the plane of a triangle\n * `T` with vertices `v0, v1, v2`:\n * * `1 = b0 + b1 + b2`\n * * `p = b0 * v0 + b1 * v1 + b2 * v2`\n * * If T is spanned by the vectors `U = v1 - v0` and `V = v2 - v0`, then the vector `P = p - v0` can\n * be written `P = b1 * U + b2 * V`.\n * * The coordinates are all nonnegative if and only if `p` is inside or on `T`.\n * * Exactly one coordinate is zero if and only if `p` lies on an (infinitely extended) edge of `T`.\n * * Exactly two coordinates are zero if and only if `p` coincides with a vertex of `T`.\n * * Note that if `p` can be written as a linear combination of the vertices of `T` using scales that do\n * NOT sum to 1, then `p` is not coplanar with `T`\n * @public\n */\nexport class TriangleLocationDetail {\n /** The Cartesian coordinates of the point p. */\n public world: Point3d;\n /** The barycentric coordinates of p with respect to the triangle. Assumed to sum to one. */\n public local: Point3d;\n /** Application-specific number */\n public a: number;\n /** Index of the triangle vertex at the start of the closest edge to p. */\n public closestEdgeIndex: number;\n /**\n * The parameter f along the closest edge to p of its projection q.\n * * We have q = v_i + f * (v_j - v_i) where i = closestEdgeIndex and j = (i + 1) % 3 are the indices\n * of the start vertex v_i and end vertex v_j of the closest edge to p.\n * * Note that 0 <= f <= 1.\n */\n public closestEdgeParam: number;\n\n private constructor() {\n this.world = new Point3d();\n this.local = new Point3d();\n this.a = 0.0;\n this.closestEdgeIndex = 0;\n this.closestEdgeParam = 0.0;\n }\n /** Invalidate this detail (set all attributes to zero) . */\n public invalidate() {\n this.world.setZero();\n this.local.setZero();\n this.a = 0.0;\n this.closestEdgeIndex = 0;\n this.closestEdgeParam = 0.0;\n }\n /**\n * Create an invalid detail.\n * @param result optional pre-allocated object to fill and return\n */\n public static create(result?: TriangleLocationDetail): TriangleLocationDetail {\n if (undefined === result)\n result = new TriangleLocationDetail();\n else\n result.invalidate();\n return result;\n }\n /**\n * Set the instance contents from the `other` detail.\n * @param other detail to clone\n */\n public copyContentsFrom(other: TriangleLocationDetail) {\n this.world.setFrom(other.world);\n this.local.setFrom(other.local);\n this.a = other.a;\n this.closestEdgeIndex = other.closestEdgeIndex;\n this.closestEdgeParam = other.closestEdgeParam;\n }\n /** Whether this detail is invalid. */\n public get isValid(): boolean {\n return !this.local.isZero;\n }\n /**\n * Queries the barycentric coordinates to determine whether this instance specifies a location inside or\n * on the triangle.\n * @see classify\n */\n public get isInsideOrOn(): boolean {\n return this.isValid && this.local.x >= 0.0 && this.local.y >= 0.0 && this.local.z >= 0.0;\n }\n /**\n * Queries this detail to classify the location of this instance with respect to the triangle.\n * @returns location code\n * @see isInsideOrOn\n */\n public get classify(): PolygonLocation {\n if (!this.isValid)\n return PolygonLocation.Unknown;\n if (this.isInsideOrOn) {\n let numZero = 0;\n if (Math.abs(this.local.x) === 0.0)\n ++numZero;\n if (Math.abs(this.local.y) === 0.0)\n ++numZero;\n if (Math.abs(this.local.z) === 0.0)\n ++numZero;\n if (2 === numZero)\n return PolygonLocation.OnPolygonVertex;\n if (1 === numZero)\n return PolygonLocation.OnPolygonEdgeInterior;\n return PolygonLocation.InsidePolygonProjectsToEdgeInterior;\n }\n return (this.closestEdgeParam === 0.0) ?\n PolygonLocation.OutsidePolygonProjectsToVertex :\n PolygonLocation.OutsidePolygonProjectsToEdgeInterior;\n }\n}\n\n/**\n * 3 points defining a triangle to be evaluated with barycentric coordinates.\n * @public\n */\nexport class BarycentricTriangle {\n /** Array of 3 point coordinates for the triangle. */\n public points: Point3d[];\n /** Edge length squared cache, indexed by opposite vertex index */\n protected edgeLength2: number[];\n // private attributes\n private static _workPoint?: Point3d;\n private static _workVector0?: Vector3d;\n private static _workVector1?: Vector3d;\n private static _workRay?: Ray3d;\n private static _workMatrix?: Matrix3d;\n /**\n * Constructor.\n * * Point references are CAPTURED\n */\n protected constructor(point0: Point3d, point1: Point3d, point2: Point3d) {\n this.points = [];\n this.points.push(point0);\n this.points.push(point1);\n this.points.push(point2);\n this.edgeLength2 = [];\n this.edgeLength2.push(point1.distanceSquared(point2));\n this.edgeLength2.push(point0.distanceSquared(point2));\n this.edgeLength2.push(point0.distanceSquared(point1));\n }\n /**\n * Copy contents of (not pointers to) the given points. A vertex is zeroed if its corresponding input point\n * is undefined.\n */\n public set(point0: Point3d | undefined, point1: Point3d | undefined, point2: Point3d | undefined) {\n this.points[0].setFromPoint3d(point0);\n this.points[1].setFromPoint3d(point1);\n this.points[2].setFromPoint3d(point2);\n this.edgeLength2[0] = this.points[1].distanceSquared(this.points[2]);\n this.edgeLength2[1] = this.points[0].distanceSquared(this.points[2]);\n this.edgeLength2[2] = this.points[0].distanceSquared(this.points[1]);\n }\n /** Copy all values from `other` */\n public setFrom(other: BarycentricTriangle) {\n for (let i = 0; i < 3; ++i) {\n this.points[i].setFromPoint3d(other.points[i]);\n this.edgeLength2[i] = other.edgeLength2[i];\n }\n }\n /**\n * Create a `BarycentricTriangle` with coordinates given by enumerated x,y,z of the 3 points.\n * @param result optional pre-allocated triangle.\n */\n public static createXYZXYZXYZ(\n x0: number, y0: number, z0: number,\n x1: number, y1: number, z1: number,\n x2: number, y2: number, z2: number,\n result?: BarycentricTriangle,\n ): BarycentricTriangle {\n if (!result)\n return new this(Point3d.create(x0, y0, z0), Point3d.create(x1, y1, z1), Point3d.create(x2, y2, z2));\n result.points[0].set(x0, y0, z0);\n result.points[1].set(x1, y1, z1);\n result.points[2].set(x2, y2, z2);\n return result;\n }\n /** Create a triangle with coordinates cloned from given points. */\n public static create(\n point0: Point3d, point1: Point3d, point2: Point3d, result?: BarycentricTriangle,\n ): BarycentricTriangle {\n if (!result)\n return new this(point0.clone(), point1.clone(), point2.clone());\n result.set(point0, point1, point2);\n return result;\n }\n /** Return a new `BarycentricTriangle` with the same coordinates. */\n public clone(result?: BarycentricTriangle): BarycentricTriangle {\n return BarycentricTriangle.create(this.points[0], this.points[1], this.points[2], result);\n }\n /** Return a clone of the transformed instance */\n public cloneTransformed(transform: Transform, result?: BarycentricTriangle): BarycentricTriangle {\n return BarycentricTriangle.create(\n transform.multiplyPoint3d(this.points[0], result?.points[0]),\n transform.multiplyPoint3d(this.points[1], result?.points[1]),\n transform.multiplyPoint3d(this.points[2], result?.points[2]),\n result,\n );\n }\n /** Return the area of the triangle. */\n public get area(): number {\n // The magnitude of the cross product A × B is the area of the parallelogram spanned by A and B.\n return 0.5 * this.points[0].crossProductToPointsMagnitude(this.points[1], this.points[2]);\n }\n /**\n * Compute squared length of the triangle edge opposite the vertex with the given index.\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\n */\n public edgeLengthSquared(oppositeVertexIndex: number): number {\n return this.edgeLength2[Geometry.cyclic3dAxis(oppositeVertexIndex)];\n }\n /**\n * Compute length of the triangle edge opposite the vertex with the given index.\n * @see [[edgeStartVertexIndexToOppositeVertexIndex]]\n */\n public edgeLength(oppositeVertexIndex: number): number {\n return Math.sqrt(this.edgeLengthSquared(oppositeVertexIndex));\n }\n /** Return area divided by sum of squared lengths. */\n public get aspectRatio(): number {\n return Geometry.safeDivideFraction(\n this.area, this.edgeLengthSquared(0) + this.edgeLengthSquared(1) + this.edgeLengthSquared(2), 0,\n );\n }\n /** Return the perimeter of the triangle. */\n public get perimeter(): number {\n return this.edgeLength(0) + this.edgeLength(1) + this.edgeLength(2);\n }\n /**\n * Return the unit normal of the triangle.\n * @param result optional pre-allocated vector to fill and return.\n * @returns unit normal, or undefined if cross product length is too small.\n */\n public normal(result?: Vector3d): Vector3d | undefined {\n const cross = this.points[0].crossProductToPoints(this.points[1], this.points[2], result);\n if (cross.tryNormalizeInPlace())\n return cross;\n return undefined;\n }\n /**\n * Sum the triangle points with given scales.\n * * If the scales sum to 1, they are barycentric coordinates, and hence the result point is in the plane of\n * the triangle. If all coordinates are non-negative then the result point is inside the triangle.\n * * If the scales do not sum to 1, the point is inside the triangle scaled (by the scale sum) from the origin.\n * @param b0 scale to apply to vertex 0\n * @param b1 scale to apply to vertex 1\n * @param b2 scale to apply to vertex 2\n * @param result optional pre-allocated point to fill and return\n * @return linear combination of the vertices of this triangle\n * @see [[pointToFraction]]\n */\n public fractionToPoint(b0: number, b1: number, b2: number, result?: Point3d): Point3d {\n // p = b0 * v0 + b1 * v1 + b2 * v2\n return Point3d.createAdd3Scaled(this.points[0], b0, this.points[1], b1, this.points[2], b2, result);\n }\n /**\n * Compute the projection of the given `point` onto the plane of this triangle.\n * @param point point p to project\n * @param result optional pre-allocated object to fill and return\n * @returns details d of the projection point `P = d.world`:\n * * `d.isValid` returns true if and only if `this.normal()` is defined.\n * * `d.classify` can be used to determine where P lies with respect to the triangle.\n * * `d.a` is the signed projection distance: `P = p + a * this.normal()`.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/BarycentricTriangle\n * @see [[fractionToPoint]]\n */\n public pointToFraction(point: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\n const normal = BarycentricTriangle._workVector0 = this.normal(BarycentricTriangle._workVector0);\n if (undefined === normal)\n return TriangleLocationDetail.create(result);\n const ray = BarycentricTriangle._workRay = Ray3d.create(point, normal, BarycentricTriangle._workRay);\n return this.intersectRay3d(ray, result); // intersectRay3d is free to use workVector0\n }\n /** Convert from opposite-vertex to start-vertex edge indexing. */\n public static edgeOppositeVertexIndexToStartVertexIndex(edgeIndex: number): number {\n return Geometry.cyclic3dAxis(edgeIndex + 1);\n }\n /** Convert from start-vertex to opposite-vertex edge indexing. */\n public static edgeStartVertexIndexToOppositeVertexIndex(startVertexIndex: number): number {\n return Geometry.cyclic3dAxis(startVertexIndex - 1);\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle but not on an edge/vertex.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns whether the point with barycentric coordinates is strictly inside the triangle.\n */\n public static isInsideTriangle(b0: number, b1: number, b2: number): boolean {\n return b0 > 0 && b1 > 0 && b2 > 0;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies inside the triangle or on an edge/vertex.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns whether the point with barycentric coordinates is inside or on the triangle.\n */\n public static isInsideOrOnTriangle(b0: number, b1: number, b2: number): boolean {\n return b0 >= 0 && b1 >= 0 && b2 >= 0;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies outside an edge of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns edge index i (opposite vertex i) for which b_i < 0 and b_j >= 0, and b_k >= 0. Otherwise, returns -1.\n */\n private static isInRegionBeyondEdge(b0: number, b1: number, b2: number): number {\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\n // edges to infinity and not by perpendicular lines to the edges (which gives smaller regions)\n if (b0 < 0 && b1 >= 0 && b2 >= 0)\n return 0;\n if (b0 >= 0 && b1 < 0 && b2 >= 0)\n return 1;\n if (b0 >= 0 && b1 >= 0 && b2 < 0)\n return 2;\n return -1;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies outside a vertex of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns index of vertex i for which b_j < 0 and b_k < 0. Otherwise, returns -1.\n */\n private static isInRegionBeyondVertex(b0: number, b1: number, b2: number): number {\n // Note: the 3 regions (specified by the following if statements) are defined by extending the triangle\n // edges to infinity and not by perpendicular lines to the edges (which gives larger regions)\n if (b1 < 0 && b2 < 0)\n return 0;\n if (b0 < 0 && b2 < 0)\n return 1;\n if (b0 < 0 && b1 < 0)\n return 2;\n return -1;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies on a vertex of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns index of vertex i for which b_i = 1 and b_j = b_k = 0. Otherwise, returns -1.\n */\n private static isOnVertex(b0: number, b1: number, b2: number): number {\n if (b0 === 1 && b1 === 0 && b2 === 0)\n return 0;\n if (b0 === 0 && b1 === 1 && b2 === 0)\n return 1;\n if (b0 === 0 && b1 === 0 && b2 === 1)\n return 2;\n return -1;\n }\n /**\n * Examine a point's barycentric coordinates to determine if it lies on a bounded edge of the triangle.\n * * No parametric tolerance is used.\n * * It is assumed b0 + b1 + b2 = 1.\n * @returns edge index i (opposite vertex i) for which b_i = 0, b_j > 0, and b_k > 0. Otherwise, returns -1.\n */\n private static isOnBoundedEdge(b0: number, b1: number, b2: number): number {\n if (b0 === 0 && b1 > 0 && b2 > 0)\n return 0;\n if (b0 > 0 && b1 === 0 && b2 > 0)\n return 1;\n if (b0 > 0 && b1 > 0 && b2 === 0)\n return 2;\n return -1;\n }\n /** @returns edge/vertex index (0,1,2) for which the function has a minimum value */\n private static indexOfMinimum(fn: (index: number) => number): number {\n let i = 0;\n let min = fn(0);\n const val = fn(1);\n if (min > val) {\n i = 1;\n min = val;\n }\n if (min > fn(2))\n i = 2;\n return i;\n }\n /**\n * Compute the squared distance between two points given by their barycentric coordinates.\n * * It is assumed that a0 + a1 + a2 = b0 + b1 + b2 = 1.\n */\n public distanceSquared(a0: number, a1: number, a2: number, b0: number, b1: number, b2: number): number {\n // The barycentric displacement vector distance formula\n // More details can be found at https://web.evanchen.cc/handouts/bary/bary-full.pdf\n return -this.edgeLengthSquared(0) * (b1 - a1) * (b2 - a2)\n - this.edgeLengthSquared(1) * (b2 - a2) * (b0 - a0)\n - this.edgeLengthSquared(2) * (b0 - a0) * (b1 - a1);\n }\n /** Return the index of the closest triangle vertex to the point given by its barycentric coordinates. */\n public closestVertexIndex(b0: number, b1: number, b2: number): number {\n return BarycentricTriangle.indexOfMinimum((i: number) => {\n const a = BarycentricTriangle._workPoint = Point3d.createZero(BarycentricTriangle._workPoint);\n a.setAt(i, 1.0); // \"a\" is (1,0,0) or (0,1,0) or (0,0,1) so \"a\" represents vertex i\n return this.distanceSquared(a.x, a.y, a.z, b0, b1, b2); // distance between the point and vertex i\n });\n }\n /** Compute dot product of the edge vectors based at the vertex with the given index. */\n public dotProductOfEdgeVectorsAtVertex(baseVertexIndex: number): number {\n const i = Geometry.cyclic3dAxis(baseVertexIndex);\n const j = Geometry.cyclic3dAxis(i + 1);\n const k = Geometry.cyclic3dAxis(j + 1);\n return Geometry.dotProductXYZXYZ(\n this.points[j].x - this.points[i].x, this.points[j].y - this.points[i].y, this.points[j].z - this.points[i].z,\n this.points[k].x - this.points[i].x, this.points[k].y - this.points[i].y, this.points[k].z - this.points[i].z,\n );\n }\n /**\n * Compute the projection of barycentric point p onto the (unbounded) edge e_k(v_i,v_j) of the triangle T(v_i,v_j,v_k).\n * @param k vertex v_k is opposite the edge e_k\n * @param b barycentric coordinates of point to project\n * @returns parameter f along e_k, such that:\n * * the projection point is q = v_i + f * (v_j - v_i)\n * * the barycentric coords of the projection are q_ijk = (1 - f, f, 0)\n */\n private computeProjectionToEdge(k: number, b: number[]): number {\n /**\n * We know p = (b_i*v_i) + (b_j*v_j) + (b_k*v_k) and 1 = b_i + b_j + b_k.\n * Let U = v_j - v_i and V = v_k - v_i and P = p - v_i.\n * First we prove P = b_jU + b_kV.\n * P = (b_i * v_i) + (b_j * v_j) + (b_k * v_k) - v_i\n * = (b_i * v_i) + (b_j * (v_j-v_i)) + (b_j * v_i) + (b_k * (v_k-v_i)) + (b_k * v_i) - v_i\n * = (b_i * v_i) + (b_j * U) + (b_j * v_i) + (b_k * V) + (b_k * v_i) - v_i\n * = (b_j * U) + (b_k * V) + ((b_i + b_j + b_k) * v_i) - v_i\n * = (b_j * U) + (b_k * V) + v_i - v_i\n * = (b_j * U) + (b_k * V)\n * So we know p - v_i = b_jU + b_kV and q - v_i = fU\n * Therefore, 0 = (p - q).(v_j - v_i)\n * = ((p-v_i) - (q-v_i)).(v_j - v_i)\n * = (b_jU + b_kV - fU).U\n * = b_jU.U + b_kU.V - fU.U\n * Thus f = b_j + b_k(U.V/U.U)\n */\n k = Geometry.cyclic3dAxis(k);\n const i = Geometry.cyclic3dAxis(k + 1);\n const j = Geometry.cyclic3dAxis(i + 1);\n return b[j] + b[k] * this.dotProductOfEdgeVectorsAtVertex(i) / this.edgeLengthSquared(k);\n }\n /**\n * Compute the projection of a barycentric point p to the triangle T(v_0,v_1,v_2).\n * @param b0 barycentric coordinate of p corresponding to v_0\n * @param b1 barycentric coordinate of p corresponding to v_1\n * @param b2 barycentric coordinate of p corresponding to v_2\n * @returns closest edge start vertex index i and projection parameter f such that the projection\n * q = v_i + f * (v_j - v_i).\n */\n public closestPoint(b0: number, b1: number, b2: number): { closestEdgeIndex: number, closestEdgeParam: number } {\n const b: number[] = [b0, b1, b2];\n let edgeIndex = -1; // opposite-vertex index\n let edgeParam = 0.0;\n if (BarycentricTriangle.isInsideTriangle(b0, b1, b2)) { // projects to any edge\n edgeIndex = BarycentricTriangle.indexOfMinimum((i: number) => {\n // We want smallest projection distance d_i of p to e_i.\n // Since b_i=d_i|e_i|/2A we can compare quantities b_i/|e_i|.\n return b[i] * b[i] / this.edgeLengthSquared(i); // avoid sqrt\n });\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondVertex(b0, b1, b2)) >= 0) { // projects to other edges, or any vertex\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n if (edgeParam < 0 || edgeParam > 1) {\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1);\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n if (edgeParam < 0 || edgeParam > 1) {\n edgeParam = 0.0;\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(this.closestVertexIndex(b0, b1, b2));\n }\n }\n } else if ((edgeIndex = BarycentricTriangle.isInRegionBeyondEdge(b0, b1, b2)) >= 0) { // projects to the edge or its vertices\n edgeParam = this.computeProjectionToEdge(edgeIndex, b);\n if (edgeParam < 0) {\n edgeParam = 0.0; // start of this edge\n } else if (edgeParam > 1) {\n edgeParam = 0.0;\n edgeIndex = Geometry.cyclic3dAxis(edgeIndex + 1); // end of this edge = start of next edge\n }\n } else if ((edgeIndex = BarycentricTriangle.isOnBoundedEdge(b0, b1, b2)) >= 0) {\n edgeParam = 1 - b[BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex)];\n } else if ((edgeIndex = BarycentricTriangle.isOnVertex(b0, b1, b2)) >= 0) {\n edgeParam = 0.0;\n edgeIndex = BarycentricTriangle.edgeStartVertexIndexToOppositeVertexIndex(edgeIndex);\n }\n // invalid edgeIndex shouldn't happen, but propagate it anyway\n assert(edgeIndex === 0 || edgeIndex === 1 || edgeIndex === 2);\n return {\n closestEdgeIndex: (edgeIndex < 0) ? -1 : BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(edgeIndex),\n closestEdgeParam: edgeParam,\n };\n }\n /**\n * Compute the intersection of a line (parameterized as a ray) with the plane of this triangle.\n * * Intersection data is returned for the line-plane intersection.\n * * No intersection is returned if the line is parallel to the plane.\n * * As for the *ray*, it intersects this triangle if and only if the returned detail `d` has\n * `d.isValid === true` and `d.a >= 0` and `d.isInsideOrOn === true`.\n * * This method is slower than `Ray3d.intersectionWithTriangle` but returns more information about the intersection.\n * @param ray infinite line to intersect, as a ray\n * @param result optional pre-allocated object to fill and return\n * @returns details `d` of the intersection point `p` of the line and the plane of this triangle:\n * * `d.isValid`: false if and only if `ray.direction` is parallel to the plane, or the ray or triangle is degenerate.\n * * `d.world`: coordinates of `p`.\n * * `d.local`: barycentric coordinates of `p`.\n * * `d.a`: the intersection parameter of `p` along the ray. Negative means `p` is behind the ray origin.\n * * `d.classify`: where `p` lies with respect to the triangle.\n * * `d.isInsideOrOn`: whether `p` is inside or on the triangle.\n * * `d.closestEdgeIndex`: the index of the triangle edge `e` onto which `p` projects.\n * * `d.closestEdgeParam`: the edge parameter at which `p` projects onto `e`.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/RayTriangleIntersection\n * @see [[pointToFraction]]\n */\n public intersectRay3d(ray: Ray3d, result?: TriangleLocationDetail): TriangleLocationDetail {\n result = TriangleLocationDetail.create(result);\n /**\n * Let r0 = ray.origin and d = ray.direction. Write intersection point p two ways for unknown scalars s,b0,b1,b2:\n * r0 + s*d = p = b0*v0 + b1*v1 + b2*v2\n * Subtract v0 from both ends, let u=v1-v0, v=v2-v0, c=r0-v0, and enforce b0+b1+b2=1:\n * b1*u + b2*v - s*d = c\n * This is a linear system Mx = c where M has columns u,v,d and solution x=(b1,b2,-s).\n */\n const r0 = ray.origin;\n const d = ray.direction;\n const u = BarycentricTriangle._workVector0 = Vector3d.createStartEnd(\n this.points[0], this.points[1], BarycentricTriangle._workVector0,\n );\n const v = BarycentricTriangle._workVector1 = Vector3d.createStartEnd(\n this.points[0], this.points[2], BarycentricTriangle._workVector1,\n );\n const scaledVolume = d.tripleProduct(u, v);\n if (scaledVolume * scaledVolume <= u.dotProduct(u) * v.dotProduct(v) * d.dotProduct(d) * Geometry.smallAngleRadiansSquared)\n return result; // parallel (no solution)\n const M = BarycentricTriangle._workMatrix = Matrix3d.createColumns(u, v, d, BarycentricTriangle._workMatrix);\n const c = Vector3d.createStartEnd(this.points[0], r0, BarycentricTriangle._workVector0); // reuse workVector0\n const solution = BarycentricTriangle._workVector1; // reuse workVector1\n if (undefined === M.multiplyInverse(c, solution))\n return result; // invalid\n result.a = -solution.z; // = -(-s) = s\n ray.fractionToPoint(result.a, result.world);\n result.local.set(1.0 - solution.x - solution.y, solution.x, solution.y); // = (1 - b1 - b2, b1, b2) = (b0 , b1, b2)\n const proj = this.closestPoint(result.local.x, result.local.y, result.local.z);\n result.closestEdgeIndex = proj.closestEdgeIndex;\n result.closestEdgeParam = proj.closestEdgeParam;\n return result;\n }\n /**\n * Compute the intersection of a line (parameterized as a line segment) with the plane of this triangle.\n * @param point0 start point of segment on line to intersect\n * @param point1 end point of segment on line to intersect\n * @param result optional pre-allocated object to fill and return\n * @returns details d of the line-plane intersection point `d.world`:\n * * `d.isValid` returns true if and only if the line intersects the plane.\n * * `d.classify` can be used to determine where the intersection lies with respect to the triangle.\n * * `d.a` is the intersection parameter. If `d.a` is in [0,1], the segment intersects the plane of the triangle.\n * @see [[intersectRay3d]]\n */\n public intersectSegment(point0: Point3d, point1: Point3d, result?: TriangleLocationDetail): TriangleLocationDetail {\n BarycentricTriangle._workRay = Ray3d.createStartEnd(point0, point1, BarycentricTriangle._workRay);\n return this.intersectRay3d(BarycentricTriangle._workRay, result);\n }\n /**\n * Adjust the location to the closest edge of the triangle if within either given tolerance.\n * @param location details of a point in the plane of the triangle (note that `location.local` and\n * `location.world` possibly updated to lie on the triangle closest edge)\n * @param distanceTolerance absolute distance tolerance (or zero to ignore)\n * @param parameterTolerance barycentric coordinate fractional tolerance (or zero to ignore)\n * @return whether the location was adjusted\n */\n public snapLocationToEdge(\n location: TriangleLocationDetail,\n distanceTolerance: number = Geometry.smallMetricDistance,\n parameterTolerance: number = Geometry.smallFloatingPoint,\n ): boolean {\n if (!location.isValid)\n return false;\n // first try parametric tol to zero barycentric coordinate (no vertices or world distances used!)\n if (parameterTolerance > 0.0) {\n let numSnapped = 0;\n let newSum = 0.0;\n for (let i = 0; i < 3; i++) {\n const barycentricDist = Math.abs(location.local.at(i));\n if (barycentricDist > 0.0 && barycentricDist < parameterTolerance) {\n location.local.setAt(i, 0.0);\n numSnapped++;\n }\n newSum += location.local.at(i);\n }\n if (numSnapped > 0 && newSum > 0.0) {\n location.local.scaleInPlace(1.0 / newSum);\n if (1 === numSnapped) {\n location.closestEdgeIndex = BarycentricTriangle.edgeOppositeVertexIndexToStartVertexIndex(\n BarycentricTriangle.isOnBoundedEdge(location.local.x, location.local.y, location.local.z),\n );\n location.closestEdgeParam = 1.0 - location.local.at(location.closestEdgeIndex);\n } else { // 2 snapped, at vertex\n location.closestEdgeIndex = BarycentricTriangle.isOnVertex(\n location.local.x, location.local.y, location.local.z,\n );\n location.closestEdgeParam = 0.0;\n }\n this.fractionToPoint(location.local.x, location.local.y, location.local.z, location.world);\n return true;\n }\n }\n // failing that, try distance tol to closest edge projection\n if (distanceTolerance > 0.0) {\n const i = location.closestEdgeIndex;\n const j = (i + 1) % 3;\n const k = (j + 1) % 3;\n const edgeProjection = BarycentricTriangle._workPoint = this.points[i].interpolate(\n location.closestEdgeParam, this.points[j], BarycentricTriangle._workPoint,\n );\n const dist = location.world.distance(edgeProjection);\n if (dist > 0.0 && dist < distanceTolerance) {\n location.local.setAt(i, 1.0 - location.closestEdgeParam);\n location.local.setAt(j, location.closestEdgeParam);\n location.local.setAt(k, 0.0);\n location.world.setFrom(edgeProjection);\n return true;\n }\n }\n return false;\n }\n /**\n * Return the dot product of the scaled normals of the two triangles.\n * * The sign of the return value is useful for determining the triangles' relative orientation:\n * positive (negative) means the normals point into the same (opposite) half-space determined by\n * one of the triangles' planes; zero means the triangles are perpendicular.\n */\n public dotProductOfCrossProductsFromOrigin(other: BarycentricTriangle): number {\n BarycentricTriangle._workVector0 = this.points[0].crossProductToPoints(\n this.points[1], this.points[2], BarycentricTriangle._workVector0,\n );\n BarycentricTriangle._workVector1 = other.points[0].crossProductToPoints(\n other.points[1], other.points[2], BarycentricTriangle._workVector1,\n );\n return BarycentricTriangle._workVector0.dotProduct(BarycentricTriangle._workVector1);\n }\n /** Return the centroid of the 3 points. */\n public centroid(result?: Point3d): Point3d {\n // Do the scale as true division (rather than multiply by precomputed 1/3). This might protect one bit of result.\n return Point3d.create(\n (this.points[0].x + this.points[1].x + this.points[2].x) / 3.0,\n (this.points[0].y + this.points[1].y + this.points[2].y) / 3.0,\n (this.points[0].z + this.points[1].z + this.points[2].z) / 3.0,\n result,\n );\n }\n /** Return the incenter of the triangle. */\n public incenter(result?: Point3d): Point3d {\n const a = this.edgeLength(0);\n const b = this.edgeLength(1);\n const c = this.edgeLength(2);\n const scale = Geometry.safeDivideFraction(1.0, a + b + c, 0.0);\n return this.fractionToPoint(scale * a, scale * b, scale * c, result);\n }\n /** Return the circumcenter of the triangle. */\n public circumcenter(result?: Point3d): Point3d {\n const a2 = this.edgeLengthSquared(0);\n const b2 = this.edgeLengthSquared(1);\n const c2 = this.edgeLengthSquared(2);\n const x = a2 * (b2 + c2 - a2);\n const y = b2 * (c2 + a2 - b2);\n const z = c2 * (a2 + b2 - c2);\n const scale = Geometry.safeDivideFraction(1.0, x + y + z, 0.0);\n return this.fractionToPoint(scale * x, scale * y, scale * z, result);\n }\n /** Test for point-by-point `isAlmostEqual` relationship. */\n public isAlmostEqual(other: BarycentricTriangle, tol?: number): boolean {\n return this.points[0].isAlmostEqual(other.points[0], tol)\n && this.points[1].isAlmostEqual(other.points[1], tol)\n && this.points[2].isAlmostEqual(other.points[2], tol);\n }\n}\n"]}
|
|
@@ -178,10 +178,10 @@ class FrameBuilder {
|
|
|
178
178
|
this.announcePoint(data.endPoint());
|
|
179
179
|
}
|
|
180
180
|
else if (data instanceof Arc3d_1.Arc3d) {
|
|
181
|
-
const
|
|
182
|
-
this.announcePoint(
|
|
183
|
-
this.announceVector(
|
|
184
|
-
this.announceVector(
|
|
181
|
+
const plane = data.fractionToPointAnd2Derivatives(0.0);
|
|
182
|
+
this.announcePoint(plane.origin);
|
|
183
|
+
this.announceVector(plane.vectorU);
|
|
184
|
+
this.announceVector(plane.vectorV);
|
|
185
185
|
}
|
|
186
186
|
else if (data instanceof LineString3d_1.LineString3d) {
|
|
187
187
|
for (const point of data.points) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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K,CAAC,eAAe,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;QACzH,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,GAAG,mBAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QAClG,OAAO,qBAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACjE,CAAC;CACF;AAxUD,oCAwUC","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\n// import { Point2d } from \"./Geometry2d\";\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { AxisOrder, AxisScaleSelect, Geometry } from \"../Geometry\";\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\nimport { Matrix3d } from \"./Matrix3d\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { Point3dArray } from \"./PointHelpers\";\nimport { PolygonOps } from \"./PolygonOps\";\nimport { Range3d } from \"./Range\";\nimport { Transform } from \"./Transform\";\n\n/**\n * Helper class to accumulate points and vectors until there is enough data to define a coordinate system.\n *\n * * For the common case of building a right handed frame:\n * * create the FrameBuilder and make calls to announcePoint and announceVector.\n * * the frame will be fully determined by an origin and two vectors.\n * * the first call to announcePoint will set the origin.\n * * additional calls to announcePoint will produce announceVector call with the vector from the origin.\n * * after each announcement, call getValidatedFrame(false)\n * * getValidatedFrame will succeed when it has two independent vectors.\n * * To build a left handed frame,\n * * an origin and 3 independent vectors are required.\n * * announce as above, but query with getValidatedFrame (true).\n * * this will use the third vector to select right or left handed frame.\n * @public\n */\nexport class FrameBuilder {\n private _origin: undefined | Point3d;\n private _vector0: undefined | Vector3d;\n private _vector1: undefined | Vector3d;\n private _vector2: undefined | Vector3d;\n private static _workMatrix?: Matrix3d;\n private static _workVector0?: Vector3d;\n private static _workVector1?: Vector3d;\n private static _workPoint?: Point3d;\n // test if both vectors are defined and have significant angle between.\n private areStronglyIndependentVectors(\n vector0: Vector3d, vector1: Vector3d, radiansTolerance: number = Geometry.smallAngleRadians,\n ): boolean {\n if (vector0 !== undefined && vector1 !== undefined) {\n const q = vector0.smallerUnorientedRadiansTo(vector1);\n return q > radiansTolerance;\n }\n return false;\n }\n /** Clear all accumulated point and vector data */\n public clear() {\n this._origin = undefined;\n this._vector0 = undefined;\n this._vector1 = undefined;\n this._vector2 = undefined;\n }\n constructor() {\n this.clear();\n }\n /**\n * Try to assemble the data into a non-singular transform.\n * * If allowLeftHanded is false, vector0 and vector1 determine a right handed coordinate system.\n * * if allowLeftHanded is true, the z vector of the right handed system can be flipped to agree with vector2 direction.\n */\n public getValidatedFrame(allowLeftHanded: boolean = false, result?: Transform): Transform | undefined {\n if (this._origin && this._vector0 && this._vector1) {\n const createRigidMatrix = (v0: Vector3d, v1: Vector3d): Matrix3d | undefined => {\n return FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(v0, v1, AxisOrder.XYZ, FrameBuilder._workMatrix);\n };\n if (!allowLeftHanded) {\n const matrix = createRigidMatrix(this._vector0, this._vector1);\n if (matrix)\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\n // uh oh -- vector1 was not really independent. clear everything after vector0.\n this._vector1 = this._vector2 = undefined;\n } else if (this._vector2) {\n const matrix = createRigidMatrix(this._vector0, this._vector1);\n if (matrix) {\n if (this._vector0.tripleProduct(this._vector1, this._vector2) < 0)\n matrix.scaleColumns(1.0, 1.0, -1.0);\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\n }\n // uh oh again -- clear vector1 and vector2, re-announce vector2 as possible vector1??\n const vector2 = this._vector2;\n this._vector1 = this._vector2 = undefined;\n this.announceVector(vector2);\n }\n }\n return undefined;\n }\n /** If vector0 is known but vector1 is not, make vector1 the cross of the up-vector and vector0 */\n public applyDefaultUpVector(vector?: Vector3d) {\n if (vector && this._vector0 && !this._vector1 && !vector.isParallelTo(this._vector0)) {\n this._vector1 = vector.crossProduct(this._vector0);\n }\n }\n /** Ask if there is a defined origin for the evolving frame */\n public get hasOrigin(): boolean {\n return this._origin !== undefined;\n }\n /**\n * Return the number of vectors saved. Because the save process checks numerics, this should be the rank of the system.\n */\n public savedVectorCount(): number {\n if (!this._vector0)\n return 0;\n if (!this._vector1)\n return 1;\n if (!this._vector2)\n return 2;\n return 3;\n }\n /**\n * Announce a new point. If this point is different from the origin, also compute and announce the vector from the origin.\n */\n public announcePoint(point: Point3d): number {\n if (!this._origin) {\n this._origin = point.clone();\n return this.savedVectorCount();\n }\n // the new point may provide an additional vector\n if (this._origin.isAlmostEqual(point))\n return this.savedVectorCount();\n return this.announceVector(this._origin.vectorTo(point));\n }\n /** Announce a new vector. */\n public announceVector(vector: Vector3d): number {\n if (vector.isAlmostZero)\n return this.savedVectorCount();\n if (!this._vector0) {\n this._vector0 = vector.clone(this._vector0);\n return 1;\n }\n if (!this._vector1) {\n if (this.areStronglyIndependentVectors(vector, this._vector0, 1.0e-5)) {\n this._vector1 = vector.clone(this._vector1);\n return 2;\n }\n return 1;\n }\n // vector0 and vector1 are independent.\n if (!this._vector2) {\n const unitPerpendicular = this._vector0.unitCrossProduct(this._vector1);\n if (unitPerpendicular && !Geometry.isSameCoordinate(0, unitPerpendicular.dotProduct(vector))) {\n this._vector2 = vector.clone(this._vector2);\n return 3;\n }\n return 2;\n }\n // fall through if prior vectors are all there -- no need for the new one.\n return 3;\n }\n /**\n * Inspect the content of the data. Announce points and vectors. Return when savedVectorCount becomes sufficient\n * for a coordinate system.\n */\n public announce(data: any) {\n if (this.savedVectorCount() > 1)\n return;\n if (data === undefined)\n return;\n if (data instanceof Point3d)\n this.announcePoint(data);\n else if (data instanceof Vector3d)\n this.announceVector(data);\n else if (Array.isArray(data)) {\n for (const child of data) {\n if (this.savedVectorCount() > 1)\n break;\n this.announce(child);\n }\n } else if (data instanceof CurvePrimitive) {\n if (data instanceof LineSegment3d) {\n this.announcePoint(data.startPoint());\n this.announcePoint(data.endPoint());\n } else if (data instanceof Arc3d) {\n const ray = data.fractionToPointAndDerivative(0.0);\n this.announcePoint(ray.origin);\n this.announceVector(ray.direction);\n this.announceVector(data.matrixRef.columnZCrossVector(ray.direction));\n } else if (data instanceof LineString3d) {\n for (const point of data.points) {\n this.announcePoint(point);\n if (this.savedVectorCount() > 1)\n break;\n }\n } else if (data instanceof BSplineCurve3d) {\n const point = Point3d.create();\n for (let i = 0; this.savedVectorCount() < 2; i++) {\n if (data.getPolePoint3d(i, point) instanceof Point3d)\n this.announcePoint(point);\n else break;\n }\n } else if (data instanceof InterpolationCurve3d) {\n const point = Point3d.create();\n for (let i = 0; this.savedVectorCount() < 2; i++) {\n if (i < data.options.fitPoints.length) {\n point.setFrom(data.options.fitPoints[i]);\n this.announcePoint(point);\n } else break;\n }\n } else { // unimplemented CurvePrimitive type\n const frame = data.fractionToFrenetFrame(0.0);\n if (undefined !== frame) {\n this.announcePoint(frame.getOrigin());\n this.announceVector(frame.matrix.getColumn(0));\n this.announceVector(frame.matrix.getColumn(1));\n }\n }\n } else if (data instanceof CurveCollection) {\n if (data.children)\n for (const child of data.children) {\n this.announce(child);\n if (this.savedVectorCount() > 1)\n break;\n }\n } else if (data instanceof GrowableXYZArray) {\n const point = Point3d.create();\n for (let i = 0; this.savedVectorCount() < 2; i++) {\n if (data.getPoint3dAtCheckedPointIndex(i, point) instanceof Point3d)\n this.announcePoint(point);\n else break;\n }\n } else if (data.hasOwnProperty(\"x\") && data.hasOwnProperty(\"y\") && data.hasOwnProperty(\"z\")) {\n this.announcePoint(Point3d.create(data.x, data.y, data.z));\n }\n }\n /**\n * Create a localToWorld frame for the given data.\n * * origin is at first point.\n * * x axis in direction of first nonzero vector present or implied by the input.\n * * y axis is perpendicular to x and contains (in positive side) the next vector present or implied by the input.\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\n * @param defaultUpVector optional vector to cross with vector0 to create vector1 when it is unknown.\n * The z-column of the returned frame points into the same halfspace as this vector.\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\n * @returns computed localToWorld frame, or undefined if insufficient data.\n */\n public static createRightHandedFrame(defaultUpVector: Vector3d | undefined, ...params: any[]): Transform | undefined {\n // if last arg is a Transform, remove it from the array and use for the return value\n let frame = (params.length > 0 && params[params.length - 1] instanceof Transform) ? params.pop() as Transform : undefined;\n const flipFrame = (f: Transform): Transform => {\n if (defaultUpVector && f.matrix.dotColumnZ(defaultUpVector) < 0.0)\n f.matrix.scaleColumnsInPlace(1, -1, -1);\n return f;\n };\n const builder = new FrameBuilder();\n for (const data of params) {\n builder.announce(data);\n builder.applyDefaultUpVector(defaultUpVector);\n if (frame = builder.getValidatedFrame(false, frame))\n return flipFrame(frame);\n }\n const evaluatePrimitiveFrame = (curve: CurvePrimitive, result?: Transform): Transform | undefined => {\n return curve.fractionToFrenetFrame(0.0, result);\n };\n // try direct evaluation of curve primitives using the above lambda\n for (const data of params) {\n if (data instanceof CurvePrimitive) {\n if (frame = evaluatePrimitiveFrame(data, frame))\n return flipFrame(frame);\n } else if (data instanceof CurveCollection) {\n const children = data.collectCurvePrimitives();\n for (const curve of children) {\n if (frame = evaluatePrimitiveFrame(curve, frame))\n return flipFrame(frame);\n }\n }\n }\n return undefined;\n }\n /**\n * Create a transform containing points or vectors in the given data.\n * * The xy columns of the transform contain the first points or vectors of the data.\n * * The z column is perpendicular to that xy plane.\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\n * @returns computed localToWorld frame, or undefined if insufficient data.\n */\n public static createRightHandedLocalToWorld(...params: any[]): Transform | undefined {\n return this.createRightHandedFrame(undefined, params);\n }\n\n /**\n * Try to create a frame whose xy plane is through points.\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\n * direction is toward the point most distant from that line.\n * @param points array of points\n * @param result optional pre-allocated Transform to populate and return\n * @returns localToWorld frame for the points, or undefined if insufficient data\n */\n public static createFrameToDistantPoints(points: Point3d[], result?: Transform): Transform | undefined {\n if (points.length > 2) {\n const origin = points[0];\n const vector01 = FrameBuilder._workVector0 ?? Vector3d.create();\n Point3dArray.indexOfMostDistantPoint(points, points[0], vector01);\n const vector02 = FrameBuilder._workVector1 ?? Vector3d.create();\n Point3dArray.indexOfPointWithMaxCrossProductMagnitude(points, origin, vector01, vector02);\n const matrix = FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(vector01, vector02, AxisOrder.XYZ, FrameBuilder._workMatrix);\n if (matrix)\n return Transform.createOriginAndMatrix(origin, matrix, result);\n }\n return undefined;\n }\n /**\n * Try to create a frame whose xy plane is through points, with the points appearing CCW in the local frame.\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\n * direction is toward the point most distant from that line.\n * @param points array of points\n * @param result optional pre-allocated Transform to populate and return\n * @returns localToWorld frame for the points, or undefined if insufficient data\n */\n public static createFrameWithCCWPolygon(points: Point3d[], result?: Transform): Transform | undefined {\n if (points.length > 2) {\n const ray = PolygonOps.centroidAreaNormal(points); // can't pass pre-allocated ray...\n if (ray)\n return ray.toRigidZFrame(result);\n }\n return undefined;\n }\n /**\n * Create the localToWorld transform from a range to axes of its parent coordinate system.\n * @param range range to inspect\n * @param scaleSelect selects size of localToWorld axes.\n * @param fractionX fractional coordinate of frame origin x\n * @param fractionY fractional coordinate of frame origin y\n * @param fractionZ fractional coordinate of frame origin z\n * @param defaultAxisLength if true and any axis length is 0, that axis vector takes this physical length.\n * @param result optional pre-allocated Transform to populate and return\n * @returns localToWorld frame for the range\n */\n public static createLocalToWorldTransformInRange(\n range: Range3d,\n scaleSelect: AxisScaleSelect = AxisScaleSelect.NonUniformRangeContainment,\n fractionX: number = 0,\n fractionY: number = 0,\n fractionZ: number = 0,\n defaultAxisLength: number = 1.0,\n result?: Transform,\n ): Transform {\n if (range.isNull)\n return Transform.createIdentity(result);\n let a = 1.0;\n let b = 1.0;\n let c = 1.0;\n if (scaleSelect === AxisScaleSelect.LongestRangeDirection) {\n a = b = c = Geometry.correctSmallMetricDistance(range.maxLength(), defaultAxisLength);\n } else if (scaleSelect === AxisScaleSelect.NonUniformRangeContainment) {\n a = Geometry.correctSmallMetricDistance(range.xLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionX, 0, 1);\n b = Geometry.correctSmallMetricDistance(range.yLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionY, 0, 1);\n c = Geometry.correctSmallMetricDistance(range.zLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionZ, 0, 1);\n }\n const origin = FrameBuilder._workPoint = range.fractionToPoint(fractionX, fractionY, fractionZ, FrameBuilder._workPoint);\n const matrix = FrameBuilder._workMatrix = Matrix3d.createScale(a, b, c, FrameBuilder._workMatrix);\n return Transform.createOriginAndMatrix(origin, matrix, result);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FrameBuilder.js","sourceRoot":"","sources":["../../../src/geometry3d/FrameBuilder.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAA0C;AAC1C,0DAAyD;AACzD,0EAAuE;AACvE,0CAAuC;AACvC,8DAA2D;AAC3D,4DAAyD;AACzD,0DAAuD;AACvD,wDAAqD;AACrD,0CAAmE;AACnE,yDAAsD;AACtD,yCAAsC;AACtC,uDAAsD;AACtD,iDAA8C;AAC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":["/*---------------------------------------------------------------------------------------------\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\n// import { Point2d } from \"./Geometry2d\";\nimport { BSplineCurve3d } from \"../bspline/BSplineCurve\";\nimport { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\nimport { Arc3d } from \"../curve/Arc3d\";\nimport { CurveCollection } from \"../curve/CurveCollection\";\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { LineSegment3d } from \"../curve/LineSegment3d\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { AxisOrder, AxisScaleSelect, Geometry } from \"../Geometry\";\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\nimport { Matrix3d } from \"./Matrix3d\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { Point3dArray } from \"./PointHelpers\";\nimport { PolygonOps } from \"./PolygonOps\";\nimport { Range3d } from \"./Range\";\nimport { Transform } from \"./Transform\";\n\n/**\n * Helper class to accumulate points and vectors until there is enough data to define a coordinate system.\n *\n * * For the common case of building a right handed frame:\n * * create the FrameBuilder and make calls to announcePoint and announceVector.\n * * the frame will be fully determined by an origin and two vectors.\n * * the first call to announcePoint will set the origin.\n * * additional calls to announcePoint will produce announceVector call with the vector from the origin.\n * * after each announcement, call getValidatedFrame(false)\n * * getValidatedFrame will succeed when it has two independent vectors.\n * * To build a left handed frame,\n * * an origin and 3 independent vectors are required.\n * * announce as above, but query with getValidatedFrame (true).\n * * this will use the third vector to select right or left handed frame.\n * @public\n */\nexport class FrameBuilder {\n private _origin: undefined | Point3d;\n private _vector0: undefined | Vector3d;\n private _vector1: undefined | Vector3d;\n private _vector2: undefined | Vector3d;\n private static _workMatrix?: Matrix3d;\n private static _workVector0?: Vector3d;\n private static _workVector1?: Vector3d;\n private static _workPoint?: Point3d;\n // test if both vectors are defined and have significant angle between.\n private areStronglyIndependentVectors(\n vector0: Vector3d, vector1: Vector3d, radiansTolerance: number = Geometry.smallAngleRadians,\n ): boolean {\n if (vector0 !== undefined && vector1 !== undefined) {\n const q = vector0.smallerUnorientedRadiansTo(vector1);\n return q > radiansTolerance;\n }\n return false;\n }\n /** Clear all accumulated point and vector data */\n public clear() {\n this._origin = undefined;\n this._vector0 = undefined;\n this._vector1 = undefined;\n this._vector2 = undefined;\n }\n constructor() {\n this.clear();\n }\n /**\n * Try to assemble the data into a non-singular transform.\n * * If allowLeftHanded is false, vector0 and vector1 determine a right handed coordinate system.\n * * if allowLeftHanded is true, the z vector of the right handed system can be flipped to agree with vector2 direction.\n */\n public getValidatedFrame(allowLeftHanded: boolean = false, result?: Transform): Transform | undefined {\n if (this._origin && this._vector0 && this._vector1) {\n const createRigidMatrix = (v0: Vector3d, v1: Vector3d): Matrix3d | undefined => {\n return FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(v0, v1, AxisOrder.XYZ, FrameBuilder._workMatrix);\n };\n if (!allowLeftHanded) {\n const matrix = createRigidMatrix(this._vector0, this._vector1);\n if (matrix)\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\n // uh oh -- vector1 was not really independent. clear everything after vector0.\n this._vector1 = this._vector2 = undefined;\n } else if (this._vector2) {\n const matrix = createRigidMatrix(this._vector0, this._vector1);\n if (matrix) {\n if (this._vector0.tripleProduct(this._vector1, this._vector2) < 0)\n matrix.scaleColumns(1.0, 1.0, -1.0);\n return Transform.createOriginAndMatrix(this._origin, matrix, result);\n }\n // uh oh again -- clear vector1 and vector2, re-announce vector2 as possible vector1??\n const vector2 = this._vector2;\n this._vector1 = this._vector2 = undefined;\n this.announceVector(vector2);\n }\n }\n return undefined;\n }\n /** If vector0 is known but vector1 is not, make vector1 the cross of the up-vector and vector0 */\n public applyDefaultUpVector(vector?: Vector3d) {\n if (vector && this._vector0 && !this._vector1 && !vector.isParallelTo(this._vector0)) {\n this._vector1 = vector.crossProduct(this._vector0);\n }\n }\n /** Ask if there is a defined origin for the evolving frame */\n public get hasOrigin(): boolean {\n return this._origin !== undefined;\n }\n /**\n * Return the number of vectors saved. Because the save process checks numerics, this should be the rank of the system.\n */\n public savedVectorCount(): number {\n if (!this._vector0)\n return 0;\n if (!this._vector1)\n return 1;\n if (!this._vector2)\n return 2;\n return 3;\n }\n /**\n * Announce a new point. If this point is different from the origin, also compute and announce the vector from the origin.\n */\n public announcePoint(point: Point3d): number {\n if (!this._origin) {\n this._origin = point.clone();\n return this.savedVectorCount();\n }\n // the new point may provide an additional vector\n if (this._origin.isAlmostEqual(point))\n return this.savedVectorCount();\n return this.announceVector(this._origin.vectorTo(point));\n }\n /** Announce a new vector. */\n public announceVector(vector: Vector3d): number {\n if (vector.isAlmostZero)\n return this.savedVectorCount();\n if (!this._vector0) {\n this._vector0 = vector.clone(this._vector0);\n return 1;\n }\n if (!this._vector1) {\n if (this.areStronglyIndependentVectors(vector, this._vector0, 1.0e-5)) {\n this._vector1 = vector.clone(this._vector1);\n return 2;\n }\n return 1;\n }\n // vector0 and vector1 are independent.\n if (!this._vector2) {\n const unitPerpendicular = this._vector0.unitCrossProduct(this._vector1);\n if (unitPerpendicular && !Geometry.isSameCoordinate(0, unitPerpendicular.dotProduct(vector))) {\n this._vector2 = vector.clone(this._vector2);\n return 3;\n }\n return 2;\n }\n // fall through if prior vectors are all there -- no need for the new one.\n return 3;\n }\n /**\n * Inspect the content of the data. Announce points and vectors. Return when savedVectorCount becomes sufficient\n * for a coordinate system.\n */\n public announce(data: any) {\n if (this.savedVectorCount() > 1)\n return;\n if (data === undefined)\n return;\n if (data instanceof Point3d)\n this.announcePoint(data);\n else if (data instanceof Vector3d)\n this.announceVector(data);\n else if (Array.isArray(data)) {\n for (const child of data) {\n if (this.savedVectorCount() > 1)\n break;\n this.announce(child);\n }\n } else if (data instanceof CurvePrimitive) {\n if (data instanceof LineSegment3d) {\n this.announcePoint(data.startPoint());\n this.announcePoint(data.endPoint());\n } else if (data instanceof Arc3d) {\n const plane = data.fractionToPointAnd2Derivatives(0.0);\n this.announcePoint(plane.origin);\n this.announceVector(plane.vectorU);\n this.announceVector(plane.vectorV);\n } else if (data instanceof LineString3d) {\n for (const point of data.points) {\n this.announcePoint(point);\n if (this.savedVectorCount() > 1)\n break;\n }\n } else if (data instanceof BSplineCurve3d) {\n const point = Point3d.create();\n for (let i = 0; this.savedVectorCount() < 2; i++) {\n if (data.getPolePoint3d(i, point) instanceof Point3d)\n this.announcePoint(point);\n else break;\n }\n } else if (data instanceof InterpolationCurve3d) {\n const point = Point3d.create();\n for (let i = 0; this.savedVectorCount() < 2; i++) {\n if (i < data.options.fitPoints.length) {\n point.setFrom(data.options.fitPoints[i]);\n this.announcePoint(point);\n } else break;\n }\n } else { // unimplemented CurvePrimitive type\n const frame = data.fractionToFrenetFrame(0.0);\n if (undefined !== frame) {\n this.announcePoint(frame.getOrigin());\n this.announceVector(frame.matrix.getColumn(0));\n this.announceVector(frame.matrix.getColumn(1));\n }\n }\n } else if (data instanceof CurveCollection) {\n if (data.children)\n for (const child of data.children) {\n this.announce(child);\n if (this.savedVectorCount() > 1)\n break;\n }\n } else if (data instanceof GrowableXYZArray) {\n const point = Point3d.create();\n for (let i = 0; this.savedVectorCount() < 2; i++) {\n if (data.getPoint3dAtCheckedPointIndex(i, point) instanceof Point3d)\n this.announcePoint(point);\n else break;\n }\n } else if (data.hasOwnProperty(\"x\") && data.hasOwnProperty(\"y\") && data.hasOwnProperty(\"z\")) {\n this.announcePoint(Point3d.create(data.x, data.y, data.z));\n }\n }\n /**\n * Create a localToWorld frame for the given data.\n * * origin is at first point.\n * * x axis in direction of first nonzero vector present or implied by the input.\n * * y axis is perpendicular to x and contains (in positive side) the next vector present or implied by the input.\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\n * @param defaultUpVector optional vector to cross with vector0 to create vector1 when it is unknown.\n * The z-column of the returned frame points into the same halfspace as this vector.\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\n * @returns computed localToWorld frame, or undefined if insufficient data.\n */\n public static createRightHandedFrame(defaultUpVector: Vector3d | undefined, ...params: any[]): Transform | undefined {\n // if last arg is a Transform, remove it from the array and use for the return value\n let frame = (params.length > 0 && params[params.length - 1] instanceof Transform) ? params.pop() as Transform : undefined;\n const flipFrame = (f: Transform): Transform => {\n if (defaultUpVector && f.matrix.dotColumnZ(defaultUpVector) < 0.0)\n f.matrix.scaleColumnsInPlace(1, -1, -1);\n return f;\n };\n const builder = new FrameBuilder();\n for (const data of params) {\n builder.announce(data);\n builder.applyDefaultUpVector(defaultUpVector);\n if (frame = builder.getValidatedFrame(false, frame))\n return flipFrame(frame);\n }\n const evaluatePrimitiveFrame = (curve: CurvePrimitive, result?: Transform): Transform | undefined => {\n return curve.fractionToFrenetFrame(0.0, result);\n };\n // try direct evaluation of curve primitives using the above lambda\n for (const data of params) {\n if (data instanceof CurvePrimitive) {\n if (frame = evaluatePrimitiveFrame(data, frame))\n return flipFrame(frame);\n } else if (data instanceof CurveCollection) {\n const children = data.collectCurvePrimitives();\n for (const curve of children) {\n if (frame = evaluatePrimitiveFrame(curve, frame))\n return flipFrame(frame);\n }\n }\n }\n return undefined;\n }\n /**\n * Create a transform containing points or vectors in the given data.\n * * The xy columns of the transform contain the first points or vectors of the data.\n * * The z column is perpendicular to that xy plane.\n * * The calculation favors the first points found. It does not try to get a \"best\" plane.\n * @param params any number of geometric objects to examine in [[announce]] for point/vector data sufficient to construct a frame.\n * If the last argument is a `Transform`, it is populated with the computed frame and returned.\n * @returns computed localToWorld frame, or undefined if insufficient data.\n */\n public static createRightHandedLocalToWorld(...params: any[]): Transform | undefined {\n return this.createRightHandedFrame(undefined, params);\n }\n\n /**\n * Try to create a frame whose xy plane is through points.\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\n * direction is toward the point most distant from that line.\n * @param points array of points\n * @param result optional pre-allocated Transform to populate and return\n * @returns localToWorld frame for the points, or undefined if insufficient data\n */\n public static createFrameToDistantPoints(points: Point3d[], result?: Transform): Transform | undefined {\n if (points.length > 2) {\n const origin = points[0];\n const vector01 = FrameBuilder._workVector0 ?? Vector3d.create();\n Point3dArray.indexOfMostDistantPoint(points, points[0], vector01);\n const vector02 = FrameBuilder._workVector1 ?? Vector3d.create();\n Point3dArray.indexOfPointWithMaxCrossProductMagnitude(points, origin, vector01, vector02);\n const matrix = FrameBuilder._workMatrix = Matrix3d.createRigidFromColumns(vector01, vector02, AxisOrder.XYZ, FrameBuilder._workMatrix);\n if (matrix)\n return Transform.createOriginAndMatrix(origin, matrix, result);\n }\n return undefined;\n }\n /**\n * Try to create a frame whose xy plane is through points, with the points appearing CCW in the local frame.\n * * If 3 or more distinct points are present, the x axis is from the first point to the most distant, and y\n * direction is toward the point most distant from that line.\n * @param points array of points\n * @param result optional pre-allocated Transform to populate and return\n * @returns localToWorld frame for the points, or undefined if insufficient data\n */\n public static createFrameWithCCWPolygon(points: Point3d[], result?: Transform): Transform | undefined {\n if (points.length > 2) {\n const ray = PolygonOps.centroidAreaNormal(points); // can't pass pre-allocated ray...\n if (ray)\n return ray.toRigidZFrame(result);\n }\n return undefined;\n }\n /**\n * Create the localToWorld transform from a range to axes of its parent coordinate system.\n * @param range range to inspect\n * @param scaleSelect selects size of localToWorld axes.\n * @param fractionX fractional coordinate of frame origin x\n * @param fractionY fractional coordinate of frame origin y\n * @param fractionZ fractional coordinate of frame origin z\n * @param defaultAxisLength if true and any axis length is 0, that axis vector takes this physical length.\n * @param result optional pre-allocated Transform to populate and return\n * @returns localToWorld frame for the range\n */\n public static createLocalToWorldTransformInRange(\n range: Range3d,\n scaleSelect: AxisScaleSelect = AxisScaleSelect.NonUniformRangeContainment,\n fractionX: number = 0,\n fractionY: number = 0,\n fractionZ: number = 0,\n defaultAxisLength: number = 1.0,\n result?: Transform,\n ): Transform {\n if (range.isNull)\n return Transform.createIdentity(result);\n let a = 1.0;\n let b = 1.0;\n let c = 1.0;\n if (scaleSelect === AxisScaleSelect.LongestRangeDirection) {\n a = b = c = Geometry.correctSmallMetricDistance(range.maxLength(), defaultAxisLength);\n } else if (scaleSelect === AxisScaleSelect.NonUniformRangeContainment) {\n a = Geometry.correctSmallMetricDistance(range.xLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionX, 0, 1);\n b = Geometry.correctSmallMetricDistance(range.yLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionY, 0, 1);\n c = Geometry.correctSmallMetricDistance(range.zLength(), defaultAxisLength) * Geometry.maxAbsDiff(fractionZ, 0, 1);\n }\n const origin = FrameBuilder._workPoint = range.fractionToPoint(fractionX, fractionY, fractionZ, FrameBuilder._workPoint);\n const matrix = FrameBuilder._workMatrix = Matrix3d.createScale(a, b, c, FrameBuilder._workMatrix);\n return Transform.createOriginAndMatrix(origin, matrix, result);\n }\n}\n"]}
|
|
@@ -144,5 +144,7 @@ export declare class GrowableFloat64Array {
|
|
|
144
144
|
* * this is done in the current order of the array.
|
|
145
145
|
*/
|
|
146
146
|
compressAdjacentDuplicates(tolerance?: number): void;
|
|
147
|
+
/** reverse the order of values. */
|
|
148
|
+
reverseInPlace(): void;
|
|
147
149
|
}
|
|
148
150
|
//# sourceMappingURL=GrowableFloat64Array.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrowableFloat64Array.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,GAAG,SAAS,CAAC;AAC5E;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;AACxH;;;;;;;;GAQG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,KAA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C,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAqD;IAapG;;;;;OAKG;IACI,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAa9C;;;OAGG;IACI,0BAA0B,CAAC,SAAS,GAAE,MAAY;IAmBzD,mCAAmC;IAC5B,cAAc;CAGtB"}
|
|
@@ -266,6 +266,10 @@ class GrowableFloat64Array {
|
|
|
266
266
|
}
|
|
267
267
|
this._inUse = numAccepted;
|
|
268
268
|
}
|
|
269
|
+
/** reverse the order of values. */
|
|
270
|
+
reverseInPlace() {
|
|
271
|
+
this._data.reverse();
|
|
272
|
+
}
|
|
269
273
|
}
|
|
270
274
|
exports.GrowableFloat64Array = GrowableFloat64Array;
|
|
271
275
|
//# sourceMappingURL=GrowableFloat64Array.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrowableFloat64Array.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAgB/F;;;;;;;;GAQG;AACH,MAAa,oBAAoB;IAK/B;;;OAGG;IACH,YAAY,kBAA0B,CAAC,EAAE,YAAqB;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,eAAe,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,KAAK,YAAY,IAAI,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC;IAChG,CAAC;IAED;;;;;OAKG;IACO,QAAQ,CAAC,MAA+B,EAAE,WAAoB,EAAE,UAAmB;QAC3F,IAAI,QAAQ,GAAG,UAAU,IAAI,CAAC,CAAC;QAC/B,IAAI,QAAQ,GAAG,CAAC;YACd,QAAQ,GAAG,CAAC,CAAC;QACf,IAAI,QAAQ,IAAI,IAAI,CAAC,K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CAAC;QACD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,0BAA0B,CAAC,YAAoB,GAAG;QACvD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC;YACT,OAAO;QAET,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC;QACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACZ,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;gBACxB,CAAC,GAAG,CAAC,CAAC;YACR,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;IAC5B,CAAC;CAEF;AAzQD,oDAyQC","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 ArraysAndInterfaces\n */\n\n/**\n * Type for a OptionalGrowableFloat64Array or undefined.\n * @public\n */\nexport type OptionalGrowableFloat64Array = GrowableFloat64Array | undefined;\n/**\n * Signature for a function which does lexical comparison of `blockSize` consecutive values as 2 starting indices.\n * @public\n */\nexport type BlockComparisonFunction = (data: Float64Array, blockSize: number, index0: number, index1: number) => number;\n/**\n * A `GrowableFloat64Array` is Float64Array accompanied by a count of how many of the array's entries are considered in use.\n * * In C++ terms, this is like an std::vector\n * * As entries are added to the array, the buffer is reallocated as needed to accommodate.\n * * The reallocations leave unused space to accept further additional entries without reallocation.\n * * The `length` property returns the number of entries in use.\n * * the `capacity` property returns the (usually larger) length of the (over-allocated) Float64Array.\n * @public\n */\nexport class GrowableFloat64Array {\n private _data: Float64Array;\n private _inUse: number;\n private _growthFactor: number;\n\n /** Construct a GrowableFloat64Array.\n * @param initialCapacity initial capacity (default 8)\n * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)\n */\n constructor(initialCapacity: number = 8, growthFactor?: number) {\n this._data = new Float64Array(initialCapacity);\n this._inUse = 0;\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\n }\n\n /** Copy data from source array. Does not reallocate or change active entry count.\n * @param source array to copy from\n * @param sourceCount copy the first sourceCount entries; all entries if undefined\n * @param destOffset copy to instance array starting at this index; zero if undefined\n * @return count and offset of entries copied\n */\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\n let myOffset = destOffset ?? 0;\n if (myOffset < 0)\n myOffset = 0;\n if (myOffset >= this._data.length)\n return {count: 0, offset: 0};\n let myCount = sourceCount ?? source.length;\n if (myCount > 0) {\n if (myCount > source.length)\n myCount = source.length;\n if (myOffset + myCount > this._data.length)\n myCount = this._data.length - myOffset;\n }\n if (myCount <= 0)\n return {count: 0, offset: 0};\n if (myCount === source.length)\n this._data.set(source, myOffset);\n else if (source instanceof Float64Array)\n this._data.set(source.subarray(0, myCount), myOffset);\n else\n this._data.set(source.slice(0, myCount), myOffset);\n return {count: myCount, offset: myOffset};\n }\n\n /**\n * Create a GrowableFloat64Array with given contents.\n * @param contents data to copy into the array\n */\n public static create(contents: Float64Array | number[]): GrowableFloat64Array {\n const out = new GrowableFloat64Array(contents.length);\n out.copyData(contents);\n out._inUse = contents.length;\n return out;\n }\n /** sort-compatible comparison.\n * * Returns `(a-b)` which is\n * * negative if `a<b`\n * * zero if `a === b` (with exact equality)\n * * positive if `a>b`\n */\n public static compare(a: any, b: any): number {\n return a - b;\n }\n /** Return a new array with\n * * All active entries copied from this instance\n * * optionally trimmed capacity to the active length or replicate the capacity and unused space.\n */\n public clone(maintainExcessCapacity: boolean = false): GrowableFloat64Array {\n const out = new GrowableFloat64Array(maintainExcessCapacity ? this.capacity() : this._inUse);\n out.copyData(this._data, this._inUse);\n out._inUse = this._inUse;\n return out;\n }\n /**\n * Returns the number of entries in use.\n * * Note that this is typically smaller than the length of the length of the supporting `Float64Array`\n */\n public get length() {\n return this._inUse;\n }\n /**\n * Set the value at specified index.\n * @param index index of entry to set\n * @param value value to set\n */\n public setAtUncheckedIndex(index: number, value: number) {\n this._data[index] = value;\n }\n\n /**\n * Move the value at index i to index j.\n * @param i source index\n * @param j destination index.\n */\n public move(i: number, j: number) {\n this._data[j] = this._data[i];\n }\n /**\n * swap the values at indices i and j\n * @param i first index\n * @param j second index\n */\n public swap(i: number, j: number) {\n const a = this._data[i];\n this._data[i] = this._data[j];\n this._data[j] = a;\n }\n\n /**\n * append a single value to the array.\n * @param toPush value to append to the active array.\n */\n public push(toPush: number) {\n this.ensureCapacity(this._inUse + 1);\n this._data[this._inUse] = toPush;\n this._inUse++;\n }\n /**\n * Push each value from an array.\n * @param data array of values to push\n */\n public pushArray(data: Float64Array | number[]) {\n this.ensureCapacity(this._inUse + data.length);\n this.copyData(data, data.length, this._inUse);\n this._inUse += data.length;\n }\n /** Push `numToCopy` consecutive values starting at `copyFromIndex`. */\n public pushBlockCopy(copyFromIndex: number, numToCopy: number) {\n if (copyFromIndex >= 0 && copyFromIndex < this._inUse && numToCopy > 0 && copyFromIndex + numToCopy <= this._inUse) {\n this.ensureCapacity(this._inUse + numToCopy);\n this._data.copyWithin(this._inUse, copyFromIndex, copyFromIndex + numToCopy);\n this._inUse += numToCopy;\n }\n }\n /** Clear the array to 0 length. The underlying memory remains allocated for reuse. */\n public clear() {\n this._inUse = 0;\n }\n /**\n * Returns the number of entries in the supporting Float64Array buffer.\n * * This number can be larger than the `length` property.\n */\n public capacity() {\n return this._data.length;\n }\n /**\n * * If the capacity (Float64Array length) is less than or equal to the requested newCapacity, do nothing.\n * * If the requested newCapacity is larger than the existing capacity, reallocate to larger capacity, and copy existing values.\n * @param newCapacity size of new array\n * @param applyGrowthFactor whether to apply the growth factor to newCapacity when reallocating\n */\n public ensureCapacity(newCapacity: number, applyGrowthFactor: boolean = true) {\n if (newCapacity > this.capacity()) {\n if (applyGrowthFactor)\n newCapacity *= this._growthFactor;\n const prevData = this._data;\n this._data = new Float64Array(newCapacity);\n this.copyData(prevData, this._inUse);\n }\n }\n /**\n * * If newLength is less than current length, just reset current length to newLength, effectively trimming active entries but preserving original capacity.\n * * If newLength is greater than current length, reallocate to (exactly) newLength, copy existing entries, and pad with padValue up to newLength.\n * @param newLength new data count\n * @param padValue value to use for padding if the length increases.\n */\n public resize(newLength: number, padValue: number = 0) {\n if (newLength >= 0 && newLength < this._inUse)\n this._inUse = newLength;\n else if (newLength > this._inUse) {\n this.ensureCapacity(newLength, false);\n this._data.fill(padValue, this._inUse);\n this._inUse = newLength;\n }\n }\n /**\n * * Reduce the length by one.\n * * Note that there is no method return value -- use `back` to get that value before `pop()`\n * * (As with std::vector, separating the `pop` from the value access eliminates error testing from `pop` call)\n */\n public pop() {\n // Could technically access outside of array, if filled and then reduced using pop (similar to C\n // and accessing out of bounds), but with adjusted inUse counter, that data will eventually be overwritten\n if (this._inUse > 0) {\n this._inUse--;\n }\n }\n /** Access by index, without bounds check */\n public atUncheckedIndex(index: number): number {\n return this._data[index];\n }\n /** Access the 0-index member, without bounds check */\n public front() {\n return this._data[0];\n }\n /** Access the final member, without bounds check */\n public back() {\n return this._data[this._inUse - 1];\n }\n /** set a value by index */\n public reassign(index: number, value: number) {\n this._data[index] = value;\n }\n\n /**\n * * Sort the array entries.\n * * Uses insertion sort -- fine for small arrays (less than 30), slow for larger arrays\n * @param compareMethod comparison method\n */\n public sort(compareMethod: (a: any, b: any) => number = (a, b) => GrowableFloat64Array.compare(a, b)) {\n for (let i = 0; i < this._inUse; i++) {\n for (let j = i + 1; j < this._inUse; j++) {\n const tempI = this._data[i];\n const tempJ = this._data[j];\n if (compareMethod(tempI, tempJ) > 0) {\n this._data[i] = tempJ;\n this._data[j] = tempI;\n }\n }\n }\n }\n\n /**\n * * compress out values not within the [a,b] interval.\n * * Note that if a is greater than b all values are rejected.\n * @param a low value for accepted interval\n * @param b high value for accepted interval\n */\n public restrictToInterval(a: number, b: number) {\n const data = this._data;\n const n = data.length;\n let numAccept = 0;\n let q = 0;\n for (let i = 0; i < n; i++) {\n q = data[i];\n if (q >= a && q <= b)\n data[numAccept++] = q;\n }\n this._inUse = numAccept;\n }\n\n /**\n * * compress out multiple copies of values.\n * * this is done in the current order of the array.\n */\n public compressAdjacentDuplicates(tolerance: number = 0.0) {\n const data = this._data;\n const n = this._inUse;\n if (n === 0)\n return;\n\n let numAccepted = 1;\n let a = data[0];\n let b;\n for (let i = 1; i < n; i++) {\n b = data[i];\n if (Math.abs(b - a) > tolerance) {\n data[numAccepted++] = b;\n a = b;\n }\n }\n this._inUse = numAccepted;\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GrowableFloat64Array.js","sourceRoot":"","sources":["../../../src/geometry3d/GrowableFloat64Array.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAgB/F;;;;;;;;GAQG;AACH,MAAa,oBAAoB;IAK/B;;;OAGG;IACH,YAAY,kBAA0B,CAAC,EAAE,YAAqB;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,eAAe,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,aAAa,GAAG,CAAC,SAAS,KAAK,YAAY,IAAI,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC;IAChG,CAAC;IAED;;;;;OAKG;IACO,QAAQ,CAAC,MAA+B,EAAE,WAAoB,EAAE,UAAmB;Q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G,IAAI,CAAC,CAAC,CAAC,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAClB,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,0BAA0B,CAAC,YAAoB,GAAG;QACvD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC;YACT,OAAO;QAET,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,CAAC;QACN,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACZ,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC;gBAChC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC;gBACxB,CAAC,GAAG,CAAC,CAAC;YACR,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;IAC5B,CAAC;IAED,mCAAmC;IAC5B,cAAc;QACnB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;CACF;AA7QD,oDA6QC","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 ArraysAndInterfaces\n */\n\n/**\n * Type for a OptionalGrowableFloat64Array or undefined.\n * @public\n */\nexport type OptionalGrowableFloat64Array = GrowableFloat64Array | undefined;\n/**\n * Signature for a function which does lexical comparison of `blockSize` consecutive values as 2 starting indices.\n * @public\n */\nexport type BlockComparisonFunction = (data: Float64Array, blockSize: number, index0: number, index1: number) => number;\n/**\n * A `GrowableFloat64Array` is Float64Array accompanied by a count of how many of the array's entries are considered in use.\n * * In C++ terms, this is like an std::vector\n * * As entries are added to the array, the buffer is reallocated as needed to accommodate.\n * * The reallocations leave unused space to accept further additional entries without reallocation.\n * * The `length` property returns the number of entries in use.\n * * the `capacity` property returns the (usually larger) length of the (over-allocated) Float64Array.\n * @public\n */\nexport class GrowableFloat64Array {\n private _data: Float64Array;\n private _inUse: number;\n private _growthFactor: number;\n\n /** Construct a GrowableFloat64Array.\n * @param initialCapacity initial capacity (default 8)\n * @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)\n */\n constructor(initialCapacity: number = 8, growthFactor?: number) {\n this._data = new Float64Array(initialCapacity);\n this._inUse = 0;\n this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;\n }\n\n /** Copy data from source array. Does not reallocate or change active entry count.\n * @param source array to copy from\n * @param sourceCount copy the first sourceCount entries; all entries if undefined\n * @param destOffset copy to instance array starting at this index; zero if undefined\n * @return count and offset of entries copied\n */\n protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {count: number, offset: number} {\n let myOffset = destOffset ?? 0;\n if (myOffset < 0)\n myOffset = 0;\n if (myOffset >= this._data.length)\n return {count: 0, offset: 0};\n let myCount = sourceCount ?? source.length;\n if (myCount > 0) {\n if (myCount > source.length)\n myCount = source.length;\n if (myOffset + myCount > this._data.length)\n myCount = this._data.length - myOffset;\n }\n if (myCount <= 0)\n return {count: 0, offset: 0};\n if (myCount === source.length)\n this._data.set(source, myOffset);\n else if (source instanceof Float64Array)\n this._data.set(source.subarray(0, myCount), myOffset);\n else\n this._data.set(source.slice(0, myCount), myOffset);\n return {count: myCount, offset: myOffset};\n }\n\n /**\n * Create a GrowableFloat64Array with given contents.\n * @param contents data to copy into the array\n */\n public static create(contents: Float64Array | number[]): GrowableFloat64Array {\n const out = new GrowableFloat64Array(contents.length);\n out.copyData(contents);\n out._inUse = contents.length;\n return out;\n }\n /** sort-compatible comparison.\n * * Returns `(a-b)` which is\n * * negative if `a<b`\n * * zero if `a === b` (with exact equality)\n * * positive if `a>b`\n */\n public static compare(a: any, b: any): number {\n return a - b;\n }\n /** Return a new array with\n * * All active entries copied from this instance\n * * optionally trimmed capacity to the active length or replicate the capacity and unused space.\n */\n public clone(maintainExcessCapacity: boolean = false): GrowableFloat64Array {\n const out = new GrowableFloat64Array(maintainExcessCapacity ? this.capacity() : this._inUse);\n out.copyData(this._data, this._inUse);\n out._inUse = this._inUse;\n return out;\n }\n /**\n * Returns the number of entries in use.\n * * Note that this is typically smaller than the length of the length of the supporting `Float64Array`\n */\n public get length() {\n return this._inUse;\n }\n /**\n * Set the value at specified index.\n * @param index index of entry to set\n * @param value value to set\n */\n public setAtUncheckedIndex(index: number, value: number) {\n this._data[index] = value;\n }\n\n /**\n * Move the value at index i to index j.\n * @param i source index\n * @param j destination index.\n */\n public move(i: number, j: number) {\n this._data[j] = this._data[i];\n }\n /**\n * swap the values at indices i and j\n * @param i first index\n * @param j second index\n */\n public swap(i: number, j: number) {\n const a = this._data[i];\n this._data[i] = this._data[j];\n this._data[j] = a;\n }\n\n /**\n * append a single value to the array.\n * @param toPush value to append to the active array.\n */\n public push(toPush: number) {\n this.ensureCapacity(this._inUse + 1);\n this._data[this._inUse] = toPush;\n this._inUse++;\n }\n /**\n * Push each value from an array.\n * @param data array of values to push\n */\n public pushArray(data: Float64Array | number[]) {\n this.ensureCapacity(this._inUse + data.length);\n this.copyData(data, data.length, this._inUse);\n this._inUse += data.length;\n }\n /** Push `numToCopy` consecutive values starting at `copyFromIndex`. */\n public pushBlockCopy(copyFromIndex: number, numToCopy: number) {\n if (copyFromIndex >= 0 && copyFromIndex < this._inUse && numToCopy > 0 && copyFromIndex + numToCopy <= this._inUse) {\n this.ensureCapacity(this._inUse + numToCopy);\n this._data.copyWithin(this._inUse, copyFromIndex, copyFromIndex + numToCopy);\n this._inUse += numToCopy;\n }\n }\n /** Clear the array to 0 length. The underlying memory remains allocated for reuse. */\n public clear() {\n this._inUse = 0;\n }\n /**\n * Returns the number of entries in the supporting Float64Array buffer.\n * * This number can be larger than the `length` property.\n */\n public capacity() {\n return this._data.length;\n }\n /**\n * * If the capacity (Float64Array length) is less than or equal to the requested newCapacity, do nothing.\n * * If the requested newCapacity is larger than the existing capacity, reallocate to larger capacity, and copy existing values.\n * @param newCapacity size of new array\n * @param applyGrowthFactor whether to apply the growth factor to newCapacity when reallocating\n */\n public ensureCapacity(newCapacity: number, applyGrowthFactor: boolean = true) {\n if (newCapacity > this.capacity()) {\n if (applyGrowthFactor)\n newCapacity *= this._growthFactor;\n const prevData = this._data;\n this._data = new Float64Array(newCapacity);\n this.copyData(prevData, this._inUse);\n }\n }\n /**\n * * If newLength is less than current length, just reset current length to newLength, effectively trimming active entries but preserving original capacity.\n * * If newLength is greater than current length, reallocate to (exactly) newLength, copy existing entries, and pad with padValue up to newLength.\n * @param newLength new data count\n * @param padValue value to use for padding if the length increases.\n */\n public resize(newLength: number, padValue: number = 0) {\n if (newLength >= 0 && newLength < this._inUse)\n this._inUse = newLength;\n else if (newLength > this._inUse) {\n this.ensureCapacity(newLength, false);\n this._data.fill(padValue, this._inUse);\n this._inUse = newLength;\n }\n }\n /**\n * * Reduce the length by one.\n * * Note that there is no method return value -- use `back` to get that value before `pop()`\n * * (As with std::vector, separating the `pop` from the value access eliminates error testing from `pop` call)\n */\n public pop() {\n // Could technically access outside of array, if filled and then reduced using pop (similar to C\n // and accessing out of bounds), but with adjusted inUse counter, that data will eventually be overwritten\n if (this._inUse > 0) {\n this._inUse--;\n }\n }\n /** Access by index, without bounds check */\n public atUncheckedIndex(index: number): number {\n return this._data[index];\n }\n /** Access the 0-index member, without bounds check */\n public front() {\n return this._data[0];\n }\n /** Access the final member, without bounds check */\n public back() {\n return this._data[this._inUse - 1];\n }\n /** set a value by index */\n public reassign(index: number, value: number) {\n this._data[index] = value;\n }\n\n /**\n * * Sort the array entries.\n * * Uses insertion sort -- fine for small arrays (less than 30), slow for larger arrays\n * @param compareMethod comparison method\n */\n public sort(compareMethod: (a: any, b: any) => number = (a, b) => GrowableFloat64Array.compare(a, b)) {\n for (let i = 0; i < this._inUse; i++) {\n for (let j = i + 1; j < this._inUse; j++) {\n const tempI = this._data[i];\n const tempJ = this._data[j];\n if (compareMethod(tempI, tempJ) > 0) {\n this._data[i] = tempJ;\n this._data[j] = tempI;\n }\n }\n }\n }\n\n /**\n * * compress out values not within the [a,b] interval.\n * * Note that if a is greater than b all values are rejected.\n * @param a low value for accepted interval\n * @param b high value for accepted interval\n */\n public restrictToInterval(a: number, b: number) {\n const data = this._data;\n const n = data.length;\n let numAccept = 0;\n let q = 0;\n for (let i = 0; i < n; i++) {\n q = data[i];\n if (q >= a && q <= b)\n data[numAccept++] = q;\n }\n this._inUse = numAccept;\n }\n\n /**\n * * compress out multiple copies of values.\n * * this is done in the current order of the array.\n */\n public compressAdjacentDuplicates(tolerance: number = 0.0) {\n const data = this._data;\n const n = this._inUse;\n if (n === 0)\n return;\n\n let numAccepted = 1;\n let a = data[0];\n let b;\n for (let i = 1; i < n; i++) {\n b = data[i];\n if (Math.abs(b - a) > tolerance) {\n data[numAccepted++] = b;\n a = b;\n }\n }\n this._inUse = numAccepted;\n }\n\n /** reverse the order of values. */\n public reverseInPlace() {\n this._data.reverse();\n }\n}\n"]}
|