@itwin/core-geometry 5.4.0-dev.6 → 5.4.0-dev.7
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 +13 -1
- package/lib/cjs/Constant.js.map +1 -1
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
- package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
- package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
- package/lib/cjs/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/cjs/clipping/BooleanClipNode.js.map +1 -1
- package/lib/cjs/clipping/ClipPlane.js.map +1 -1
- package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
- package/lib/cjs/clipping/ClipUtils.js.map +1 -1
- package/lib/cjs/clipping/ClipVector.js.map +1 -1
- package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/cjs/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.js.map +1 -1
- package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
- package/lib/cjs/curve/CurveOps.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/CurveProcessor.js.map +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/OffsetOptions.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/PointString3d.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
- package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
- package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Ray2d.js.map +1 -1
- package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
- package/lib/cjs/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/cjs/geometry3d/Segment1d.js.map +1 -1
- package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/cjs/geometry3d/XYZProps.js.map +1 -1
- package/lib/cjs/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/cjs/geometry4d/Map4d.js.map +1 -1
- package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
- package/lib/cjs/geometry4d/MomentData.js.map +1 -1
- package/lib/cjs/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- package/lib/cjs/geometry4d/Point4d.js.map +1 -1
- package/lib/cjs/numerics/BandedSystem.js.map +1 -1
- package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
- package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
- package/lib/cjs/numerics/Complex.js.map +1 -1
- package/lib/cjs/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
- package/lib/cjs/numerics/PolarData.js.map +1 -1
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/numerics/Range1dArray.js.map +1 -1
- package/lib/cjs/numerics/SmallSystem.js.map +1 -1
- package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/cjs/numerics/UnionFind.js.map +1 -1
- package/lib/cjs/numerics/UsageSums.js.map +1 -1
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/BoxTopology.js.map +1 -1
- package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
- package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
- package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
- package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/cjs/serialization/DeepCompare.js.map +1 -1
- package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/solid/Cone.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/cjs/topology/MaskManager.js.map +1 -1
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
- package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/cjs/topology/Voronoi.js.map +1 -1
- package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
- package/lib/esm/Constant.js.map +1 -1
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/AkimaCurve3d.js.map +1 -1
- package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
- package/lib/esm/bspline/BSplineSurface.js.map +1 -1
- package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
- package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
- package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
- package/lib/esm/bspline/InterpolationCurve3d.js.map +1 -1
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
- package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
- package/lib/esm/clipping/BooleanClipFactory.js.map +1 -1
- package/lib/esm/clipping/BooleanClipNode.js.map +1 -1
- package/lib/esm/clipping/ClipPlane.js.map +1 -1
- package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
- package/lib/esm/clipping/ClipUtils.js.map +1 -1
- package/lib/esm/clipping/ClipVector.js.map +1 -1
- package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
- package/lib/esm/clipping/UnionOfConvexClipPlaneSets.js.map +1 -1
- package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveExtendMode.js.map +1 -1
- package/lib/esm/curve/CurveFactory.js.map +1 -1
- package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
- package/lib/esm/curve/CurveOps.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/CurveProcessor.js.map +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/OffsetOptions.js.map +1 -1
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/PointString3d.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/Query/InOutTests.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
- package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/esm/geometry3d/Plane3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
- package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
- package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
- package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Ray2d.js.map +1 -1
- package/lib/esm/geometry3d/Ray3d.js.map +1 -1
- package/lib/esm/geometry3d/ReusableObjectCache.js.map +1 -1
- package/lib/esm/geometry3d/Segment1d.js.map +1 -1
- package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/geometry3d/UVSurfaceOps.js.map +1 -1
- package/lib/esm/geometry3d/XYZProps.js.map +1 -1
- package/lib/esm/geometry3d/YawPitchRollAngles.js.map +1 -1
- package/lib/esm/geometry4d/Map4d.js.map +1 -1
- package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
- package/lib/esm/geometry4d/MomentData.js.map +1 -1
- package/lib/esm/geometry4d/PlaneByOriginAndVectors4d.js.map +1 -1
- package/lib/esm/geometry4d/Point4d.js.map +1 -1
- package/lib/esm/numerics/BandedSystem.js.map +1 -1
- package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
- package/lib/esm/numerics/ClusterableArray.js.map +1 -1
- package/lib/esm/numerics/Complex.js.map +1 -1
- package/lib/esm/numerics/ConvexPolygon2d.js.map +1 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
- package/lib/esm/numerics/PolarData.js.map +1 -1
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/numerics/Range1dArray.js.map +1 -1
- package/lib/esm/numerics/SmallSystem.js.map +1 -1
- package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/esm/numerics/UnionFind.js.map +1 -1
- package/lib/esm/numerics/UsageSums.js.map +1 -1
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/BoxTopology.js.map +1 -1
- package/lib/esm/polyface/FacetFaceData.js.map +1 -1
- package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/esm/polyface/FacetOrientation.js.map +1 -1
- package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/RangeLengthData.js.map +1 -1
- package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
- package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/esm/serialization/DeepCompare.js.map +1 -1
- package/lib/esm/serialization/GeometrySamples.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/solid/Cone.js.map +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SolidPrimitive.js.map +1 -1
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/esm/topology/MaskManager.js.map +1 -1
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/SignedDataSummary.js.map +1 -1
- package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/lib/esm/topology/Voronoi.js.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ray2d.js","sourceRoot":"","sources":["../../../src/geometry3d/Ray2d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAA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CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7F,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,2EAA2E;IACpE,kBAAkB,CAAC,KAAY;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpF,CAAC;IACD,yFAAyF;IAClF,+BAA+B,CAAC,KAAY;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;QAC9C,oDAAoD;QACpD,OAAO,QAAQ,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IACD,uDAAuD;IAChD,eAAe,CAAC,CAAS,EAAE,MAAgB;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Point2d, Vector2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Range1d, Range2d } from \"./Range\";\r\nimport { XAndY } from \"./XYZProps\";\r\n\r\n/**\r\n * Ray with xy origin and direction\r\n * @public\r\n */\r\nexport class Ray2d {\r\n private _origin: Point2d;\r\n private _direction: Vector2d;\r\n\r\n private constructor(origin: Point2d, direction: Vector2d) {\r\n this._origin = origin;\r\n this._direction = direction;\r\n }\r\n /** Copy coordinates from origin and direction. */\r\n public set(origin: XAndY, direction: XAndY): void {\r\n this._origin.setFrom(origin);\r\n this._direction.setFrom(direction);\r\n }\r\n /** Create a ray with all zeros. */\r\n public static createZero(result?: Ray2d): Ray2d {\r\n if (result) {\r\n result.origin.setZero();\r\n result.direction.setZero();\r\n return result;\r\n }\r\n return new Ray2d(Point2d.createZero(), Vector2d.createZero());\r\n }\r\n /**\r\n * Create from `origin` and `target` points.\r\n * @param origin ray origin, cloned\r\n * @param target end of ray direction vector. The direction vector is `target - origin`.\r\n * @param result optional pre-allocated object to return\r\n */\r\n public static createOriginAndTarget(origin: XAndY, target: XAndY, result?: Ray2d): Ray2d {\r\n if (result) {\r\n result._origin.setFrom(origin);\r\n result._direction.set(target.x - origin.x, target.y - origin.y);\r\n return result;\r\n }\r\n return new Ray2d(Point2d.createFrom(origin), Vector2d.createStartEnd(origin, target));\r\n }\r\n /**\r\n * Create by copying coordinates from `origin` and `direction`.\r\n * @param origin ray origin\r\n * @param direction ray direction\r\n * @param result optional pre-allocated object to return\r\n */\r\n public static createOriginAndDirection(origin: XAndY, direction: XAndY, result?: Ray2d): Ray2d {\r\n if (result) {\r\n result.set(origin, direction);\r\n return result;\r\n }\r\n return new Ray2d(Point2d.createFrom(origin), Vector2d.createFrom(direction));\r\n }\r\n /** Create from captured `origin` and `direction`. */\r\n public static createOriginAndDirectionCapture(origin: Point2d, direction: Vector2d, result?: Ray2d): Ray2d {\r\n if (result) {\r\n result._origin = origin;\r\n result._direction = direction;\r\n return result;\r\n }\r\n return new Ray2d(origin, direction);\r\n }\r\n /** Get the reference to the ray origin. */\r\n public get origin() { return this._origin; }\r\n /** Get the reference to the ray direction. */\r\n public get direction() { return this._direction; }\r\n /**\r\n * Return a parallel ray to the left of this ray.\r\n * @param leftFraction distance between rays, as a fraction of the magnitude of this ray's direction vector\r\n */\r\n public parallelRay(leftFraction: number, result?: Ray2d): Ray2d {\r\n if (result) {\r\n this._origin.addForwardLeft(0.0, leftFraction, this._direction, result._origin);\r\n result._direction.setFrom(this._direction);\r\n return result;\r\n }\r\n return new Ray2d(this._origin.addForwardLeft(0.0, leftFraction, this._direction), this._direction.clone());\r\n }\r\n /** Return a ray with cloned origin and with direction rotated 90 degrees counterclockwise */\r\n public ccwPerpendicularRay(result?: Ray2d): Ray2d {\r\n if (result) {\r\n result._origin.setFrom(this._origin);\r\n this._direction.rotate90CCWXY(result._direction);\r\n return result;\r\n }\r\n return new Ray2d(this._origin.clone(), this._direction.rotate90CCWXY());\r\n }\r\n /** Return a ray with cloned origin and with direction rotated 90 degrees clockwise */\r\n public cwPerpendicularRay(result?: Ray2d): Ray2d {\r\n if (result) {\r\n result._origin.setFrom(this._origin);\r\n this._direction.rotate90CWXY(result._direction);\r\n return result;\r\n }\r\n return new Ray2d(this._origin.clone(), this._direction.rotate90CWXY());\r\n }\r\n /**\r\n * Normalize the direction vector in place.\r\n * @param defaultX value to set `this.direction.x` if normalization fails. Default value 1.\r\n * @param defaultY value to set `this.direction.y` if normalization fails. Default value 0.\r\n * @returns whether normalization succeeded (i.e., direction is nonzero)\r\n */\r\n public normalizeDirectionInPlace(defaultX: number = 1, defaultY: number = 0): boolean {\r\n if (this._direction.normalize(this._direction))\r\n return true;\r\n this._direction.x = defaultX;\r\n this._direction.y = defaultY;\r\n return false;\r\n }\r\n /**\r\n * Intersect this ray with the unbounded line defined by the given points.\r\n * @param linePointA start of the line\r\n * @param linePointB end of the line\r\n * @returns object with named values:\r\n * * `hasIntersection`: whether the intersection exists.\r\n * * `fraction`: ray parameter of intersection, or 0.0 if `!hasIntersection`. If the instance is normalized, this is the signed distance along the ray to the intersection point.\r\n * * `cross`: the 2D cross product `this.direction x (linePointB - linePointA)`, useful for determining orientation of the line and ray.\r\n */\r\n public intersectUnboundedLine(linePointA: XAndY, linePointB: XAndY): { hasIntersection: boolean, fraction: number, cross: number } {\r\n const lineDirection = Vector2d.createStartEnd(linePointA, linePointB);\r\n const vector0 = Vector2d.createStartEnd(linePointA, this._origin);\r\n const h0 = vector0.crossProduct(lineDirection);\r\n const dHds = this._direction.crossProduct(lineDirection);\r\n // h = h0 + s * dh\r\n const ff = Geometry.conditionalDivideFraction(-h0, dHds);\r\n const hasIntersection = ff !== undefined;\r\n return { hasIntersection, fraction: hasIntersection ? ff : 0.0, cross: dHds };\r\n }\r\n /**\r\n * Find the intersection of the line defined by the ray with a Range2d.\r\n * * Return the range of parameters (on the ray) which are \"inside\" the range.\r\n * * Note that a range is always returned; if there is no intersection it is indicated by the test `result.isNull`.\r\n */\r\n public intersectionWithRange2d(range: Range2d, result?: Range1d): Range1d {\r\n if (range.isNull)\r\n return Range1d.createNull(result);\r\n const interval = Range1d.createXX(-Geometry.largeCoordinateResult, Geometry.largeCoordinateResult, result);\r\n interval.clipLinearMapToInterval(this.origin.x, this.direction.x, range.low.x, range.high.x);\r\n interval.clipLinearMapToInterval(this.origin.y, this.direction.y, range.low.y, range.high.y);\r\n return interval;\r\n }\r\n /** Return the ray fraction where the given point projects onto the ray. */\r\n public projectionFraction(point: XAndY): number {\r\n return this._origin.vectorTo(point).fractionOfProjectionToVector(this._direction);\r\n }\r\n /** Return the ray fraction where the given point projects onto the perpendicular ray. */\r\n public perpendicularProjectionFraction(point: XAndY): number {\r\n const uv = this._direction.crossProduct(this._origin.vectorTo(point));\r\n const uu = this._direction.magnitudeSquared();\r\n // Want zero returned if failure case, not undefined\r\n return Geometry.safeDivideFraction(uv, uu, 0.0);\r\n }\r\n /** Compute and return origin plus scaled direction. */\r\n public fractionToPoint(f: number, result?: Point2d): Point2d {\r\n return this._origin.plusScaled(this._direction, f, result);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Ray2d.js","sourceRoot":"","sources":["../../../src/geometry3d/Ray2d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aA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CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7F,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,2EAA2E;IACpE,kBAAkB,CAAC,KAAY;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,4BAA4B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpF,CAAC;IACD,yFAAyF;IAClF,+BAA+B,CAAC,KAAY;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;QAC9C,oDAAoD;QACpD,OAAO,QAAQ,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IACD,uDAAuD;IAChD,eAAe,CAAC,CAAS,EAAE,MAAgB;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { Point2d, Vector2d } from \"../geometry3d/Point2dVector2d\";\nimport { Range1d, Range2d } from \"./Range\";\nimport { XAndY } from \"./XYZProps\";\n\n/**\n * Ray with xy origin and direction\n * @public\n */\nexport class Ray2d {\n private _origin: Point2d;\n private _direction: Vector2d;\n\n private constructor(origin: Point2d, direction: Vector2d) {\n this._origin = origin;\n this._direction = direction;\n }\n /** Copy coordinates from origin and direction. */\n public set(origin: XAndY, direction: XAndY): void {\n this._origin.setFrom(origin);\n this._direction.setFrom(direction);\n }\n /** Create a ray with all zeros. */\n public static createZero(result?: Ray2d): Ray2d {\n if (result) {\n result.origin.setZero();\n result.direction.setZero();\n return result;\n }\n return new Ray2d(Point2d.createZero(), Vector2d.createZero());\n }\n /**\n * Create from `origin` and `target` points.\n * @param origin ray origin, cloned\n * @param target end of ray direction vector. The direction vector is `target - origin`.\n * @param result optional pre-allocated object to return\n */\n public static createOriginAndTarget(origin: XAndY, target: XAndY, result?: Ray2d): Ray2d {\n if (result) {\n result._origin.setFrom(origin);\n result._direction.set(target.x - origin.x, target.y - origin.y);\n return result;\n }\n return new Ray2d(Point2d.createFrom(origin), Vector2d.createStartEnd(origin, target));\n }\n /**\n * Create by copying coordinates from `origin` and `direction`.\n * @param origin ray origin\n * @param direction ray direction\n * @param result optional pre-allocated object to return\n */\n public static createOriginAndDirection(origin: XAndY, direction: XAndY, result?: Ray2d): Ray2d {\n if (result) {\n result.set(origin, direction);\n return result;\n }\n return new Ray2d(Point2d.createFrom(origin), Vector2d.createFrom(direction));\n }\n /** Create from captured `origin` and `direction`. */\n public static createOriginAndDirectionCapture(origin: Point2d, direction: Vector2d, result?: Ray2d): Ray2d {\n if (result) {\n result._origin = origin;\n result._direction = direction;\n return result;\n }\n return new Ray2d(origin, direction);\n }\n /** Get the reference to the ray origin. */\n public get origin() { return this._origin; }\n /** Get the reference to the ray direction. */\n public get direction() { return this._direction; }\n /**\n * Return a parallel ray to the left of this ray.\n * @param leftFraction distance between rays, as a fraction of the magnitude of this ray's direction vector\n */\n public parallelRay(leftFraction: number, result?: Ray2d): Ray2d {\n if (result) {\n this._origin.addForwardLeft(0.0, leftFraction, this._direction, result._origin);\n result._direction.setFrom(this._direction);\n return result;\n }\n return new Ray2d(this._origin.addForwardLeft(0.0, leftFraction, this._direction), this._direction.clone());\n }\n /** Return a ray with cloned origin and with direction rotated 90 degrees counterclockwise */\n public ccwPerpendicularRay(result?: Ray2d): Ray2d {\n if (result) {\n result._origin.setFrom(this._origin);\n this._direction.rotate90CCWXY(result._direction);\n return result;\n }\n return new Ray2d(this._origin.clone(), this._direction.rotate90CCWXY());\n }\n /** Return a ray with cloned origin and with direction rotated 90 degrees clockwise */\n public cwPerpendicularRay(result?: Ray2d): Ray2d {\n if (result) {\n result._origin.setFrom(this._origin);\n this._direction.rotate90CWXY(result._direction);\n return result;\n }\n return new Ray2d(this._origin.clone(), this._direction.rotate90CWXY());\n }\n /**\n * Normalize the direction vector in place.\n * @param defaultX value to set `this.direction.x` if normalization fails. Default value 1.\n * @param defaultY value to set `this.direction.y` if normalization fails. Default value 0.\n * @returns whether normalization succeeded (i.e., direction is nonzero)\n */\n public normalizeDirectionInPlace(defaultX: number = 1, defaultY: number = 0): boolean {\n if (this._direction.normalize(this._direction))\n return true;\n this._direction.x = defaultX;\n this._direction.y = defaultY;\n return false;\n }\n /**\n * Intersect this ray with the unbounded line defined by the given points.\n * @param linePointA start of the line\n * @param linePointB end of the line\n * @returns object with named values:\n * * `hasIntersection`: whether the intersection exists.\n * * `fraction`: ray parameter of intersection, or 0.0 if `!hasIntersection`. If the instance is normalized, this is the signed distance along the ray to the intersection point.\n * * `cross`: the 2D cross product `this.direction x (linePointB - linePointA)`, useful for determining orientation of the line and ray.\n */\n public intersectUnboundedLine(linePointA: XAndY, linePointB: XAndY): { hasIntersection: boolean, fraction: number, cross: number } {\n const lineDirection = Vector2d.createStartEnd(linePointA, linePointB);\n const vector0 = Vector2d.createStartEnd(linePointA, this._origin);\n const h0 = vector0.crossProduct(lineDirection);\n const dHds = this._direction.crossProduct(lineDirection);\n // h = h0 + s * dh\n const ff = Geometry.conditionalDivideFraction(-h0, dHds);\n const hasIntersection = ff !== undefined;\n return { hasIntersection, fraction: hasIntersection ? ff : 0.0, cross: dHds };\n }\n /**\n * Find the intersection of the line defined by the ray with a Range2d.\n * * Return the range of parameters (on the ray) which are \"inside\" the range.\n * * Note that a range is always returned; if there is no intersection it is indicated by the test `result.isNull`.\n */\n public intersectionWithRange2d(range: Range2d, result?: Range1d): Range1d {\n if (range.isNull)\n return Range1d.createNull(result);\n const interval = Range1d.createXX(-Geometry.largeCoordinateResult, Geometry.largeCoordinateResult, result);\n interval.clipLinearMapToInterval(this.origin.x, this.direction.x, range.low.x, range.high.x);\n interval.clipLinearMapToInterval(this.origin.y, this.direction.y, range.low.y, range.high.y);\n return interval;\n }\n /** Return the ray fraction where the given point projects onto the ray. */\n public projectionFraction(point: XAndY): number {\n return this._origin.vectorTo(point).fractionOfProjectionToVector(this._direction);\n }\n /** Return the ray fraction where the given point projects onto the perpendicular ray. */\n public perpendicularProjectionFraction(point: XAndY): number {\n const uv = this._direction.crossProduct(this._origin.vectorTo(point));\n const uu = this._direction.magnitudeSquared();\n // Want zero returned if failure case, not undefined\n return Geometry.safeDivideFraction(uv, uu, 0.0);\n }\n /** Compute and return origin plus scaled direction. */\n public fractionToPoint(f: number, result?: Point2d): Point2d {\n return this._origin.plusScaled(this._direction, f, result);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ray3d.js","sourceRoot":"","sources":["../../../src/geometry3d/Ray3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACpH,OAAO,EAAE,SAAS,EAAmB,QAAQ,EAAuB,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAW,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,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,EAAE,CAAC,CAAC;QAC9E,IAAI,QAAQ,IAAI,GAAG;YACjB,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,CAAC,CAAC;aACpF,CAAC;YACJ,MAAM,CAAC,GAAW,QAAQ,GAAG,GAAG,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QACpE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\nimport { CurveCurveApproachType, CurveLocationDetail, CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\r\nimport { AxisOrder, BeJSONFunctions, Geometry, PerpParallelOptions } from \"../Geometry\";\r\nimport { SmallSystem } from \"../numerics/SmallSystem\";\r\nimport { Matrix3d } from \"./Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"./Plane3dByOriginAndUnitNormal\";\r\nimport { Vector2d } from \"./Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\r\nimport { Range1d, Range3d } from \"./Range\";\r\nimport { Transform } from \"./Transform\";\r\nimport { XYAndZ } from \"./XYZProps\";\r\n\r\n// cspell:word Cramer\r\n/**\r\n * A Ray3d contains\r\n * * an `origin` point.\r\n * * a `direction` vector (The vector is not required to be normalized).\r\n * * an optional weight (number).\r\n * @public\r\n */\r\nexport class Ray3d implements BeJSONFunctions {\r\n /** The ray origin */\r\n public origin: Point3d;\r\n /** The ray direction. This is commonly (but not always) a unit vector. */\r\n public direction: Vector3d;\r\n /** Numeric annotation. */\r\n public a?: number; // optional (e.g. weight)\r\n private static _workVector0?: Vector3d;\r\n private static _workVector1?: Vector3d;\r\n private static _workVector2?: Vector3d;\r\n private static _workVector3?: Vector3d;\r\n private static _workVector4?: Vector3d;\r\n private static _workMatrix?: Matrix3d;\r\n // constructor (captures references)\r\n private constructor(origin: Point3d, direction: Vector3d) {\r\n this.origin = origin;\r\n this.direction = direction;\r\n this.a = undefined;\r\n }\r\n private static _create(x: number, y: number, z: number, u: number, v: number, w: number) {\r\n return new Ray3d(Point3d.create(x, y, z), Vector3d.create(u, v, w));\r\n }\r\n /** Create a ray on the x axis. */\r\n public static createXAxis(): Ray3d {\r\n return Ray3d._create(0, 0, 0, 1, 0, 0);\r\n }\r\n /** Create a ray on the y axis. */\r\n public static createYAxis(): Ray3d {\r\n return Ray3d._create(0, 0, 0, 0, 1, 0);\r\n }\r\n /** Create a ray on the z axis. */\r\n public static createZAxis(): Ray3d {\r\n return Ray3d._create(0, 0, 0, 0, 0, 1);\r\n }\r\n /** Create a ray with all zeros. */\r\n public static createZero(result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.origin.setZero();\r\n result.direction.setZero();\r\n return result;\r\n }\r\n return new Ray3d(Point3d.createZero(), Vector3d.createZero());\r\n }\r\n /**\r\n * Test for nearly equal Ray3d objects by comparing their origin and direction members.\r\n * @see [[isAlmostEqualPointSet]] to test for rays on the same infinite line.\r\n */\r\n public isAlmostEqual(other: Ray3d, tolerance: number = Geometry.smallMetricDistance): boolean {\r\n return this.origin.isAlmostEqual(other.origin, tolerance) && this.direction.isAlmostEqual(other.direction, tolerance);\r\n }\r\n /**\r\n * Return the dot product of the ray's direction vector with a vector from the ray origin\r\n * to the `spacePoint`.\r\n * * If the instance is the unit normal of a plane, then this method returns the (signed) altitude\r\n * of `spacePoint` with respect to the plane.\r\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane\r\n */\r\n public dotProductToPoint(spacePoint: Point3d): number {\r\n return this.direction.dotProductStartEnd(this.origin, spacePoint);\r\n }\r\n /** Return the fractional coordinate (along the direction vector) of the `spacePoint` projected to the ray. */\r\n public pointToFraction(spacePoint: Point3d): number {\r\n return Geometry.safeDivideFraction(\r\n this.dotProductToPoint(spacePoint),\r\n this.direction.magnitudeSquared(),\r\n 0,\r\n );\r\n }\r\n /** Return the `spacePoint` projected onto the ray. */\r\n public projectPointToRay(spacePoint: Point3d): Point3d {\r\n /**\r\n * To project a point to the ray, we can create a vector called \"v\" from ray origin to the spacePoint and project\r\n * that vector to the ray direction vector \"r\". The projection is \"((v.r)/||r||^2) r\" where \"v.r\" is the dot\r\n * product. Note that pointToFraction returns \"(v.r)/||r||^2\".\r\n * Note: If r is the normal of a plane, then projection length \"(v.r)/||r||\" is the signed altitude of the\r\n * spacePoint with respect to the plane.\r\n */\r\n return this.origin.plusScaled(this.direction, this.pointToFraction(spacePoint));\r\n }\r\n /**\r\n * Test for rays that describe the same infinite line.\r\n * @see [[isAlmostEqual]] for member-by-member comparison.\r\n */\r\n public isAlmostEqualPointSet(other: Ray3d, options?: PerpParallelOptions): boolean {\r\n if (!this.direction.isParallelTo(other.direction, true, false, options))\r\n return false;\r\n const tol2 = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;\r\n // theoretically, one test below is sufficient, but perform both in case the first passes because of round-off\r\n let workPoint = this.projectPointToRay(other.origin);\r\n if (other.origin.distanceSquared(workPoint) > tol2)\r\n return false;\r\n workPoint = other.projectPointToRay(this.origin);\r\n if (this.origin.distanceSquared(workPoint) > tol2)\r\n return false;\r\n return true;\r\n }\r\n /** Create a ray from origin and direction. */\r\n public static create(origin: Point3d, direction: Vector3d, result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.set(origin, direction);\r\n return result;\r\n }\r\n return new Ray3d(origin.clone(), direction.clone());\r\n }\r\n /**\r\n * Given a homogeneous point and its derivative components, construct a Ray3d with cartesian\r\n * coordinates and derivatives.\r\n * @param weightedPoint `[x,y,z,w]` parts of weighted point.\r\n * @param weightedDerivative `[x,y,z,w]` derivatives\r\n * @param result\r\n */\r\n public static createWeightedDerivative(\r\n weightedPoint: Float64Array, weightedDerivative: Float64Array, result?: Ray3d,\r\n ): Ray3d | undefined {\r\n const w = weightedPoint[3];\r\n const dw = weightedDerivative[3];\r\n const x = weightedPoint[0];\r\n const y = weightedPoint[1];\r\n const z = weightedPoint[2];\r\n const dx = weightedDerivative[0] * w - weightedPoint[0] * dw;\r\n const dy = weightedDerivative[1] * w - weightedPoint[1] * dw;\r\n const dz = weightedDerivative[2] * w - weightedPoint[2] * dw;\r\n if (Geometry.isSmallMetricDistance(w))\r\n return undefined;\r\n const divW = 1.0 / w;\r\n const divWW = divW * divW;\r\n return Ray3d.createXYZUVW(\r\n x * divW, y * divW, z * divW,\r\n dx * divWW, dy * divWW, dz * divWW,\r\n result,\r\n );\r\n }\r\n /** Create from coordinates of the origin and direction. */\r\n public static createXYZUVW(\r\n originX: number, originY: number, originZ: number,\r\n directionX: number, directionY: number, directionZ: number,\r\n result?: Ray3d,\r\n ): Ray3d {\r\n if (result) {\r\n result.getOriginRef().set(originX, originY, originZ);\r\n result.getDirectionRef().set(directionX, directionY, directionZ);\r\n return result;\r\n }\r\n return new Ray3d(Point3d.create(originX, originY, originZ), Vector3d.create(directionX, directionY, directionZ));\r\n }\r\n /** Capture origin and direction in a new Ray3d. */\r\n public static createCapture(origin: Point3d, direction: Vector3d): Ray3d {\r\n return new Ray3d(origin, direction);\r\n }\r\n /** Create from (clones of) origin, direction, and numeric weight. */\r\n public static createPointVectorNumber(origin: Point3d, direction: Vector3d, a: number, result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.origin.setFrom(origin);\r\n result.direction.setFrom(direction);\r\n result.a = a;\r\n return result;\r\n }\r\n result = new Ray3d(origin.clone(), direction.clone());\r\n result.a = a;\r\n return result;\r\n }\r\n /** Create from origin and target. The direction vector is the full length (non-unit) vector from origin to target. */\r\n public static createStartEnd(origin: Point3d, target: Point3d, result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.origin.setFrom(origin);\r\n result.direction.setStartEnd(origin, target);\r\n return result;\r\n }\r\n return new Ray3d(origin.clone(), Vector3d.createStartEnd(origin, target));\r\n }\r\n /** Return a reference to the ray's origin. */\r\n public getOriginRef(): Point3d {\r\n return this.origin;\r\n }\r\n /** Return a reference to the ray's direction vector. */\r\n public getDirectionRef(): Vector3d {\r\n return this.direction;\r\n }\r\n /** Copy coordinates from origin and direction. */\r\n public set(origin: Point3d, direction: Vector3d): void {\r\n this.origin.setFrom(origin);\r\n this.direction.setFrom(direction);\r\n }\r\n /** Clone the ray. */\r\n public clone(result?: Ray3d): Ray3d {\r\n if (result) {\r\n result.set(this.origin.clone(), this.direction.clone());\r\n return result;\r\n }\r\n return new Ray3d(this.origin.clone(), this.direction.clone());\r\n }\r\n /** Return a clone of the transformed instance */\r\n public cloneTransformed(transform: Transform, result?: Ray3d): Ray3d {\r\n return Ray3d.create(\r\n transform.multiplyPoint3d(this.origin, result?.origin),\r\n transform.multiplyVector(this.direction, result?.direction),\r\n result,\r\n );\r\n }\r\n /** Create a clone and return the inverse transform of the clone. */\r\n public cloneInverseTransformed(transform: Transform, result?: Ray3d): Ray3d | undefined {\r\n if (!transform.computeCachedInverse(true))\r\n return undefined;\r\n return Ray3d.create(\r\n transform.multiplyInversePoint3d(this.origin, result?.origin)!,\r\n transform.matrix.multiplyInverseXYZAsVector3d(\r\n this.direction.x, this.direction.y, this.direction.z, result?.direction,\r\n )!,\r\n result,\r\n );\r\n }\r\n /** Apply a transform in place. */\r\n public transformInPlace(transform: Transform) {\r\n transform.multiplyPoint3d(this.origin, this.origin);\r\n transform.multiplyVector(this.direction, this.direction);\r\n }\r\n /** Copy data from another ray. */\r\n public setFrom(source: Ray3d): void {\r\n this.set(source.origin, source.direction);\r\n }\r\n /**\r\n * Return a point at fractional position along the ray.\r\n * * fraction 0 is the ray origin.\r\n * * fraction 1 is at the end of the direction vector when placed at the origin.\r\n */\r\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\r\n return this.origin.plusScaled(this.direction, fraction, result);\r\n }\r\n /**\r\n * Return a transform for rigid axes at ray origin with z in ray direction.\r\n * * If the direction vector is zero, axes default to identity (from [[Matrix3d.createRigidHeadsUp]])\r\n */\r\n public toRigidZFrame(result?: Transform): Transform {\r\n const axes = Ray3d._workMatrix = Matrix3d.createRigidHeadsUp(this.direction, AxisOrder.ZXY, Ray3d._workMatrix);\r\n return Transform.createOriginAndMatrix(this.origin, axes, result);\r\n }\r\n /** Convert {origin:[x,y,z], direction:[u,v,w]} to a Ray3d. */\r\n public setFromJSON(json?: any) {\r\n if (!json) {\r\n this.origin.set(0, 0, 0);\r\n this.direction.set(0, 0, 1);\r\n return;\r\n }\r\n this.origin.setFromJSON(json.origin);\r\n this.direction.setFromJSON(json.direction);\r\n }\r\n /**\r\n * Construct a JSON object from this Ray3d.\r\n * @return {*} [origin,normal]\r\n */\r\n public toJSON(): any {\r\n return { origin: this.origin.toJSON(), direction: this.direction.toJSON() };\r\n }\r\n /** Create a new ray from json object. See `setFromJSON` for json structure; */\r\n public static fromJSON(json?: any) {\r\n const result = Ray3d.createXAxis();\r\n result.setFromJSON(json);\r\n return result;\r\n }\r\n /**\r\n * Try to scale the direction vector to a given `magnitude`.\r\n * * Returns `false` if the ray direction is a zero vector.\r\n */\r\n public trySetDirectionMagnitudeInPlace(magnitude: number = 1.0): boolean {\r\n if (this.direction.tryNormalizeInPlace()) {\r\n this.direction.scaleInPlace(magnitude);\r\n return true;\r\n }\r\n this.direction.setZero();\r\n this.a = 0.0;\r\n return false;\r\n }\r\n /**\r\n * Normalize the ray direction in place.\r\n * * If parameter `a` is clearly nonzero and the direction vector can be normalized,\r\n * * Save the parameter `a` as the optional `a` member of the ray.\r\n * * Normalize the ray's direction vector.\r\n * * If parameter `a` is nearly zero,\r\n * * Set the `a` member to zero.\r\n * * Set the ray's direction vector to zero.\r\n * @param a value to be saved (e.g,. area).\r\n * @returns `true` if `a` is nonzero and normalization was successful. Otherwise, return `false`.\r\n */\r\n public tryNormalizeInPlaceWithAreaWeight(a: number): boolean {\r\n const tolerance = Geometry.smallMetricDistanceSquared;\r\n this.a = a;\r\n if (Math.abs(a) > tolerance && this.direction.tryNormalizeInPlace(tolerance))\r\n return true;\r\n this.direction.setZero();\r\n this.a = 0.0;\r\n return false;\r\n }\r\n /** Return distance from the ray to point in space. */\r\n public distance(spacePoint: Point3d): number {\r\n const uu = this.direction.magnitudeSquared();\r\n const uv = this.dotProductToPoint(spacePoint);\r\n const aa = Geometry.inverseMetricDistanceSquared(uu);\r\n if (aa)\r\n return Math.sqrt(this.origin.distanceSquared(spacePoint) - uv * uv * aa);\r\n else\r\n return Math.sqrt(this.origin.distanceSquared(spacePoint));\r\n }\r\n /**\r\n * Return the intersection parameter of the line defined by the ray with a `plane`.\r\n * * Stores the point of intersection in the `result` point (if passed as a parameter) and returns the parameter\r\n * along the ray where the intersection occurs. If we call the parameter 'f' then the point of intersection would\r\n * be `ray.origin + f * ray.direction`. Therefore:\r\n * * if ray intersects the plane at its origin, the function returns f = 0.\r\n * * if intersects at `ray.origin + ray.direction`, the function returns f = 1.\r\n * * if intersects behind the ray origin, the function returns f < 0.\r\n * * if intersects after `ray.origin + ray.direction`, the function returns f > 1.\r\n * * Returns `undefined` if the ray and plane are parallel or coplanar.\r\n */\r\n public intersectionWithPlane(plane: Plane3dByOriginAndUnitNormal, result?: Point3d): number | undefined {\r\n const vectorA = Vector3d.createStartEnd(plane.getOriginRef(), this.origin);\r\n const uDotN = this.direction.dotProduct(plane.getNormalRef());\r\n const nDotN = this.direction.magnitudeSquared();\r\n const aDotN = vectorA.dotProduct(plane.getNormalRef());\r\n const division = Geometry.conditionalDivideFraction(-aDotN, uDotN);\r\n if (undefined === division)\r\n return undefined;\r\n const division1 = Geometry.conditionalDivideFraction(nDotN, uDotN);\r\n if (undefined === division1)\r\n return undefined;\r\n if (result) {\r\n this.origin.plusScaled(this.direction, division, result);\r\n }\r\n return division;\r\n }\r\n /**\r\n * Find the intersection of the line defined by the ray with a Range3d.\r\n * * Return the range of parameters (on the ray) which are \"inside\" the range.\r\n * * Note that a range is always returned; if there is no intersection it is indicated by the test `result.isNull`.\r\n */\r\n public intersectionWithRange3d(range: Range3d, result?: Range1d): Range1d {\r\n if (range.isNull)\r\n return Range1d.createNull(result);\r\n const interval = Range1d.createXX(-Geometry.largeCoordinateResult, Geometry.largeCoordinateResult, result);\r\n interval.clipLinearMapToInterval(this.origin.x, this.direction.x, range.low.x, range.high.x);\r\n interval.clipLinearMapToInterval(this.origin.y, this.direction.y, range.low.y, range.high.y);\r\n interval.clipLinearMapToInterval(this.origin.z, this.direction.z, range.low.z, range.high.z);\r\n return interval;\r\n }\r\n /**\r\n * Compute the intersection of the ray with a triangle.\r\n * * This method is faster than `BarycentricTriangle.intersectRay3d`.\r\n * @param vertex0 first vertex of the triangle\r\n * @param vertex1 second vertex of the triangle\r\n * @param vertex2 third vertex of the triangle\r\n * @param distanceTol optional tolerance used to check if ray is parallel to the triangle or if we have line\r\n * intersection but not ray intersection (if tolerance is not provided, Geometry.smallMetricDistance is used)\r\n * @param parameterTol optional tolerance used to allow intersections just beyond an edge/vertex in barycentric\r\n * coordinate space (if tolerance is not provided, Geometry.smallFloatingPoint is used)\r\n * @param result optional pre-allocated object to fill and return\r\n * @returns the intersection point if ray intersects the triangle. Otherwise, return undefined.\r\n */\r\n public intersectionWithTriangle(\r\n vertex0: Point3d, vertex1: Point3d, vertex2: Point3d, distanceTol?: number, parameterTol?: number, result?: Point3d,\r\n ): Point3d | undefined {\r\n /**\r\n * Let (w,u,v) be the barycentric coordinates of point P wrt the triangle (v0,v1,v2), such that\r\n * P = w*v0 + u*v1 + v*v2 = (1-u-v)*v0 + u*v1 + v*v2 = v0 + u*(v1-v0) + v*(v2-v0)\r\n *\r\n * Then if the ray given by rayOrigin + t*rayVector intersects the triangle at P, we have\r\n * v0 + u*(v1-v0) + v*(v2-v0) = rayOrigin + t*rayVector\r\n *\r\n * This equation can be reformulated as the following linear system:\r\n *\r\n * [ | | | ] [t] [ | ]\r\n * [-rayVector v1-v0 v2-v0] [u] = [rayOrigin - v0]\r\n * [ | | | ] [v] [ | ]\r\n *\r\n * Then to find t, u, and v, use Cramer's Rule, the formulation of matrix determinant as column triple product,\r\n * and the fact that swapping any 2 vectors in the triple product negates it:\r\n *\r\n * t = (v2-v0).(rayOrigin - v0) x (v1-v0) / (v1-v0).rayVector x (v2-v0)\r\n * u = (rayOrigin - v0).rayVector x (v2-v0) / (v1-v0).rayVector x (v2-v0)\r\n * v = -rayVector.(rayOrigin - v0) x (v1-v0) / (v1-v0).rayVector x (v2-v0)\r\n *\r\n * Note that we verify 0 <= u,v,w <= 1. To do so we only need to check 0 <= u <= 1, 0 <= v, and u+v <= 1:\r\n * these 4 checks guarantee that v <= 1 and 0 <= u+v, and so with w = 1-(u+v), we have 0 <= w <= 1.\r\n *\r\n * More info be found at https://en.wikipedia.org/wiki/Moller-Trumbore_intersection_algorithm.\r\n */\r\n if (distanceTol === undefined || distanceTol < 0) // we explicitly allow zero tolerance\r\n distanceTol = Geometry.smallMetricDistance;\r\n if (parameterTol === undefined || parameterTol < 0) // we explicitly allow zero tolerance\r\n parameterTol = Geometry.smallFloatingPoint;\r\n const edge1 = Ray3d._workVector0 = Vector3d.createStartEnd(vertex0, vertex1, Ray3d._workVector0);\r\n const edge2 = Ray3d._workVector1 = Vector3d.createStartEnd(vertex0, vertex2, Ray3d._workVector1);\r\n const h = Ray3d._workVector2 = this.direction.crossProduct(edge2, Ray3d._workVector2);\r\n const a = edge1.dotProduct(h);\r\n if (a >= -distanceTol && a <= distanceTol)\r\n return undefined; // ray is parallel to the triangle (includes coplanar case)\r\n const f = 1.0 / a;\r\n const s = Ray3d._workVector3 = Vector3d.createStartEnd(vertex0, this.origin, Ray3d._workVector3);\r\n let u = f * s.dotProduct(h);\r\n if (u < 0.0) {\r\n if (u >= -parameterTol)\r\n u = 0.0;\r\n else\r\n return undefined; // ray does not intersect the triangle\r\n } else if (u > 1.0) {\r\n if (u <= 1.0 + parameterTol)\r\n u = 1.0;\r\n else\r\n return undefined; // ray does not intersect the triangle\r\n }\r\n const q = Ray3d._workVector4 = s.crossProduct(edge1, Ray3d._workVector4);\r\n let v = f * this.direction.dotProduct(q);\r\n if (v < 0.0) {\r\n if (v >= -parameterTol)\r\n v = 0.0;\r\n else\r\n return undefined; // ray does not intersect the triangle\r\n } else if (u + v > 1.0 + parameterTol) {\r\n return undefined; // ray does not intersect the triangle\r\n }\r\n // at this stage, we know the line (parameterized as the ray) intersects the triangle\r\n const t = f * edge2.dotProduct(q);\r\n if (t < -distanceTol) // line intersection but not ray intersection\r\n return undefined;\r\n return this.origin.plusScaled(this.direction, t, result); // ray intersection\r\n }\r\n /**\r\n * Return the shortest vector `v` to `targetPoint` from the line defined by this ray.\r\n * * If the projection of `targetPoint` onto the line defined by this ray is q, then `v = targetPoint - q`.\r\n */\r\n public perpendicularPartOfVectorToTarget(targetPoint: XYAndZ, result?: Vector3d): Vector3d {\r\n const vectorV = Vector3d.createStartEnd(this.origin, targetPoint);\r\n const uu = this.direction.magnitudeSquared();\r\n const uv = this.direction.dotProductStartEnd(this.origin, targetPoint);\r\n const fraction = Geometry.safeDivideFraction(uv, uu, 0.0);\r\n return vectorV.plusScaled(this.direction, -fraction, result);\r\n }\r\n /**\r\n * Determine if two rays intersect, or are fully overlapped, or parallel but not coincident, or skew.\r\n * * Return a CurveLocationDetailPair which contains fraction and point on each ray and has\r\n * annotation (in member `approachType`) indicating one of these relationships:\r\n * * CurveCurveApproachType.Intersection -- the rays have a simple intersection, at fractions indicated\r\n * in detailA and detailB\r\n * * CurveCurveApproachType.PerpendicularChord -- there is pair of where the rays have closest approach.\r\n * The rays are skew in space.\r\n * * CurveCurveApproachType.CoincidentGeometry -- the rays are the same unbounded line in space. The\r\n * fractions and points are a representative single common point.\r\n * * CurveCurveApproachType.Parallel -- the rays are parallel (and not coincident). The two points are\r\n * at the minimum distance\r\n */\r\n public static closestApproachRay3dRay3d(rayA: Ray3d, rayB: Ray3d): CurveLocationDetailPair {\r\n const intersectionFractions = Vector2d.create();\r\n let fractionA, fractionB;\r\n let pointA, pointB;\r\n let pairType;\r\n if (\r\n SmallSystem.ray3dXYZUVWClosestApproachUnbounded(\r\n rayA.origin.x, rayA.origin.y, rayA.origin.z, rayA.direction.x, rayA.direction.y, rayA.direction.z,\r\n rayB.origin.x, rayB.origin.y, rayB.origin.z, rayB.direction.x, rayB.direction.y, rayB.direction.z,\r\n intersectionFractions,\r\n )\r\n ) {\r\n fractionA = intersectionFractions.x;\r\n fractionB = intersectionFractions.y;\r\n pointA = rayA.fractionToPoint(fractionA);\r\n pointB = rayB.fractionToPoint(fractionB);\r\n pairType = pointA.isAlmostEqualMetric(pointB) ?\r\n CurveCurveApproachType.Intersection : CurveCurveApproachType.PerpendicularChord;\r\n } else {\r\n fractionB = 0.0;\r\n fractionA = rayA.pointToFraction(rayB.origin);\r\n pointA = rayA.fractionToPoint(fractionA);\r\n pointB = rayB.fractionToPoint(fractionB);\r\n pairType = pointA.isAlmostEqualMetric(pointB) ?\r\n CurveCurveApproachType.CoincidentGeometry : CurveCurveApproachType.ParallelGeometry;\r\n }\r\n const pair = CurveLocationDetailPair.createCapture(\r\n CurveLocationDetail.createRayFractionPoint(rayA, fractionA, rayA.fractionToPoint(fractionA)),\r\n CurveLocationDetail.createRayFractionPoint(rayB, fractionB, rayB.fractionToPoint(fractionB)));\r\n pair.approachType = pairType;\r\n return pair;\r\n }\r\n /**\r\n * Return a ray with `ray.origin` interpolated between `pt1` and `pt2` at the given `fraction`\r\n * and `ray.direction` set to the vector from `pt1` to `pt2` multiplied by the given `tangentScale`.\r\n * @param pt1 start point of the interpolation.\r\n * @param fraction fractional position between points.\r\n * @param pt2 end point of the interpolation.\r\n * @param tangentScale scale factor to apply to the startToEnd vector.\r\n * @param result optional receiver.\r\n */\r\n public static interpolatePointAndTangent(\r\n pt1: XYAndZ, fraction: number, pt2: XYAndZ, tangentScale: number, result?: Ray3d,\r\n ): Ray3d {\r\n result = result ?? Ray3d.createZero();\r\n const dx = pt2.x - pt1.x;\r\n const dy = pt2.y - pt1.y;\r\n const dz = pt2.z - pt1.z;\r\n result.direction.set(tangentScale * dx, tangentScale * dy, tangentScale * dz);\r\n if (fraction <= 0.5)\r\n result.origin.set(pt1.x + fraction * dx, pt1.y + fraction * dy, pt1.z + fraction * dz);\r\n else {\r\n const t: number = fraction - 1.0;\r\n result.origin.set(pt2.x + t * dx, pt2.y + t * dy, pt2.z + t * dz);\r\n }\r\n return result;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Ray3d.js","sourceRoot":"","sources":["../../../src/geometry3d/Ray3d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACpH,OAAO,EAAE,SAAS,EAAmB,QAAQ,EAAuB,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAW,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,qBAAqB;AACrB;;;;;;GAMG;AACH,MAAM,OAAO,KAAK;IAChB,qBAAqB;IACd,MAAM,CAAU;IACvB,0EAA0E;IACnE,SAAS,CAAW;I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AE,EAAE,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,QAAQ,GAAG,EAAE,CAAC,CAAC;aACpF,CAAC;YACJ,MAAM,CAAC,GAAW,QAAQ,GAAG,GAAG,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QACpE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","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 */\nimport { CurveCurveApproachType, CurveLocationDetail, CurveLocationDetailPair } from \"../curve/CurveLocationDetail\";\nimport { AxisOrder, BeJSONFunctions, Geometry, PerpParallelOptions } from \"../Geometry\";\nimport { SmallSystem } from \"../numerics/SmallSystem\";\nimport { Matrix3d } from \"./Matrix3d\";\nimport { Plane3dByOriginAndUnitNormal } from \"./Plane3dByOriginAndUnitNormal\";\nimport { Vector2d } from \"./Point2dVector2d\";\nimport { Point3d, Vector3d } from \"./Point3dVector3d\";\nimport { Range1d, Range3d } from \"./Range\";\nimport { Transform } from \"./Transform\";\nimport { XYAndZ } from \"./XYZProps\";\n\n// cspell:word Cramer\n/**\n * A Ray3d contains\n * * an `origin` point.\n * * a `direction` vector (The vector is not required to be normalized).\n * * an optional weight (number).\n * @public\n */\nexport class Ray3d implements BeJSONFunctions {\n /** The ray origin */\n public origin: Point3d;\n /** The ray direction. This is commonly (but not always) a unit vector. */\n public direction: Vector3d;\n /** Numeric annotation. */\n public a?: number; // optional (e.g. weight)\n private static _workVector0?: Vector3d;\n private static _workVector1?: Vector3d;\n private static _workVector2?: Vector3d;\n private static _workVector3?: Vector3d;\n private static _workVector4?: Vector3d;\n private static _workMatrix?: Matrix3d;\n // constructor (captures references)\n private constructor(origin: Point3d, direction: Vector3d) {\n this.origin = origin;\n this.direction = direction;\n this.a = undefined;\n }\n private static _create(x: number, y: number, z: number, u: number, v: number, w: number) {\n return new Ray3d(Point3d.create(x, y, z), Vector3d.create(u, v, w));\n }\n /** Create a ray on the x axis. */\n public static createXAxis(): Ray3d {\n return Ray3d._create(0, 0, 0, 1, 0, 0);\n }\n /** Create a ray on the y axis. */\n public static createYAxis(): Ray3d {\n return Ray3d._create(0, 0, 0, 0, 1, 0);\n }\n /** Create a ray on the z axis. */\n public static createZAxis(): Ray3d {\n return Ray3d._create(0, 0, 0, 0, 0, 1);\n }\n /** Create a ray with all zeros. */\n public static createZero(result?: Ray3d): Ray3d {\n if (result) {\n result.origin.setZero();\n result.direction.setZero();\n return result;\n }\n return new Ray3d(Point3d.createZero(), Vector3d.createZero());\n }\n /**\n * Test for nearly equal Ray3d objects by comparing their origin and direction members.\n * @see [[isAlmostEqualPointSet]] to test for rays on the same infinite line.\n */\n public isAlmostEqual(other: Ray3d, tolerance: number = Geometry.smallMetricDistance): boolean {\n return this.origin.isAlmostEqual(other.origin, tolerance) && this.direction.isAlmostEqual(other.direction, tolerance);\n }\n /**\n * Return the dot product of the ray's direction vector with a vector from the ray origin\n * to the `spacePoint`.\n * * If the instance is the unit normal of a plane, then this method returns the (signed) altitude\n * of `spacePoint` with respect to the plane.\n * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane\n */\n public dotProductToPoint(spacePoint: Point3d): number {\n return this.direction.dotProductStartEnd(this.origin, spacePoint);\n }\n /** Return the fractional coordinate (along the direction vector) of the `spacePoint` projected to the ray. */\n public pointToFraction(spacePoint: Point3d): number {\n return Geometry.safeDivideFraction(\n this.dotProductToPoint(spacePoint),\n this.direction.magnitudeSquared(),\n 0,\n );\n }\n /** Return the `spacePoint` projected onto the ray. */\n public projectPointToRay(spacePoint: Point3d): Point3d {\n /**\n * To project a point to the ray, we can create a vector called \"v\" from ray origin to the spacePoint and project\n * that vector to the ray direction vector \"r\". The projection is \"((v.r)/||r||^2) r\" where \"v.r\" is the dot\n * product. Note that pointToFraction returns \"(v.r)/||r||^2\".\n * Note: If r is the normal of a plane, then projection length \"(v.r)/||r||\" is the signed altitude of the\n * spacePoint with respect to the plane.\n */\n return this.origin.plusScaled(this.direction, this.pointToFraction(spacePoint));\n }\n /**\n * Test for rays that describe the same infinite line.\n * @see [[isAlmostEqual]] for member-by-member comparison.\n */\n public isAlmostEqualPointSet(other: Ray3d, options?: PerpParallelOptions): boolean {\n if (!this.direction.isParallelTo(other.direction, true, false, options))\n return false;\n const tol2 = options?.distanceSquaredTol ?? Geometry.smallMetricDistanceSquared;\n // theoretically, one test below is sufficient, but perform both in case the first passes because of round-off\n let workPoint = this.projectPointToRay(other.origin);\n if (other.origin.distanceSquared(workPoint) > tol2)\n return false;\n workPoint = other.projectPointToRay(this.origin);\n if (this.origin.distanceSquared(workPoint) > tol2)\n return false;\n return true;\n }\n /** Create a ray from origin and direction. */\n public static create(origin: Point3d, direction: Vector3d, result?: Ray3d): Ray3d {\n if (result) {\n result.set(origin, direction);\n return result;\n }\n return new Ray3d(origin.clone(), direction.clone());\n }\n /**\n * Given a homogeneous point and its derivative components, construct a Ray3d with cartesian\n * coordinates and derivatives.\n * @param weightedPoint `[x,y,z,w]` parts of weighted point.\n * @param weightedDerivative `[x,y,z,w]` derivatives\n * @param result\n */\n public static createWeightedDerivative(\n weightedPoint: Float64Array, weightedDerivative: Float64Array, result?: Ray3d,\n ): Ray3d | undefined {\n const w = weightedPoint[3];\n const dw = weightedDerivative[3];\n const x = weightedPoint[0];\n const y = weightedPoint[1];\n const z = weightedPoint[2];\n const dx = weightedDerivative[0] * w - weightedPoint[0] * dw;\n const dy = weightedDerivative[1] * w - weightedPoint[1] * dw;\n const dz = weightedDerivative[2] * w - weightedPoint[2] * dw;\n if (Geometry.isSmallMetricDistance(w))\n return undefined;\n const divW = 1.0 / w;\n const divWW = divW * divW;\n return Ray3d.createXYZUVW(\n x * divW, y * divW, z * divW,\n dx * divWW, dy * divWW, dz * divWW,\n result,\n );\n }\n /** Create from coordinates of the origin and direction. */\n public static createXYZUVW(\n originX: number, originY: number, originZ: number,\n directionX: number, directionY: number, directionZ: number,\n result?: Ray3d,\n ): Ray3d {\n if (result) {\n result.getOriginRef().set(originX, originY, originZ);\n result.getDirectionRef().set(directionX, directionY, directionZ);\n return result;\n }\n return new Ray3d(Point3d.create(originX, originY, originZ), Vector3d.create(directionX, directionY, directionZ));\n }\n /** Capture origin and direction in a new Ray3d. */\n public static createCapture(origin: Point3d, direction: Vector3d): Ray3d {\n return new Ray3d(origin, direction);\n }\n /** Create from (clones of) origin, direction, and numeric weight. */\n public static createPointVectorNumber(origin: Point3d, direction: Vector3d, a: number, result?: Ray3d): Ray3d {\n if (result) {\n result.origin.setFrom(origin);\n result.direction.setFrom(direction);\n result.a = a;\n return result;\n }\n result = new Ray3d(origin.clone(), direction.clone());\n result.a = a;\n return result;\n }\n /** Create from origin and target. The direction vector is the full length (non-unit) vector from origin to target. */\n public static createStartEnd(origin: Point3d, target: Point3d, result?: Ray3d): Ray3d {\n if (result) {\n result.origin.setFrom(origin);\n result.direction.setStartEnd(origin, target);\n return result;\n }\n return new Ray3d(origin.clone(), Vector3d.createStartEnd(origin, target));\n }\n /** Return a reference to the ray's origin. */\n public getOriginRef(): Point3d {\n return this.origin;\n }\n /** Return a reference to the ray's direction vector. */\n public getDirectionRef(): Vector3d {\n return this.direction;\n }\n /** Copy coordinates from origin and direction. */\n public set(origin: Point3d, direction: Vector3d): void {\n this.origin.setFrom(origin);\n this.direction.setFrom(direction);\n }\n /** Clone the ray. */\n public clone(result?: Ray3d): Ray3d {\n if (result) {\n result.set(this.origin.clone(), this.direction.clone());\n return result;\n }\n return new Ray3d(this.origin.clone(), this.direction.clone());\n }\n /** Return a clone of the transformed instance */\n public cloneTransformed(transform: Transform, result?: Ray3d): Ray3d {\n return Ray3d.create(\n transform.multiplyPoint3d(this.origin, result?.origin),\n transform.multiplyVector(this.direction, result?.direction),\n result,\n );\n }\n /** Create a clone and return the inverse transform of the clone. */\n public cloneInverseTransformed(transform: Transform, result?: Ray3d): Ray3d | undefined {\n if (!transform.computeCachedInverse(true))\n return undefined;\n return Ray3d.create(\n transform.multiplyInversePoint3d(this.origin, result?.origin)!,\n transform.matrix.multiplyInverseXYZAsVector3d(\n this.direction.x, this.direction.y, this.direction.z, result?.direction,\n )!,\n result,\n );\n }\n /** Apply a transform in place. */\n public transformInPlace(transform: Transform) {\n transform.multiplyPoint3d(this.origin, this.origin);\n transform.multiplyVector(this.direction, this.direction);\n }\n /** Copy data from another ray. */\n public setFrom(source: Ray3d): void {\n this.set(source.origin, source.direction);\n }\n /**\n * Return a point at fractional position along the ray.\n * * fraction 0 is the ray origin.\n * * fraction 1 is at the end of the direction vector when placed at the origin.\n */\n public fractionToPoint(fraction: number, result?: Point3d): Point3d {\n return this.origin.plusScaled(this.direction, fraction, result);\n }\n /**\n * Return a transform for rigid axes at ray origin with z in ray direction.\n * * If the direction vector is zero, axes default to identity (from [[Matrix3d.createRigidHeadsUp]])\n */\n public toRigidZFrame(result?: Transform): Transform {\n const axes = Ray3d._workMatrix = Matrix3d.createRigidHeadsUp(this.direction, AxisOrder.ZXY, Ray3d._workMatrix);\n return Transform.createOriginAndMatrix(this.origin, axes, result);\n }\n /** Convert {origin:[x,y,z], direction:[u,v,w]} to a Ray3d. */\n public setFromJSON(json?: any) {\n if (!json) {\n this.origin.set(0, 0, 0);\n this.direction.set(0, 0, 1);\n return;\n }\n this.origin.setFromJSON(json.origin);\n this.direction.setFromJSON(json.direction);\n }\n /**\n * Construct a JSON object from this Ray3d.\n * @return {*} [origin,normal]\n */\n public toJSON(): any {\n return { origin: this.origin.toJSON(), direction: this.direction.toJSON() };\n }\n /** Create a new ray from json object. See `setFromJSON` for json structure; */\n public static fromJSON(json?: any) {\n const result = Ray3d.createXAxis();\n result.setFromJSON(json);\n return result;\n }\n /**\n * Try to scale the direction vector to a given `magnitude`.\n * * Returns `false` if the ray direction is a zero vector.\n */\n public trySetDirectionMagnitudeInPlace(magnitude: number = 1.0): boolean {\n if (this.direction.tryNormalizeInPlace()) {\n this.direction.scaleInPlace(magnitude);\n return true;\n }\n this.direction.setZero();\n this.a = 0.0;\n return false;\n }\n /**\n * Normalize the ray direction in place.\n * * If parameter `a` is clearly nonzero and the direction vector can be normalized,\n * * Save the parameter `a` as the optional `a` member of the ray.\n * * Normalize the ray's direction vector.\n * * If parameter `a` is nearly zero,\n * * Set the `a` member to zero.\n * * Set the ray's direction vector to zero.\n * @param a value to be saved (e.g,. area).\n * @returns `true` if `a` is nonzero and normalization was successful. Otherwise, return `false`.\n */\n public tryNormalizeInPlaceWithAreaWeight(a: number): boolean {\n const tolerance = Geometry.smallMetricDistanceSquared;\n this.a = a;\n if (Math.abs(a) > tolerance && this.direction.tryNormalizeInPlace(tolerance))\n return true;\n this.direction.setZero();\n this.a = 0.0;\n return false;\n }\n /** Return distance from the ray to point in space. */\n public distance(spacePoint: Point3d): number {\n const uu = this.direction.magnitudeSquared();\n const uv = this.dotProductToPoint(spacePoint);\n const aa = Geometry.inverseMetricDistanceSquared(uu);\n if (aa)\n return Math.sqrt(this.origin.distanceSquared(spacePoint) - uv * uv * aa);\n else\n return Math.sqrt(this.origin.distanceSquared(spacePoint));\n }\n /**\n * Return the intersection parameter of the line defined by the ray with a `plane`.\n * * Stores the point of intersection in the `result` point (if passed as a parameter) and returns the parameter\n * along the ray where the intersection occurs. If we call the parameter 'f' then the point of intersection would\n * be `ray.origin + f * ray.direction`. Therefore:\n * * if ray intersects the plane at its origin, the function returns f = 0.\n * * if intersects at `ray.origin + ray.direction`, the function returns f = 1.\n * * if intersects behind the ray origin, the function returns f < 0.\n * * if intersects after `ray.origin + ray.direction`, the function returns f > 1.\n * * Returns `undefined` if the ray and plane are parallel or coplanar.\n */\n public intersectionWithPlane(plane: Plane3dByOriginAndUnitNormal, result?: Point3d): number | undefined {\n const vectorA = Vector3d.createStartEnd(plane.getOriginRef(), this.origin);\n const uDotN = this.direction.dotProduct(plane.getNormalRef());\n const nDotN = this.direction.magnitudeSquared();\n const aDotN = vectorA.dotProduct(plane.getNormalRef());\n const division = Geometry.conditionalDivideFraction(-aDotN, uDotN);\n if (undefined === division)\n return undefined;\n const division1 = Geometry.conditionalDivideFraction(nDotN, uDotN);\n if (undefined === division1)\n return undefined;\n if (result) {\n this.origin.plusScaled(this.direction, division, result);\n }\n return division;\n }\n /**\n * Find the intersection of the line defined by the ray with a Range3d.\n * * Return the range of parameters (on the ray) which are \"inside\" the range.\n * * Note that a range is always returned; if there is no intersection it is indicated by the test `result.isNull`.\n */\n public intersectionWithRange3d(range: Range3d, result?: Range1d): Range1d {\n if (range.isNull)\n return Range1d.createNull(result);\n const interval = Range1d.createXX(-Geometry.largeCoordinateResult, Geometry.largeCoordinateResult, result);\n interval.clipLinearMapToInterval(this.origin.x, this.direction.x, range.low.x, range.high.x);\n interval.clipLinearMapToInterval(this.origin.y, this.direction.y, range.low.y, range.high.y);\n interval.clipLinearMapToInterval(this.origin.z, this.direction.z, range.low.z, range.high.z);\n return interval;\n }\n /**\n * Compute the intersection of the ray with a triangle.\n * * This method is faster than `BarycentricTriangle.intersectRay3d`.\n * @param vertex0 first vertex of the triangle\n * @param vertex1 second vertex of the triangle\n * @param vertex2 third vertex of the triangle\n * @param distanceTol optional tolerance used to check if ray is parallel to the triangle or if we have line\n * intersection but not ray intersection (if tolerance is not provided, Geometry.smallMetricDistance is used)\n * @param parameterTol optional tolerance used to allow intersections just beyond an edge/vertex in barycentric\n * coordinate space (if tolerance is not provided, Geometry.smallFloatingPoint is used)\n * @param result optional pre-allocated object to fill and return\n * @returns the intersection point if ray intersects the triangle. Otherwise, return undefined.\n */\n public intersectionWithTriangle(\n vertex0: Point3d, vertex1: Point3d, vertex2: Point3d, distanceTol?: number, parameterTol?: number, result?: Point3d,\n ): Point3d | undefined {\n /**\n * Let (w,u,v) be the barycentric coordinates of point P wrt the triangle (v0,v1,v2), such that\n * P = w*v0 + u*v1 + v*v2 = (1-u-v)*v0 + u*v1 + v*v2 = v0 + u*(v1-v0) + v*(v2-v0)\n *\n * Then if the ray given by rayOrigin + t*rayVector intersects the triangle at P, we have\n * v0 + u*(v1-v0) + v*(v2-v0) = rayOrigin + t*rayVector\n *\n * This equation can be reformulated as the following linear system:\n *\n * [ | | | ] [t] [ | ]\n * [-rayVector v1-v0 v2-v0] [u] = [rayOrigin - v0]\n * [ | | | ] [v] [ | ]\n *\n * Then to find t, u, and v, use Cramer's Rule, the formulation of matrix determinant as column triple product,\n * and the fact that swapping any 2 vectors in the triple product negates it:\n *\n * t = (v2-v0).(rayOrigin - v0) x (v1-v0) / (v1-v0).rayVector x (v2-v0)\n * u = (rayOrigin - v0).rayVector x (v2-v0) / (v1-v0).rayVector x (v2-v0)\n * v = -rayVector.(rayOrigin - v0) x (v1-v0) / (v1-v0).rayVector x (v2-v0)\n *\n * Note that we verify 0 <= u,v,w <= 1. To do so we only need to check 0 <= u <= 1, 0 <= v, and u+v <= 1:\n * these 4 checks guarantee that v <= 1 and 0 <= u+v, and so with w = 1-(u+v), we have 0 <= w <= 1.\n *\n * More info be found at https://en.wikipedia.org/wiki/Moller-Trumbore_intersection_algorithm.\n */\n if (distanceTol === undefined || distanceTol < 0) // we explicitly allow zero tolerance\n distanceTol = Geometry.smallMetricDistance;\n if (parameterTol === undefined || parameterTol < 0) // we explicitly allow zero tolerance\n parameterTol = Geometry.smallFloatingPoint;\n const edge1 = Ray3d._workVector0 = Vector3d.createStartEnd(vertex0, vertex1, Ray3d._workVector0);\n const edge2 = Ray3d._workVector1 = Vector3d.createStartEnd(vertex0, vertex2, Ray3d._workVector1);\n const h = Ray3d._workVector2 = this.direction.crossProduct(edge2, Ray3d._workVector2);\n const a = edge1.dotProduct(h);\n if (a >= -distanceTol && a <= distanceTol)\n return undefined; // ray is parallel to the triangle (includes coplanar case)\n const f = 1.0 / a;\n const s = Ray3d._workVector3 = Vector3d.createStartEnd(vertex0, this.origin, Ray3d._workVector3);\n let u = f * s.dotProduct(h);\n if (u < 0.0) {\n if (u >= -parameterTol)\n u = 0.0;\n else\n return undefined; // ray does not intersect the triangle\n } else if (u > 1.0) {\n if (u <= 1.0 + parameterTol)\n u = 1.0;\n else\n return undefined; // ray does not intersect the triangle\n }\n const q = Ray3d._workVector4 = s.crossProduct(edge1, Ray3d._workVector4);\n let v = f * this.direction.dotProduct(q);\n if (v < 0.0) {\n if (v >= -parameterTol)\n v = 0.0;\n else\n return undefined; // ray does not intersect the triangle\n } else if (u + v > 1.0 + parameterTol) {\n return undefined; // ray does not intersect the triangle\n }\n // at this stage, we know the line (parameterized as the ray) intersects the triangle\n const t = f * edge2.dotProduct(q);\n if (t < -distanceTol) // line intersection but not ray intersection\n return undefined;\n return this.origin.plusScaled(this.direction, t, result); // ray intersection\n }\n /**\n * Return the shortest vector `v` to `targetPoint` from the line defined by this ray.\n * * If the projection of `targetPoint` onto the line defined by this ray is q, then `v = targetPoint - q`.\n */\n public perpendicularPartOfVectorToTarget(targetPoint: XYAndZ, result?: Vector3d): Vector3d {\n const vectorV = Vector3d.createStartEnd(this.origin, targetPoint);\n const uu = this.direction.magnitudeSquared();\n const uv = this.direction.dotProductStartEnd(this.origin, targetPoint);\n const fraction = Geometry.safeDivideFraction(uv, uu, 0.0);\n return vectorV.plusScaled(this.direction, -fraction, result);\n }\n /**\n * Determine if two rays intersect, or are fully overlapped, or parallel but not coincident, or skew.\n * * Return a CurveLocationDetailPair which contains fraction and point on each ray and has\n * annotation (in member `approachType`) indicating one of these relationships:\n * * CurveCurveApproachType.Intersection -- the rays have a simple intersection, at fractions indicated\n * in detailA and detailB\n * * CurveCurveApproachType.PerpendicularChord -- there is pair of where the rays have closest approach.\n * The rays are skew in space.\n * * CurveCurveApproachType.CoincidentGeometry -- the rays are the same unbounded line in space. The\n * fractions and points are a representative single common point.\n * * CurveCurveApproachType.Parallel -- the rays are parallel (and not coincident). The two points are\n * at the minimum distance\n */\n public static closestApproachRay3dRay3d(rayA: Ray3d, rayB: Ray3d): CurveLocationDetailPair {\n const intersectionFractions = Vector2d.create();\n let fractionA, fractionB;\n let pointA, pointB;\n let pairType;\n if (\n SmallSystem.ray3dXYZUVWClosestApproachUnbounded(\n rayA.origin.x, rayA.origin.y, rayA.origin.z, rayA.direction.x, rayA.direction.y, rayA.direction.z,\n rayB.origin.x, rayB.origin.y, rayB.origin.z, rayB.direction.x, rayB.direction.y, rayB.direction.z,\n intersectionFractions,\n )\n ) {\n fractionA = intersectionFractions.x;\n fractionB = intersectionFractions.y;\n pointA = rayA.fractionToPoint(fractionA);\n pointB = rayB.fractionToPoint(fractionB);\n pairType = pointA.isAlmostEqualMetric(pointB) ?\n CurveCurveApproachType.Intersection : CurveCurveApproachType.PerpendicularChord;\n } else {\n fractionB = 0.0;\n fractionA = rayA.pointToFraction(rayB.origin);\n pointA = rayA.fractionToPoint(fractionA);\n pointB = rayB.fractionToPoint(fractionB);\n pairType = pointA.isAlmostEqualMetric(pointB) ?\n CurveCurveApproachType.CoincidentGeometry : CurveCurveApproachType.ParallelGeometry;\n }\n const pair = CurveLocationDetailPair.createCapture(\n CurveLocationDetail.createRayFractionPoint(rayA, fractionA, rayA.fractionToPoint(fractionA)),\n CurveLocationDetail.createRayFractionPoint(rayB, fractionB, rayB.fractionToPoint(fractionB)));\n pair.approachType = pairType;\n return pair;\n }\n /**\n * Return a ray with `ray.origin` interpolated between `pt1` and `pt2` at the given `fraction`\n * and `ray.direction` set to the vector from `pt1` to `pt2` multiplied by the given `tangentScale`.\n * @param pt1 start point of the interpolation.\n * @param fraction fractional position between points.\n * @param pt2 end point of the interpolation.\n * @param tangentScale scale factor to apply to the startToEnd vector.\n * @param result optional receiver.\n */\n public static interpolatePointAndTangent(\n pt1: XYAndZ, fraction: number, pt2: XYAndZ, tangentScale: number, result?: Ray3d,\n ): Ray3d {\n result = result ?? Ray3d.createZero();\n const dx = pt2.x - pt1.x;\n const dy = pt2.y - pt1.y;\n const dz = pt2.z - pt1.z;\n result.direction.set(tangentScale * dx, tangentScale * dy, tangentScale * dz);\n if (fraction <= 0.5)\n result.origin.set(pt1.x + fraction * dx, pt1.y + fraction * dy, pt1.z + fraction * dz);\n else {\n const t: number = fraction - 1.0;\n result.origin.set(pt2.x + t * dx, pt2.y + t * dy, pt2.z + t * dz);\n }\n return result;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReusableObjectCache.js","sourceRoot":"","sources":["../../../src/geometry3d/ReusableObjectCache.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD;;;;GAIG;AACH,MAAM,OAAgB,mBAAmB;IAC/B,cAAc,CAAM;IACpB,QAAQ,CAAS;IACjB,UAAU,CAAS;IACnB,SAAS,CAAS;IAC1B;;OAEG;IACH;QACE,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;IACrB,CAAC;IAKD;;;;;OAKG;IACI,WAAW,CAAC,IAAmB;QACpC,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD;;;OAGG;IACI,aAAa;QAClB,IAAI,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC;QACrC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,IAAI,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YAC7B,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;;OAGG;IACI,cAAc,CAAC,IAAS;QAC7B,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF;AACD;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,mBAAqC;IAC9E;;OAEG;IACH;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IACD;;;;MAIE;IACQ,cAAc,CAAC,YAAoB,EAAE,EAAE,eAAuB,GAAG;QACzE,OAAO,IAAI,gBAAgB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACvD,CAAC;IACD,0CAA0C;IAChC,aAAa,CAAC,IAAsB;QAC5C,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;IACD;;;OAGG;IACI,WAAW,CAAC,MAA4B;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"ReusableObjectCache.js","sourceRoot":"","sources":["../../../src/geometry3d/ReusableObjectCache.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD;;;;GAIG;AACH,MAAM,OAAgB,mBAAmB;IAC/B,cAAc,CAAM;IACpB,QAAQ,CAAS;IACjB,UAAU,CAAS;IACnB,SAA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C,IAAsB;QAC5C,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;IACD;;;OAGG;IACI,WAAW,CAAC,MAA4B;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;CACF","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 ArraysAndInterfaces\n */\n\nimport { GrowableXYZArray } from \"./GrowableXYZArray\";\nimport { IndexedXYZCollection } from \"./IndexedXYZCollection\";\n\n/**\n * Abstract class managing an array of objects of type T, available for reuse by trusted callers.\n * * Derived class must implement `createForCache` and `clearForCache`.\n * @public\n */\nexport abstract class ReusableObjectCache<T> {\n private _cachedObjects: T[];\n private _numDrop: number;\n private _numCreate: number;\n private _numReuse: number;\n /**\n * Create a new cache for objects of type T.\n */\n protected constructor() {\n this._cachedObjects = [];\n this._numDrop = 0;\n this._numCreate = 0;\n this._numReuse = 0;\n }\n /** Create a new, ready-to-use object. */\n protected abstract createForCache(): T;\n /** Tidy up `data` so it can be reused. */\n protected abstract clearForCache(data: T): void;\n /**\n * Present `data` for storage in the cache, and hence reuse by any subsequent [[grabFromCache]].\n * * `data` will be sent to [[clearForCache]].\n * * The caller should never refer to `data` again.\n * @param data object to return to the cache.\n */\n public dropToCache(data: T | undefined) {\n if (data) {\n this._numDrop++;\n this.clearForCache(data);\n this._cachedObjects.push(data);\n }\n }\n /**\n * Grab an object from the cache.\n * * The returned object becomes property of the caller: the cache does not remember it for any further management.\n */\n public grabFromCache(): T {\n let data = this._cachedObjects.pop();\n if (data === undefined) {\n data = this.createForCache();\n this._numCreate++;\n } else {\n this._numReuse++;\n }\n return data;\n }\n /**\n * Drop multiple objects to the cache.\n * @param data on input, the data to drop. On output, data is an empty array.\n */\n public dropAllToCache(data: T[]) {\n while (data.length > 0) {\n this.dropToCache(data.pop());\n }\n }\n}\n/**\n * Cache of [[GrowableXYZArray]].\n * * Example usage includes clipping methods that can be structured to have disciplined reuse of a small number of arrays for a large number of steps.\n * @public\n */\nexport class GrowableXYZArrayCache extends ReusableObjectCache<GrowableXYZArray> {\n /**\n * Create a new cache for [[GrowableXYZArray]] objects.\n */\n public constructor() {\n super();\n }\n /**\n * Create a new, ready-to-use [[GrowableXYZArray]].\n * @param numPoints initial capacity in xyz triples (default 10)\n * @param growthFactor reallocation expansion (default 1.5)\n */\n protected createForCache(numPoints: number = 10, growthFactor: number = 1.5): GrowableXYZArray {\n return new GrowableXYZArray(numPoints, growthFactor);\n }\n /** Tidy up `data` so it can be reused. */\n protected clearForCache(data: GrowableXYZArray): void {\n data.length = 0;\n }\n /**\n * Grab an array from the cache and immediately fill from a source.\n * @param source xyz to copy into the returned array.\n */\n public grabAndFill(source: IndexedXYZCollection): GrowableXYZArray {\n const dest = this.grabFromCache();\n dest.pushFrom(source);\n return dest;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Segment1d.js","sourceRoot":"","sources":["../../../src/geometry3d/Segment1d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,SAAS;IACpB,uBAAuB;IAChB,EAAE,CAAS;IAClB,qBAAqB;IACd,EAAE,CAAS;IAClB,YAAoB,EAAU,EAAE,EAAU;QACxC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IACD;;;;OAIG;IACI,GAAG,CAAC,EAAU,EAAE,EAAU,IAAI,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC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AAI,MAAM;gBAClB,EAAE,GAAG,CAAC,CAAC;YACT,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM;gBAClB,EAAE,GAAG,CAAC,CAAC;YACT,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC;gBAC3C,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\n\r\n/**\r\n * * A Segment1d is an interval of an axis named x.\r\n * * The interval is defined by two values x0 and x1.\r\n * * The x0 and x1 values can be in either order.\r\n * * if `x0 < x1` fractional coordinates within the segment move from left to right.\r\n * * if `x0 > x1` fractional coordinates within the segment move from right to left.\r\n * * This differs from a Range1d in that:\r\n * * For a Range1d the reversed ordering of its limit values means \"empty interval\".\r\n * * For a Segment1d the reversed ordering is a real interval but fractional positions move backwards.\r\n * * The segment is parameterized with a fraction\r\n * * * Fraction 0 is the start (`x0`)\r\n * * * Fraction 1 is the end (`x1`)\r\n * * * The fraction equation is `x = x0 + fraction * (x1-x0)` or (equivalently) `x = (1-fraction) * x0 + fraction * x1`\r\n * @public\r\n */\r\nexport class Segment1d {\r\n /** start coordinate */\r\n public x0: number;\r\n /** end coordinate */\r\n public x1: number;\r\n private constructor(x0: number, x1: number) {\r\n this.x0 = x0;\r\n this.x1 = x1;\r\n }\r\n /**\r\n * replace both end values.\r\n * @param x0 new x0 value\r\n * @param x1 new y0 value\r\n */\r\n public set(x0: number, x1: number) { this.x0 = x0, this.x1 = x1; }\r\n /**\r\n * shift (translate) the segment along its axis by adding `dx` to both `x0` and `x1`.\r\n * @param dx value to add to both x0 and x1\r\n */\r\n public shift(dx: number) { this.x0 += dx, this.x1 += dx; }\r\n /**\r\n * create segment1d with given end values\r\n * @param x0 start value\r\n * @param x1 end value\r\n * @param result optional pre-existing result to be reinitialized.\r\n */\r\n public static create(x0: number = 0, x1: number = 1, result?: Segment1d): Segment1d {\r\n if (!result)\r\n return new Segment1d(x0, x1);\r\n result.set(x0, x1);\r\n return result;\r\n }\r\n /**\r\n * Copy both end values from other Segment1d\r\n * @param other source Segment1d\r\n */\r\n public setFrom(other: Segment1d) { this.x0 = other.x0; this.x1 = other.x1; }\r\n /**\r\n * clone this Segment1d, return as a separate object.\r\n */\r\n public clone(): Segment1d { return new Segment1d(this.x0, this.x1); }\r\n /**\r\n * Returns true if both coordinates (`x0` and `x1`) are in the 0..1 range.\r\n */\r\n public get isIn01() {\r\n return Geometry.isIn01(this.x0) && Geometry.isIn01(this.x1);\r\n\r\n }\r\n /**\r\n * Evaluate the segment at fractional position\r\n * @returns position within the segment\r\n * @param fraction fractional position within this segment\r\n */\r\n public fractionToPoint(fraction: number): number { return Geometry.interpolate(this.x0, fraction, this.x1); }\r\n /**\r\n * Return the signed start-to-end shift (aka signed distance)\r\n */\r\n public signedDelta(): number { return this.x1 - this.x0; }\r\n /**\r\n * Return the absolute start-to-end shift (aka distance)\r\n */\r\n public absoluteDelta(): number { return Math.abs(this.x1 - this.x0); }\r\n /**\r\n * * swap the x0 and x1 member values.\r\n * * This makes the fractionToPoint evaluates reverse direction.\r\n */\r\n public reverseInPlace(): void { const x = this.x0; this.x0 = this.x1; this.x1 = x; }\r\n /**\r\n * * if `x1-x0` multiplied by the scale factor is (strictly) negative, swap the x0 and x1 member values.\r\n * * This makes the fractionToPoint evaluates reverse direction.\r\n */\r\n public reverseIfNeededForDeltaSign(sign: number = 1): void {\r\n if (sign * (this.x1 - this.x0) < 0)\r\n this.reverseInPlace();\r\n }\r\n /**\r\n * Near equality test, using Geometry.isSameCoordinate for tolerances.\r\n */\r\n public isAlmostEqual(other: Segment1d): boolean {\r\n return Geometry.isSameCoordinate(this.x0, other.x0) && Geometry.isSameCoordinate(this.x1, other.x1);\r\n }\r\n /**\r\n * Return true if the segment limits are (exactly) 0 and 1\r\n */\r\n public get isExact01(): boolean { return this.x0 === 0.0 && this.x1 === 1.0; }\r\n /**\r\n * Return true if the segment limits are (exactly) 1 and 0\r\n */\r\n public get isExact01Reversed(): boolean { return this.x0 === 1.0 && this.x1 === 0.0; }\r\n\r\n /** On input, `this` is an interval of a line. On output, the interval has been clipped to positive parts of a linear function\r\n * * f0 and f1 are values at parameter values 0 and 1 (which are in general NOT x0 and x1)\r\n * * From that determine where the segment crosses function value 0.\r\n * * The segment contains some interval in the same parameter space.\r\n * * Clip the segment to the positive part of the space.\r\n * * Return true (and modify the segment) if any of the segment remains.\r\n * * Return false (but without modifying the segment) if the active part is entirely out.\r\n */\r\n public clipBy01FunctionValuesPositive(f0: number, f1: number): boolean {\r\n const df01 = f1 - f0;\r\n const fA = f0 + this.x0 * df01;\r\n const fB = f0 + this.x1 * df01;\r\n const dfAB = fB - fA;\r\n if (fA > 0) {\r\n if (fB >= 0) return true; // inside at both ends\r\n /** There is an inside to outside crossing. The division is safe ... (and value between 0 and 1) */\r\n const u = -fA / dfAB;\r\n this.x1 = this.x0 + u * (this.x1 - this.x0);\r\n return true;\r\n } else if (fA < 0) {\r\n if (fB < 0) return false; // outside at both ends.\r\n /** There is an outside to inside crossing crossing. The division is safe ... (and value between 0 and 1) */\r\n const u = -fA / dfAB;\r\n this.x0 = this.x0 + u * (this.x1 - this.x0);\r\n return true;\r\n }\r\n /** fA is on the cut. fB determines the entire segment. */\r\n return fB > 0;\r\n }\r\n /**\r\n * * On input, (f0,f1) is a (directed) segment.\r\n * * On output, it is restricted to (0,1) while maintaining direction\r\n * * If the clip leaves nothing, leave this segment alone and return false.\r\n * * If the clip leaves something, update this segment and return true.\r\n * @param clamp0 whether to clamp the smaller number to 0. Default value is true.\r\n * @param clamp1 whether to clamp the larger number to 1. Default value is true.\r\n * @param allowSingleton whether to return true for an interval clipped to a single number (x0 === x1). Default value is false.\r\n * @return whether this interval was clipped\r\n */\r\n public clampDirectedTo01(clamp0: boolean = true, clamp1: boolean = true, allowSingleton: boolean = false): boolean {\r\n let x0 = this.x0;\r\n let x1 = this.x1;\r\n if (x1 > x0) {\r\n if (x0 < 0 && clamp0)\r\n x0 = 0;\r\n if (x1 > 1 && clamp1)\r\n x1 = 1;\r\n if (x0 > x1 || (x0 === x1 && !allowSingleton))\r\n return false;\r\n } else {\r\n if (x0 > 1 && clamp1)\r\n x0 = 1;\r\n if (x1 < 0 && clamp0)\r\n x1 = 0;\r\n if (x0 < x1 || (x0 === x1 && !allowSingleton))\r\n return false;\r\n }\r\n this.set(x0, x1);\r\n return true;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"Segment1d.js","sourceRoot":"","sources":["../../../src/geometry3d/Segment1d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,SAAS;IACpB,uBAAuB;IAChB,EAAE,CAAS;IAClB,qBAAqB;IACd,EAAE,CAAS;IAClB,YAAoB,EAAU,EAAE,EAAU;QACxC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IACD;;;;OAIG;IACI,GAAG,CAAC,EAAU,EAAE,EAAU,IAAI,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IAClE;;;OAGG;IACI,KAAK,CAAC,EAAU,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC1D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E,IAAI,CAAC,cAAc,CAAC;gBAC3C,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { Geometry } from \"../Geometry\";\n\n/**\n * * A Segment1d is an interval of an axis named x.\n * * The interval is defined by two values x0 and x1.\n * * The x0 and x1 values can be in either order.\n * * if `x0 < x1` fractional coordinates within the segment move from left to right.\n * * if `x0 > x1` fractional coordinates within the segment move from right to left.\n * * This differs from a Range1d in that:\n * * For a Range1d the reversed ordering of its limit values means \"empty interval\".\n * * For a Segment1d the reversed ordering is a real interval but fractional positions move backwards.\n * * The segment is parameterized with a fraction\n * * * Fraction 0 is the start (`x0`)\n * * * Fraction 1 is the end (`x1`)\n * * * The fraction equation is `x = x0 + fraction * (x1-x0)` or (equivalently) `x = (1-fraction) * x0 + fraction * x1`\n * @public\n */\nexport class Segment1d {\n /** start coordinate */\n public x0: number;\n /** end coordinate */\n public x1: number;\n private constructor(x0: number, x1: number) {\n this.x0 = x0;\n this.x1 = x1;\n }\n /**\n * replace both end values.\n * @param x0 new x0 value\n * @param x1 new y0 value\n */\n public set(x0: number, x1: number) { this.x0 = x0, this.x1 = x1; }\n /**\n * shift (translate) the segment along its axis by adding `dx` to both `x0` and `x1`.\n * @param dx value to add to both x0 and x1\n */\n public shift(dx: number) { this.x0 += dx, this.x1 += dx; }\n /**\n * create segment1d with given end values\n * @param x0 start value\n * @param x1 end value\n * @param result optional pre-existing result to be reinitialized.\n */\n public static create(x0: number = 0, x1: number = 1, result?: Segment1d): Segment1d {\n if (!result)\n return new Segment1d(x0, x1);\n result.set(x0, x1);\n return result;\n }\n /**\n * Copy both end values from other Segment1d\n * @param other source Segment1d\n */\n public setFrom(other: Segment1d) { this.x0 = other.x0; this.x1 = other.x1; }\n /**\n * clone this Segment1d, return as a separate object.\n */\n public clone(): Segment1d { return new Segment1d(this.x0, this.x1); }\n /**\n * Returns true if both coordinates (`x0` and `x1`) are in the 0..1 range.\n */\n public get isIn01() {\n return Geometry.isIn01(this.x0) && Geometry.isIn01(this.x1);\n\n }\n /**\n * Evaluate the segment at fractional position\n * @returns position within the segment\n * @param fraction fractional position within this segment\n */\n public fractionToPoint(fraction: number): number { return Geometry.interpolate(this.x0, fraction, this.x1); }\n /**\n * Return the signed start-to-end shift (aka signed distance)\n */\n public signedDelta(): number { return this.x1 - this.x0; }\n /**\n * Return the absolute start-to-end shift (aka distance)\n */\n public absoluteDelta(): number { return Math.abs(this.x1 - this.x0); }\n /**\n * * swap the x0 and x1 member values.\n * * This makes the fractionToPoint evaluates reverse direction.\n */\n public reverseInPlace(): void { const x = this.x0; this.x0 = this.x1; this.x1 = x; }\n /**\n * * if `x1-x0` multiplied by the scale factor is (strictly) negative, swap the x0 and x1 member values.\n * * This makes the fractionToPoint evaluates reverse direction.\n */\n public reverseIfNeededForDeltaSign(sign: number = 1): void {\n if (sign * (this.x1 - this.x0) < 0)\n this.reverseInPlace();\n }\n /**\n * Near equality test, using Geometry.isSameCoordinate for tolerances.\n */\n public isAlmostEqual(other: Segment1d): boolean {\n return Geometry.isSameCoordinate(this.x0, other.x0) && Geometry.isSameCoordinate(this.x1, other.x1);\n }\n /**\n * Return true if the segment limits are (exactly) 0 and 1\n */\n public get isExact01(): boolean { return this.x0 === 0.0 && this.x1 === 1.0; }\n /**\n * Return true if the segment limits are (exactly) 1 and 0\n */\n public get isExact01Reversed(): boolean { return this.x0 === 1.0 && this.x1 === 0.0; }\n\n /** On input, `this` is an interval of a line. On output, the interval has been clipped to positive parts of a linear function\n * * f0 and f1 are values at parameter values 0 and 1 (which are in general NOT x0 and x1)\n * * From that determine where the segment crosses function value 0.\n * * The segment contains some interval in the same parameter space.\n * * Clip the segment to the positive part of the space.\n * * Return true (and modify the segment) if any of the segment remains.\n * * Return false (but without modifying the segment) if the active part is entirely out.\n */\n public clipBy01FunctionValuesPositive(f0: number, f1: number): boolean {\n const df01 = f1 - f0;\n const fA = f0 + this.x0 * df01;\n const fB = f0 + this.x1 * df01;\n const dfAB = fB - fA;\n if (fA > 0) {\n if (fB >= 0) return true; // inside at both ends\n /** There is an inside to outside crossing. The division is safe ... (and value between 0 and 1) */\n const u = -fA / dfAB;\n this.x1 = this.x0 + u * (this.x1 - this.x0);\n return true;\n } else if (fA < 0) {\n if (fB < 0) return false; // outside at both ends.\n /** There is an outside to inside crossing crossing. The division is safe ... (and value between 0 and 1) */\n const u = -fA / dfAB;\n this.x0 = this.x0 + u * (this.x1 - this.x0);\n return true;\n }\n /** fA is on the cut. fB determines the entire segment. */\n return fB > 0;\n }\n /**\n * * On input, (f0,f1) is a (directed) segment.\n * * On output, it is restricted to (0,1) while maintaining direction\n * * If the clip leaves nothing, leave this segment alone and return false.\n * * If the clip leaves something, update this segment and return true.\n * @param clamp0 whether to clamp the smaller number to 0. Default value is true.\n * @param clamp1 whether to clamp the larger number to 1. Default value is true.\n * @param allowSingleton whether to return true for an interval clipped to a single number (x0 === x1). Default value is false.\n * @return whether this interval was clipped\n */\n public clampDirectedTo01(clamp0: boolean = true, clamp1: boolean = true, allowSingleton: boolean = false): boolean {\n let x0 = this.x0;\n let x1 = this.x1;\n if (x1 > x0) {\n if (x0 < 0 && clamp0)\n x0 = 0;\n if (x1 > 1 && clamp1)\n x1 = 1;\n if (x0 > x1 || (x0 === x1 && !allowSingleton))\n return false;\n } else {\n if (x0 > 1 && clamp1)\n x0 = 1;\n if (x1 < 0 && clamp0)\n x1 = 0;\n if (x0 < x1 || (x0 === x1 && !allowSingleton))\n return false;\n }\n this.set(x0, x1);\n return true;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"S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4BAA4B,CAAC,KAAwB;QACjE,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IACM,WAAW;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;IACM,QAAQ;QACb,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IACM,kBAAkB,CAAC,UAAkB;QAC1C,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IACM,mBAAmB;QACxB,OAAO,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module CartesianGeometry\r\n */\r\n\r\nimport { CurveChain } from \"../curve/CurveCollection\";\r\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\r\nimport { AnyRegion } from \"../curve/CurveTypes\";\r\nimport { LineString3d } from \"../curve/LineString3d\";\r\nimport { Loop } from \"../curve/Loop\";\r\nimport { ParityRegion } from \"../curve/ParityRegion\";\r\nimport { RegionOps } from \"../curve/RegionOps\";\r\nimport { UnionRegion } from \"../curve/UnionRegion\";\r\nimport { IndexedReadWriteXYZCollection, IndexedXYZCollection } from \"./IndexedXYZCollection\";\r\nimport { Point3d } from \"./Point3dVector3d\";\r\nimport { PolygonOps } from \"./PolygonOps\";\r\nimport { Range3d } from \"./Range\";\r\nimport { Ray3d } from \"./Ray3d\";\r\nimport { XAndY } from \"./XYZProps\";\r\n\r\n/** Abstract base class for area-related queries of an xy-loop.\r\n * * Subclasses have particular logic for `Loop` and polygon data.\r\n * @internal\r\n */\r\nabstract class SimpleRegionCarrier {\r\n /** Fractions for interior point search. */\r\n protected searchFractions: number[] = [0.2349, 0.4142, 0.6587, 0.8193];\r\n\r\n public abstract classifyPointXY(xy: XAndY): number | undefined;\r\n // Find any point on an edge.\r\n // evaluate tangent.\r\n // move to left or right according to signedArea, producing an interior point for the loop.\r\n public abstract getAnyInteriorPoint(): Point3d | undefined;\r\n /**\r\n * * grab the loop formatted as a simple polygon.\r\n * * stroke if necessary.\r\n */\r\n public abstract grabPolygon(): IndexedReadWriteXYZCollection | undefined;\r\n /**\r\n * * grab the loop formatted as a strongly typed loop object\r\n */\r\n public abstract grabLoop(): Loop | undefined;\r\n /**\r\n * (Property access) Return the signed area of the loop\r\n */\r\n public abstract get signedArea(): number;\r\n /**\r\n * If the current `signedArea` has different sign versus `targetSign`, reverse the loop in place.\r\n */\r\n public abstract reverseForAreaSign(targetSign: number): void;\r\n /**\r\n * Given a region boundary tangent, construct a point interior to the region.\r\n * @param ray point and tangent on an edge of the region (modified on return)\r\n */\r\n protected constructInteriorPoint(ray: Ray3d): Point3d | undefined {\r\n ray.direction.z = 0.0;\r\n if (!ray.direction.normalizeInPlace())\r\n return undefined; // loop has zero length edge, or a vertical (gap) edge\r\n ray.direction.rotate90CCWXY(ray.direction);\r\n if (this.signedArea < 0.0)\r\n ray.direction.scaleInPlace(-1.0); // aim toward the region interior\r\n const refDistance = Math.sqrt(Math.abs(this.signedArea));\r\n const candidatePoint = Point3d.create();\r\n for (let fraction = 1.0e-5; fraction < 3; fraction *= 5.0) {\r\n ray.fractionToPoint(fraction * refDistance, candidatePoint);\r\n if (1 === this.classifyPointXY(candidatePoint))\r\n return candidatePoint;\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Implement `SimpleRegionCarrier` queries with the area as a polygon carried in an `IndexedReadWriteXYZCollection`.\r\n */\r\nclass PolygonCarrier extends SimpleRegionCarrier {\r\n public data: IndexedReadWriteXYZCollection;\r\n private _signedArea: number;\r\n public get signedArea(): number { return this._signedArea; }\r\n public constructor(data: IndexedReadWriteXYZCollection) {\r\n super();\r\n this.data = data;\r\n this._signedArea = PolygonOps.areaXY(data);\r\n }\r\n /**\r\n * classify xy parts of point wrt this loop.\r\n * @param xy\r\n * @internal\r\n */\r\n public classifyPointXY(xy: XAndY): number | undefined {\r\n return PolygonOps.classifyPointInPolygonXY(xy.x, xy.y, this.data);\r\n }\r\n /** Return some point \"inside\". */\r\n public getAnyInteriorPoint(): Point3d | undefined {\r\n for (let childIndex = 0; childIndex < this.data.length; childIndex++) {\r\n for (const fraction of this.searchFractions) {\r\n const q = this.constructInteriorPointNearEdge(childIndex, fraction);\r\n if (q !== undefined)\r\n return q;\r\n }\r\n }\r\n return undefined;\r\n }\r\n public grabPolygon(): IndexedReadWriteXYZCollection | undefined { return this.data; }\r\n public grabLoop(): Loop | undefined {\r\n return Loop.createPolygon(this.data);\r\n }\r\n public reverseForAreaSign(targetSign: number) {\r\n if (targetSign * this._signedArea < 0.0) {\r\n this.data.reverseInPlace();\r\n this._signedArea *= -1.0;\r\n }\r\n }\r\n public constructInteriorPointNearEdge(edgeIndex: number, fractionAlong: number): Point3d | undefined {\r\n if (edgeIndex + 1 < this.data.length) {\r\n const ray = Ray3d.createCapture(\r\n this.data.interpolateIndexIndex(edgeIndex, fractionAlong, edgeIndex + 1)!,\r\n this.data.vectorIndexIndex(edgeIndex, edgeIndex + 1)!\r\n );\r\n return this.constructInteriorPoint(ray);\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Implement `SimpleRegionCarrier` queries with the area as a strongly typed `Loop`.\r\n */\r\nclass LoopCarrier extends SimpleRegionCarrier {\r\n public data: Loop;\r\n private _signedArea: number;\r\n public get signedArea(): number { return this._signedArea; }\r\n public constructor(data: Loop) {\r\n super();\r\n this.data = data;\r\n const areaMoments = RegionOps.computeXYAreaMoments(data);\r\n this._signedArea = areaMoments !== undefined ? areaMoments.quantitySum : 0.0;\r\n }\r\n /**\r\n * classify xy parts of point wrt this loop.\r\n * @param xy\r\n * @internal\r\n */\r\n public classifyPointXY(xy: XAndY): number | undefined {\r\n return RegionOps.testPointInOnOutRegionXY(this.data, xy.x, xy.y);\r\n }\r\n public constructInteriorPointNearChild(childIndex: number, fractionAlong: number): Point3d | undefined {\r\n if (childIndex < this.data.children.length) {\r\n const ray = this.data.children[childIndex].fractionToPointAndDerivative(fractionAlong);\r\n return this.constructInteriorPoint(ray);\r\n }\r\n return undefined;\r\n }\r\n /** Return some point \"inside\". */\r\n public getAnyInteriorPoint(): Point3d | undefined {\r\n for (let childIndex = 0; childIndex < this.data.children.length; childIndex++) {\r\n for (const fraction of this.searchFractions) {\r\n const q = this.constructInteriorPointNearChild(childIndex, fraction);\r\n if (q !== undefined)\r\n return q;\r\n }\r\n }\r\n return undefined;\r\n }\r\n public grabPolygon(): IndexedReadWriteXYZCollection | undefined {\r\n const strokes = this.data.cloneStroked();\r\n if (strokes instanceof CurveChain) {\r\n const linestring = LineString3d.create();\r\n for (const child of strokes.children) {\r\n if (child instanceof CurvePrimitive) {\r\n child.emitStrokes(linestring);\r\n }\r\n }\r\n return linestring.numPoints() > 0 ? linestring.packedPoints : undefined;\r\n }\r\n return undefined;\r\n }\r\n public grabLoop(): Loop | undefined {\r\n return this.data;\r\n }\r\n public reverseForAreaSign(targetSign: number) {\r\n if (targetSign * this._signedArea < 0.0) {\r\n this.data.reverseChildrenInPlace();\r\n this._signedArea *= -1.0;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * A `SortablePolygon` carries a (single) xy-loop with data useful for sorting for inner-outer structure.\r\n * @internal\r\n */\r\nexport class SortablePolygon {\r\n private _loopCarrier: SimpleRegionCarrier;\r\n public anyPoint?: Point3d;\r\n public sortKey: number;\r\n public range: Range3d;\r\n public parentIndex?: number;\r\n public isHole: boolean;\r\n public outputSetIndex?: number;\r\n /**\r\n *\r\n * @param loop Loop to capture.\r\n */\r\n public constructor(loop: IndexedReadWriteXYZCollection | Loop, range: Range3d) {\r\n if (loop instanceof IndexedReadWriteXYZCollection)\r\n this._loopCarrier = new PolygonCarrier(loop);\r\n else\r\n this._loopCarrier = new LoopCarrier(loop);\r\n this.range = range;\r\n this.sortKey = Math.abs(this._loopCarrier.signedArea);\r\n this.isHole = false;\r\n }\r\n /** Push loop with sort data onto the array.\r\n * * No action if no clear normal.\r\n * * return true if pushed.\r\n */\r\n public static pushPolygon(loops: SortablePolygon[], loop: IndexedReadWriteXYZCollection): boolean {\r\n const range = loop.getRange();\r\n const sortablePolygon = new SortablePolygon(loop, range);\r\n if (sortablePolygon.sortKey > 0.0) {\r\n loops.push(sortablePolygon);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Push loop with sort data onto the array.\r\n * * No action if no clear normal.\r\n * * return true if pushed.\r\n */\r\n public static pushLoop(loops: SortablePolygon[], loop: Loop): boolean {\r\n const range = loop.range();\r\n const sortablePolygon = new SortablePolygon(loop, range);\r\n if (sortablePolygon.sortKey > 0.0) {\r\n loops.push(sortablePolygon);\r\n return true;\r\n }\r\n return false;\r\n }\r\n /** Push loop with sort data onto the array.\r\n * * No action if no clear normal.\r\n * * return true if pushed.\r\n */\r\n private static assignParentsAndDepth(loops: SortablePolygon[]): void {\r\n // Sort largest to smallest ...\r\n loops.sort((loopA: SortablePolygon, loopB: SortablePolygon) => (loopB.sortKey - loopA.sortKey));\r\n // starting with smallest loop, point each loop to smallest containing parent.\r\n for (let i = loops.length; i-- > 0;) {\r\n const thisLoop = loops[i];\r\n const xy = thisLoop._loopCarrier.getAnyInteriorPoint();\r\n if (xy !== undefined) {\r\n // find smallest containing parent (search forward only to hit)\r\n loops[i].parentIndex = undefined;\r\n loops[i].outputSetIndex = undefined;\r\n for (let j = i; j-- > 0;) {\r\n const otherLoop = loops[j];\r\n if (otherLoop.range.containsXY(xy.x, xy.y)) {\r\n if (1 === otherLoop._loopCarrier.classifyPointXY(xy)) {\r\n thisLoop.parentIndex = j;\r\n // The loops are searched from small area to larger. Any other containing loop is larger, so otherLoop must be the smallest.\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static assemblePolygonSet(loops: SortablePolygon[]): IndexedReadWriteXYZCollection[][] {\r\n const outputSets: IndexedReadWriteXYZCollection[][] = [];\r\n\r\n // In large-to-small order:\r\n // If a loop has no parent or has a \"hole\" as parent it is outer.\r\n // otherwise (i.e. it has a non-hole parent) it becomes a hole in the parent.\r\n for (const loopData of loops) {\r\n loopData.isHole = false;\r\n const parentIndex = loopData.parentIndex;\r\n if (parentIndex !== undefined)\r\n loopData.isHole = !loops[parentIndex].isHole;\r\n if (!loopData.isHole) {\r\n loopData._loopCarrier.reverseForAreaSign(1.0);\r\n loopData.outputSetIndex = outputSets.length;\r\n outputSets.push([]);\r\n outputSets[loopData.outputSetIndex].push(loopData._loopCarrier.grabPolygon()!);\r\n } else {\r\n loopData._loopCarrier.reverseForAreaSign(-1.0);\r\n const outputSetIndex = loops[parentIndex!].outputSetIndex!;\r\n outputSets[outputSetIndex].push(loopData._loopCarrier.grabPolygon()!);\r\n }\r\n }\r\n return outputSets;\r\n }\r\n private static assembleLoopSet(loops: SortablePolygon[]): AnyRegion[] {\r\n const outputSets: AnyRegion[] = [];\r\n const numLoops = loops.length;\r\n // In large-to-small order:\r\n // If a loop has no parent or has a \"hole\" as parent it is outer.\r\n // otherwise (i.e. it has a non-hole parent) it becomes a hole in the parent.\r\n for (let candidateIndex = 0; candidateIndex < numLoops; candidateIndex++) {\r\n const candidateData = loops[candidateIndex];\r\n const parentIndex = candidateData.parentIndex;\r\n candidateData.isHole = parentIndex !== undefined ? !loops[parentIndex].isHole : false;\r\n\r\n if (!candidateData.isHole) {\r\n candidateData._loopCarrier.reverseForAreaSign(1.0);\r\n const candidateLoop = candidateData._loopCarrier.grabLoop()!;\r\n let candidateParityRegion: ParityRegion | undefined;\r\n // find all directly contained children . . .\r\n for (let childIndex = candidateIndex + 1; childIndex < numLoops; childIndex++) {\r\n const childData = loops[childIndex];\r\n if (childData.parentIndex === candidateIndex) {\r\n if (candidateParityRegion === undefined) {\r\n candidateParityRegion = ParityRegion.create();\r\n candidateParityRegion.tryAddChild(candidateLoop);\r\n childData._loopCarrier.reverseForAreaSign(-1.0);\r\n candidateParityRegion.tryAddChild(childData._loopCarrier.grabLoop());\r\n } else {\r\n childData._loopCarrier.reverseForAreaSign(-1.0);\r\n candidateParityRegion.tryAddChild(childData._loopCarrier.grabLoop());\r\n }\r\n }\r\n }\r\n if (candidateParityRegion !== undefined)\r\n outputSets.push(candidateParityRegion);\r\n else if (candidateLoop !== undefined)\r\n outputSets.push(candidateLoop);\r\n }\r\n }\r\n return outputSets;\r\n }\r\n\r\n public static sortAsAnyRegion(loops: SortablePolygon[]): AnyRegion {\r\n this.assignParentsAndDepth(loops);\r\n const regions = this.assembleLoopSet(loops);\r\n if (regions.length === 1)\r\n return regions[0];\r\n else {\r\n const unionRegion = UnionRegion.create();\r\n for (const region of regions)\r\n unionRegion.tryAddChild(region);\r\n return unionRegion;\r\n }\r\n }\r\n public static sortAsArrayOfArrayOfPolygons(loops: SortablePolygon[]): IndexedReadWriteXYZCollection[][] {\r\n this.assignParentsAndDepth(loops);\r\n return this.assemblePolygonSet(loops);\r\n }\r\n public grabPolygon(): IndexedXYZCollection | undefined {\r\n return this._loopCarrier.grabPolygon();\r\n }\r\n public grabLoop(): Loop | undefined {\r\n return this._loopCarrier.grabLoop();\r\n }\r\n public reverseForAreaSign(targetSign: number) {\r\n this._loopCarrier.reverseForAreaSign(targetSign);\r\n }\r\n public getAnyInteriorPoint(): Point3d | undefined {\r\n return this._loopCarrier.getAnyInteriorPoint();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SortablePolygon.js","sourceRoot":"","sources":["../../../src/geometry3d/SortablePolygon.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC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,CAAC;IACzC,CAAC;IACM,QAAQ;QACb,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IACM,kBAAkB,CAAC,UAAkB;QAC1C,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IACM,mBAAmB;QACxB,OAAO,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;IACjD,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module CartesianGeometry\n */\n\nimport { CurveChain } from \"../curve/CurveCollection\";\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { AnyRegion } from \"../curve/CurveTypes\";\nimport { LineString3d } from \"../curve/LineString3d\";\nimport { Loop } from \"../curve/Loop\";\nimport { ParityRegion } from \"../curve/ParityRegion\";\nimport { RegionOps } from \"../curve/RegionOps\";\nimport { UnionRegion } from \"../curve/UnionRegion\";\nimport { IndexedReadWriteXYZCollection, IndexedXYZCollection } from \"./IndexedXYZCollection\";\nimport { Point3d } from \"./Point3dVector3d\";\nimport { PolygonOps } from \"./PolygonOps\";\nimport { Range3d } from \"./Range\";\nimport { Ray3d } from \"./Ray3d\";\nimport { XAndY } from \"./XYZProps\";\n\n/** Abstract base class for area-related queries of an xy-loop.\n * * Subclasses have particular logic for `Loop` and polygon data.\n * @internal\n */\nabstract class SimpleRegionCarrier {\n /** Fractions for interior point search. */\n protected searchFractions: number[] = [0.2349, 0.4142, 0.6587, 0.8193];\n\n public abstract classifyPointXY(xy: XAndY): number | undefined;\n // Find any point on an edge.\n // evaluate tangent.\n // move to left or right according to signedArea, producing an interior point for the loop.\n public abstract getAnyInteriorPoint(): Point3d | undefined;\n /**\n * * grab the loop formatted as a simple polygon.\n * * stroke if necessary.\n */\n public abstract grabPolygon(): IndexedReadWriteXYZCollection | undefined;\n /**\n * * grab the loop formatted as a strongly typed loop object\n */\n public abstract grabLoop(): Loop | undefined;\n /**\n * (Property access) Return the signed area of the loop\n */\n public abstract get signedArea(): number;\n /**\n * If the current `signedArea` has different sign versus `targetSign`, reverse the loop in place.\n */\n public abstract reverseForAreaSign(targetSign: number): void;\n /**\n * Given a region boundary tangent, construct a point interior to the region.\n * @param ray point and tangent on an edge of the region (modified on return)\n */\n protected constructInteriorPoint(ray: Ray3d): Point3d | undefined {\n ray.direction.z = 0.0;\n if (!ray.direction.normalizeInPlace())\n return undefined; // loop has zero length edge, or a vertical (gap) edge\n ray.direction.rotate90CCWXY(ray.direction);\n if (this.signedArea < 0.0)\n ray.direction.scaleInPlace(-1.0); // aim toward the region interior\n const refDistance = Math.sqrt(Math.abs(this.signedArea));\n const candidatePoint = Point3d.create();\n for (let fraction = 1.0e-5; fraction < 3; fraction *= 5.0) {\n ray.fractionToPoint(fraction * refDistance, candidatePoint);\n if (1 === this.classifyPointXY(candidatePoint))\n return candidatePoint;\n }\n return undefined;\n }\n}\n\n/**\n * Implement `SimpleRegionCarrier` queries with the area as a polygon carried in an `IndexedReadWriteXYZCollection`.\n */\nclass PolygonCarrier extends SimpleRegionCarrier {\n public data: IndexedReadWriteXYZCollection;\n private _signedArea: number;\n public get signedArea(): number { return this._signedArea; }\n public constructor(data: IndexedReadWriteXYZCollection) {\n super();\n this.data = data;\n this._signedArea = PolygonOps.areaXY(data);\n }\n /**\n * classify xy parts of point wrt this loop.\n * @param xy\n * @internal\n */\n public classifyPointXY(xy: XAndY): number | undefined {\n return PolygonOps.classifyPointInPolygonXY(xy.x, xy.y, this.data);\n }\n /** Return some point \"inside\". */\n public getAnyInteriorPoint(): Point3d | undefined {\n for (let childIndex = 0; childIndex < this.data.length; childIndex++) {\n for (const fraction of this.searchFractions) {\n const q = this.constructInteriorPointNearEdge(childIndex, fraction);\n if (q !== undefined)\n return q;\n }\n }\n return undefined;\n }\n public grabPolygon(): IndexedReadWriteXYZCollection | undefined { return this.data; }\n public grabLoop(): Loop | undefined {\n return Loop.createPolygon(this.data);\n }\n public reverseForAreaSign(targetSign: number) {\n if (targetSign * this._signedArea < 0.0) {\n this.data.reverseInPlace();\n this._signedArea *= -1.0;\n }\n }\n public constructInteriorPointNearEdge(edgeIndex: number, fractionAlong: number): Point3d | undefined {\n if (edgeIndex + 1 < this.data.length) {\n const ray = Ray3d.createCapture(\n this.data.interpolateIndexIndex(edgeIndex, fractionAlong, edgeIndex + 1)!,\n this.data.vectorIndexIndex(edgeIndex, edgeIndex + 1)!\n );\n return this.constructInteriorPoint(ray);\n }\n return undefined;\n }\n}\n\n/**\n * Implement `SimpleRegionCarrier` queries with the area as a strongly typed `Loop`.\n */\nclass LoopCarrier extends SimpleRegionCarrier {\n public data: Loop;\n private _signedArea: number;\n public get signedArea(): number { return this._signedArea; }\n public constructor(data: Loop) {\n super();\n this.data = data;\n const areaMoments = RegionOps.computeXYAreaMoments(data);\n this._signedArea = areaMoments !== undefined ? areaMoments.quantitySum : 0.0;\n }\n /**\n * classify xy parts of point wrt this loop.\n * @param xy\n * @internal\n */\n public classifyPointXY(xy: XAndY): number | undefined {\n return RegionOps.testPointInOnOutRegionXY(this.data, xy.x, xy.y);\n }\n public constructInteriorPointNearChild(childIndex: number, fractionAlong: number): Point3d | undefined {\n if (childIndex < this.data.children.length) {\n const ray = this.data.children[childIndex].fractionToPointAndDerivative(fractionAlong);\n return this.constructInteriorPoint(ray);\n }\n return undefined;\n }\n /** Return some point \"inside\". */\n public getAnyInteriorPoint(): Point3d | undefined {\n for (let childIndex = 0; childIndex < this.data.children.length; childIndex++) {\n for (const fraction of this.searchFractions) {\n const q = this.constructInteriorPointNearChild(childIndex, fraction);\n if (q !== undefined)\n return q;\n }\n }\n return undefined;\n }\n public grabPolygon(): IndexedReadWriteXYZCollection | undefined {\n const strokes = this.data.cloneStroked();\n if (strokes instanceof CurveChain) {\n const linestring = LineString3d.create();\n for (const child of strokes.children) {\n if (child instanceof CurvePrimitive) {\n child.emitStrokes(linestring);\n }\n }\n return linestring.numPoints() > 0 ? linestring.packedPoints : undefined;\n }\n return undefined;\n }\n public grabLoop(): Loop | undefined {\n return this.data;\n }\n public reverseForAreaSign(targetSign: number) {\n if (targetSign * this._signedArea < 0.0) {\n this.data.reverseChildrenInPlace();\n this._signedArea *= -1.0;\n }\n }\n}\n\n/**\n * A `SortablePolygon` carries a (single) xy-loop with data useful for sorting for inner-outer structure.\n * @internal\n */\nexport class SortablePolygon {\n private _loopCarrier: SimpleRegionCarrier;\n public anyPoint?: Point3d;\n public sortKey: number;\n public range: Range3d;\n public parentIndex?: number;\n public isHole: boolean;\n public outputSetIndex?: number;\n /**\n *\n * @param loop Loop to capture.\n */\n public constructor(loop: IndexedReadWriteXYZCollection | Loop, range: Range3d) {\n if (loop instanceof IndexedReadWriteXYZCollection)\n this._loopCarrier = new PolygonCarrier(loop);\n else\n this._loopCarrier = new LoopCarrier(loop);\n this.range = range;\n this.sortKey = Math.abs(this._loopCarrier.signedArea);\n this.isHole = false;\n }\n /** Push loop with sort data onto the array.\n * * No action if no clear normal.\n * * return true if pushed.\n */\n public static pushPolygon(loops: SortablePolygon[], loop: IndexedReadWriteXYZCollection): boolean {\n const range = loop.getRange();\n const sortablePolygon = new SortablePolygon(loop, range);\n if (sortablePolygon.sortKey > 0.0) {\n loops.push(sortablePolygon);\n return true;\n }\n return false;\n }\n /** Push loop with sort data onto the array.\n * * No action if no clear normal.\n * * return true if pushed.\n */\n public static pushLoop(loops: SortablePolygon[], loop: Loop): boolean {\n const range = loop.range();\n const sortablePolygon = new SortablePolygon(loop, range);\n if (sortablePolygon.sortKey > 0.0) {\n loops.push(sortablePolygon);\n return true;\n }\n return false;\n }\n /** Push loop with sort data onto the array.\n * * No action if no clear normal.\n * * return true if pushed.\n */\n private static assignParentsAndDepth(loops: SortablePolygon[]): void {\n // Sort largest to smallest ...\n loops.sort((loopA: SortablePolygon, loopB: SortablePolygon) => (loopB.sortKey - loopA.sortKey));\n // starting with smallest loop, point each loop to smallest containing parent.\n for (let i = loops.length; i-- > 0;) {\n const thisLoop = loops[i];\n const xy = thisLoop._loopCarrier.getAnyInteriorPoint();\n if (xy !== undefined) {\n // find smallest containing parent (search forward only to hit)\n loops[i].parentIndex = undefined;\n loops[i].outputSetIndex = undefined;\n for (let j = i; j-- > 0;) {\n const otherLoop = loops[j];\n if (otherLoop.range.containsXY(xy.x, xy.y)) {\n if (1 === otherLoop._loopCarrier.classifyPointXY(xy)) {\n thisLoop.parentIndex = j;\n // The loops are searched from small area to larger. Any other containing loop is larger, so otherLoop must be the smallest.\n break;\n }\n }\n }\n }\n }\n }\n\n private static assemblePolygonSet(loops: SortablePolygon[]): IndexedReadWriteXYZCollection[][] {\n const outputSets: IndexedReadWriteXYZCollection[][] = [];\n\n // In large-to-small order:\n // If a loop has no parent or has a \"hole\" as parent it is outer.\n // otherwise (i.e. it has a non-hole parent) it becomes a hole in the parent.\n for (const loopData of loops) {\n loopData.isHole = false;\n const parentIndex = loopData.parentIndex;\n if (parentIndex !== undefined)\n loopData.isHole = !loops[parentIndex].isHole;\n if (!loopData.isHole) {\n loopData._loopCarrier.reverseForAreaSign(1.0);\n loopData.outputSetIndex = outputSets.length;\n outputSets.push([]);\n outputSets[loopData.outputSetIndex].push(loopData._loopCarrier.grabPolygon()!);\n } else {\n loopData._loopCarrier.reverseForAreaSign(-1.0);\n const outputSetIndex = loops[parentIndex!].outputSetIndex!;\n outputSets[outputSetIndex].push(loopData._loopCarrier.grabPolygon()!);\n }\n }\n return outputSets;\n }\n private static assembleLoopSet(loops: SortablePolygon[]): AnyRegion[] {\n const outputSets: AnyRegion[] = [];\n const numLoops = loops.length;\n // In large-to-small order:\n // If a loop has no parent or has a \"hole\" as parent it is outer.\n // otherwise (i.e. it has a non-hole parent) it becomes a hole in the parent.\n for (let candidateIndex = 0; candidateIndex < numLoops; candidateIndex++) {\n const candidateData = loops[candidateIndex];\n const parentIndex = candidateData.parentIndex;\n candidateData.isHole = parentIndex !== undefined ? !loops[parentIndex].isHole : false;\n\n if (!candidateData.isHole) {\n candidateData._loopCarrier.reverseForAreaSign(1.0);\n const candidateLoop = candidateData._loopCarrier.grabLoop()!;\n let candidateParityRegion: ParityRegion | undefined;\n // find all directly contained children . . .\n for (let childIndex = candidateIndex + 1; childIndex < numLoops; childIndex++) {\n const childData = loops[childIndex];\n if (childData.parentIndex === candidateIndex) {\n if (candidateParityRegion === undefined) {\n candidateParityRegion = ParityRegion.create();\n candidateParityRegion.tryAddChild(candidateLoop);\n childData._loopCarrier.reverseForAreaSign(-1.0);\n candidateParityRegion.tryAddChild(childData._loopCarrier.grabLoop());\n } else {\n childData._loopCarrier.reverseForAreaSign(-1.0);\n candidateParityRegion.tryAddChild(childData._loopCarrier.grabLoop());\n }\n }\n }\n if (candidateParityRegion !== undefined)\n outputSets.push(candidateParityRegion);\n else if (candidateLoop !== undefined)\n outputSets.push(candidateLoop);\n }\n }\n return outputSets;\n }\n\n public static sortAsAnyRegion(loops: SortablePolygon[]): AnyRegion {\n this.assignParentsAndDepth(loops);\n const regions = this.assembleLoopSet(loops);\n if (regions.length === 1)\n return regions[0];\n else {\n const unionRegion = UnionRegion.create();\n for (const region of regions)\n unionRegion.tryAddChild(region);\n return unionRegion;\n }\n }\n public static sortAsArrayOfArrayOfPolygons(loops: SortablePolygon[]): IndexedReadWriteXYZCollection[][] {\n this.assignParentsAndDepth(loops);\n return this.assemblePolygonSet(loops);\n }\n public grabPolygon(): IndexedXYZCollection | undefined {\n return this._loopCarrier.grabPolygon();\n }\n public grabLoop(): Loop | undefined {\n return this._loopCarrier.grabLoop();\n }\n public reverseForAreaSign(targetSign: number) {\n this._loopCarrier.reverseForAreaSign(targetSign);\n }\n public getAnyInteriorPoint(): Point3d | undefined {\n return this._loopCarrier.getAnyInteriorPoint();\n }\n}\n"]}
|