@itwin/core-geometry 4.2.0-dev.0 → 4.2.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/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/CurveChain.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/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/CurveCurveIntersectXYZ.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/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.d.ts +1 -2
- package/lib/cjs/curve/Loop.d.ts.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.d.ts +1 -2
- package/lib/cjs/curve/Path.d.ts.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/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/CurveLengthContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.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/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.d.ts +26 -6
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js +66 -15
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +5 -2
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +10 -3
- 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/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/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts +9 -5
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js +9 -5
- 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/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/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/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/CurveChain.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/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/CurveCurveIntersectXYZ.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/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.d.ts +1 -2
- package/lib/esm/curve/Loop.d.ts.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.d.ts +1 -2
- package/lib/esm/curve/Path.d.ts.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/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/CurveLengthContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.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/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.d.ts +26 -6
- package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js +66 -15
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +5 -2
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +10 -3
- 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/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/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts +9 -5
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js +9 -5
- 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/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/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/XYParitySearchContext.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveCurveIntersectXYZ.js","sourceRoot":"","sources":["../../../src/curve/CurveCurveIntersectXYZ.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,+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AC,MAAM,EAAE,CAAC;AACjC,oCAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AACjC,oCAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;SAVrC,sBAAsB","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 Curve\n */\n\nimport { BSplineCurve3d, BSplineCurve3dBase } from \"../bspline/BSplineCurve\";\nimport { BSplineCurve3dH } from \"../bspline/BSplineCurve3dH\";\nimport { Geometry } from \"../Geometry\";\nimport { NullGeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { SmallSystem, TrigPolynomial } from \"../numerics/Polynomials\";\nimport { Arc3d } from \"./Arc3d\";\nimport { CurveLocationDetailArrayPair } from \"./CurveCurveIntersectXY\";\nimport { CurveIntervalRole, CurveLocationDetail } from \"./CurveLocationDetail\";\nimport { CurvePrimitive } from \"./CurvePrimitive\";\nimport { GeometryQuery } from \"./GeometryQuery\";\nimport { LineSegment3d } from \"./LineSegment3d\";\nimport { LineString3d } from \"./LineString3d\";\n\n// cspell:word XYRR\n\n/**\n * Handler class for XYZ intersections between _geometryB and another geometry.\n * * **NOTE:** GeometryQuery input (_geometryB) should really be AnyCurve.\n * * Instances are initialized and called from CurveCurve.\n * * geometryB is saved for later reference.\n * @internal\n */\nexport class CurveCurveIntersectXYZ extends NullGeometryHandler {\n private _extendA: boolean;\n private _geometryB: GeometryQuery;\n private _extendB: boolean;\n private _results!: CurveLocationDetailArrayPair;\n\n private static _workVector2dA = Vector2d.create();\n private static _workPointAA0 = Point3d.create();\n private static _workPointAA1 = Point3d.create();\n private static _workPointBB0 = Point3d.create();\n private static _workPointBB1 = Point3d.create();\n\n private reinitialize() {\n this._results = new CurveLocationDetailArrayPair();\n }\n /**\n * @param extendA flag to enable using extension of the other geometry.\n * @param geometryB second curve for intersection. Saved for reference by specific handler methods.\n * @param extendB flag for extension of geometryB.\n */\n public constructor(extendA: boolean, geometryB: GeometryQuery, extendB: boolean) {\n super();\n this._extendA = extendA;\n this._geometryB = geometryB;\n this._extendB = extendB;\n this.reinitialize();\n }\n /**\n * * Return the results structure for the intersection calculation.\n * @param reinitialize if true, a new results structure is created for use by later calls.\n */\n public grabResults(reinitialize: boolean = false): CurveLocationDetailArrayPair {\n const result = this._results;\n if (reinitialize)\n this.reinitialize();\n return result;\n }\n private acceptFraction(extend0: boolean, fraction: number, extend1: boolean) {\n if (!extend0 && fraction < 0.0)\n return false;\n if (!extend1 && fraction > 1.0)\n return false;\n return true;\n }\n /**\n * Compute intersection of two line segments.\n * Filter by extension rules.\n * Reject if evaluated points do not match coordinates (e.g. close approach point).\n * Record with fraction mapping.\n */\n private recordPointWithLocalFractions(\n localFractionA: number,\n cpA: CurvePrimitive,\n fractionA0: number,\n fractionA1: number,\n localFractionB: number, // Computed intersection fraction\n cpB: CurvePrimitive,\n fractionB0: number,\n fractionB1: number,\n reversed: boolean,\n ): void {\n const globalFractionA = Geometry.interpolate(fractionA0, localFractionA, fractionA1);\n const globalFractionB = Geometry.interpolate(fractionB0, localFractionB, fractionB1);\n // ignore duplicate of most recent point . ..\n const numPrevious = this._results.dataA.length;\n if (numPrevious > 0) {\n const topFractionA = this._results.dataA[numPrevious - 1].fraction;\n const topFractionB = this._results.dataB[numPrevious - 1].fraction;\n if (reversed) {\n if (Geometry.isAlmostEqualNumber(topFractionA, globalFractionB) &&\n Geometry.isAlmostEqualNumber(topFractionB, globalFractionA))\n return;\n } else {\n if (Geometry.isAlmostEqualNumber(topFractionA, globalFractionA) &&\n Geometry.isAlmostEqualNumber(topFractionB, globalFractionB))\n return;\n }\n }\n const pointA = cpA.fractionToPoint(globalFractionA);\n const pointB = cpB.fractionToPoint(globalFractionB);\n if (!pointA.isAlmostEqualMetric(pointB))\n return;\n\n const detailA = CurveLocationDetail.createCurveFractionPoint(cpA, globalFractionA, pointA);\n detailA.setIntervalRole(CurveIntervalRole.isolated);\n const detailB = CurveLocationDetail.createCurveFractionPoint(cpB, globalFractionB, pointB);\n detailB.setIntervalRole(CurveIntervalRole.isolated);\n if (reversed) {\n this._results.dataA.push(detailB);\n this._results.dataB.push(detailA);\n } else {\n this._results.dataA.push(detailA);\n this._results.dataB.push(detailB);\n }\n }\n /**\n * Compute intersection of two line segments.\n * Filter by extension rules.\n * Record with fraction mapping.\n */\n private computeSegmentSegment3D(\n cpA: CurvePrimitive,\n extendA0: boolean,\n pointA0: Point3d,\n fractionA0: number,\n pointA1: Point3d,\n fractionA1: number,\n extendA1: boolean,\n cpB: CurvePrimitive,\n extendB0: boolean,\n pointB0: Point3d,\n fractionB0: number,\n pointB1: Point3d,\n fractionB1: number,\n extendB1: boolean,\n reversed: boolean,\n ): void {\n const uv = CurveCurveIntersectXYZ._workVector2dA;\n if (SmallSystem.lineSegment3dClosestApproachUnbounded(pointA0, pointA1, pointB0, pointB1, uv) &&\n this.acceptFraction(extendA0, uv.x, extendA1) && this.acceptFraction(extendB0, uv.y, extendB1)) {\n this.recordPointWithLocalFractions(uv.x, cpA, fractionA0, fractionA1, uv.y, cpB, fractionB0, fractionB1, reversed);\n }\n }\n // Caller accesses data from a line segment and passes to here.\n // (The line segment in question might be (a) a full line segment or (b) a fragment within a linestring. The fraction and extend parameters\n // allow all combinations to be passed in)\n // This method applies transform.\n private dispatchSegmentSegment(\n cpA: CurvePrimitive,\n extendA0: boolean,\n pointA0: Point3d,\n fractionA0: number,\n pointA1: Point3d,\n fractionA1: number,\n extendA1: boolean,\n cpB: CurvePrimitive,\n extendB0: boolean,\n pointB0: Point3d,\n fractionB0: number,\n pointB1: Point3d,\n fractionB1: number,\n extendB1: boolean,\n reversed: boolean,\n ): void {\n this.computeSegmentSegment3D(\n cpA, extendA0, pointA0, fractionA0, pointA1, fractionA1, extendA1,\n cpB, extendB0, pointB0, fractionB0, pointB1, fractionB1, extendB1,\n reversed,\n );\n }\n /**\n * Create a plane whose normal is the \"better\" cross product: `vectorA.crossProduct(vectorB)` or\n * `vectorA.crossProduct(vectorC)`\n * * The heuristic for \"better\" is:\n * * first choice is cross product with `vectorB`, if `vectorA` and `vectorB` are sufficiently far from parallel\n * (or anti-parallel).\n * * otherwise use vectorC\n * @param origin plane origin\n * @param vectorA vector which must be in the plane.\n * @param cosineValue largest cosine of the angle theta between vectorA and vectorB to prefer their cross product, e.g.\n * passing 0.94 ~ cos(20deg) will switch to using vectorC in the cross product if theta < ~20deg or theta > ~160deg.\n * @param vectorB first candidate for additional in-plane vector\n * @param vectorC second candidate for additional in-plane vector\n */\n public createPlaneWithPreferredPerpendicular(\n origin: Point3d, vectorA: Vector3d, cosineValue: number, vectorB: Vector3d, vectorC: Vector3d,\n ): Plane3dByOriginAndUnitNormal | undefined {\n cosineValue = Geometry.restrictToInterval(Math.abs(cosineValue), 0.0, 1.0 - Geometry.smallFraction);\n const dotAA = vectorA.magnitudeSquared();\n const dotBB = vectorB.magnitudeSquared();\n const dotAB = Math.abs(vectorA.dotProduct(vectorB));\n const cross = vectorA.unitCrossProduct(dotAB * dotAB <= cosineValue * cosineValue * dotAA * dotBB ? vectorB : vectorC);\n if (cross)\n return Plane3dByOriginAndUnitNormal.create(origin, cross);\n return undefined;\n }\n // Caller accesses data from a linestring or segment and passes it here.\n // (The line segment in question might be (a) a full line segment or (b) a fragment within a linestring. The fraction and extend parameters\n // allow all combinations to be passed in)\n private dispatchSegmentArc(\n cpA: CurvePrimitive,\n extendA0: boolean,\n pointA0: Point3d,\n fractionA0: number,\n pointA1: Point3d,\n fractionA1: number,\n extendA1: boolean,\n arc: Arc3d,\n extendB0: boolean,\n extendB1: boolean,\n reversed: boolean,\n ): void {\n const lineVector = Vector3d.createStartEnd(pointA0, pointA1);\n const plane = this.createPlaneWithPreferredPerpendicular(\n pointA0, lineVector, 0.94, arc.perpendicularVector, arc.vector0);\n if (plane !== undefined) {\n const candidates: CurveLocationDetail[] = [];\n arc.appendPlaneIntersectionPoints(plane, candidates);\n let lineFraction;\n let linePoint: Point3d | undefined;\n for (const c of candidates) {\n if (this.acceptFraction(extendB0, c.fraction, extendB1)) {\n lineFraction = SmallSystem.lineSegment3dClosestPointUnbounded(pointA0, pointA1, c.point);\n if (lineFraction !== undefined) {\n linePoint = pointA0.interpolate(lineFraction, pointA1, linePoint);\n if (linePoint.isAlmostEqualMetric(c.point)\n && this.acceptFraction(extendA0, lineFraction, extendA1)) {\n this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1,\n c.fraction, arc, 0, 1, reversed);\n\n }\n }\n }\n }\n }\n }\n // Caller promises arcs are coplanar.\n // Passes \"other\" as {center, vector0, vector90} in local xy space of cpA\n // Solves the arc-arc equations for that local ellipse with unit circle.\n // Solution fractions map directly to original arcs.\n private dispatchArcArcInPlane(\n cpA: Arc3d, extendA: boolean, cpB: Arc3d, extendB: boolean, reversed: boolean,\n ): void {\n const otherVectors = cpA.otherArcAsLocalVectors(cpB);\n if (otherVectors !== undefined) {\n const ellipseRadians: number[] = [];\n const circleRadians: number[] = [];\n TrigPolynomial.solveUnitCircleHomogeneousEllipseIntersection(\n otherVectors.center.x, otherVectors.center.y, 1.0,\n otherVectors.vector0.x, otherVectors.vector0.y, 0.0,\n otherVectors.vector90.x, otherVectors.vector90.y, 0.0,\n ellipseRadians, circleRadians,\n );\n for (let i = 0; i < ellipseRadians.length; i++) {\n const fractionA = cpA.sweep.radiansToSignedPeriodicFraction(circleRadians[i]);\n const fractionB = cpA.sweep.radiansToSignedPeriodicFraction(ellipseRadians[i]);\n // hm .. do we really need to check the fractions? We know they are internal to the beziers\n if (this.acceptFraction(extendA, fractionA, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(fractionA, cpA, 0, 1, fractionB, cpB, 0, 1, reversed);\n }\n }\n }\n }\n // Caller accesses data from two arcs.\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\n // Solves the arc-arc equations\n private dispatchArcArc(\n cpA: Arc3d, extendA: boolean, cpB: Arc3d, extendB: boolean, reversed: boolean,\n ): void {\n // If arcs are in different planes:\n // 1) Intersect each plane with the other arc (quadratic)\n // 2) accept points that appear in both intersection sets.\n // If arcs are in parallel planes -- no intersections\n // If arcs are in the same plane -- xy intersection in that plane.\n const planeA = Plane3dByOriginAndUnitNormal.create(cpA.center, cpA.perpendicularVector);\n const planeB = Plane3dByOriginAndUnitNormal.create(cpB.center, cpB.perpendicularVector);\n if (planeA === undefined || planeB === undefined)\n return;\n if (planeA.getNormalRef().isParallelTo(planeB.getNormalRef())) {\n if (planeA.isPointInPlane(planeB.getOriginRef()) && planeB.isPointInPlane(planeA.getOriginRef())) {\n // coplanar !!!\n this.dispatchArcArcInPlane(cpA, extendA, cpB, extendB, reversed);\n }\n } else {\n const arcBPoints: CurveLocationDetail[] = [];\n cpB.appendPlaneIntersectionPoints(planeA, arcBPoints);\n const arcAPoints: CurveLocationDetail[] = [];\n cpA.appendPlaneIntersectionPoints(planeB, arcAPoints);\n for (const detailB of arcBPoints) {\n for (const detailA of arcAPoints) {\n if (detailA.point.isAlmostEqual(detailB.point)) {\n if (this.acceptFraction(extendA, detailA.fraction, extendA)\n && this.acceptFraction(extendB, detailB.fraction, extendB)) {\n this.recordPointWithLocalFractions(detailA.fraction, cpA, 0, 1, detailB.fraction, cpB, 0, 1, reversed);\n }\n }\n }\n }\n }\n }\n // Caller accesses data from two arcs.\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\n // Solves the arc-arc equations\n private dispatchArcBsplineCurve3d(\n _arc: Arc3d, _extendA: boolean, _cpB: BSplineCurve3d, _extendB: boolean, _reversed: boolean,\n ): void {\n /*\n // Arc: X = C + cU + sV\n // implicitize the arc as viewed. This \"3d\" matrix is homogeneous \"XYW\" not \"xyz\"\n let matrixA: Matrix3d;\n if (this._worldToLocalPerspective) {\n const dataA = cpA.toTransformedPoint4d(this._worldToLocalPerspective);\n matrixA = Matrix3d.createColumnsXYW(dataA.vector0, dataA.vector0.w, dataA.vector90, dataA.vector90.w, dataA.center, dataA.center.w);\n } else {\n const dataA = cpA.toTransformedVectors(this._worldToLocalAffine);\n matrixA = Matrix3d.createColumnsXYW(dataA.vector0, 0, dataA.vector90, 0, dataA.center, 1);\n }\n // The worldToLocal has moved the arc vectors into local space.\n // matrixA captures the xyw parts (ignoring z)\n // for any point in world space,\n // THIS CODE ONLY WORKS FOR\n const matrixAInverse = matrixA.inverse();\n if (matrixAInverse) {\n const orderF = cpB.order; // order of the beziers for simple coordinates\n const orderG = 2 * orderF - 1; // order of the (single) bezier for squared coordinates.\n const coffF = new Float64Array(orderF);\n const univariateBezierG = new UnivariateBezier(orderG);\n const axx = matrixAInverse.at(0, 0); const axy = matrixAInverse.at(0, 1); const axz = 0.0; const axw = matrixAInverse.at(0, 2);\n const ayx = matrixAInverse.at(1, 0); const ayy = matrixAInverse.at(1, 1); const ayz = 0.0; const ayw = matrixAInverse.at(1, 2);\n const awx = matrixAInverse.at(2, 0); const awy = matrixAInverse.at(2, 1); const awz = 0.0; const aww = matrixAInverse.at(2, 2);\n\n if (matrixAInverse) {\n let bezier: BezierCurve3dH | undefined;\n for (let spanIndex = 0; ; spanIndex++) {\n bezier = cpB.getSaturatedBezierSpan3dH(spanIndex, bezier);\n if (!bezier) break;\n if (this._worldToLocalPerspective)\n bezier.tryMultiplyMatrix4dInPlace(this._worldToLocalPerspective);\n else if (this._worldToLocalAffine)\n bezier.tryTransformInPlace(this._worldToLocalAffine);\n univariateBezierG.zero();\n bezier.poleProductsXYZW(coffF, axx, axy, axz, axw);\n univariateBezierG.addSquaredSquaredBezier(coffF, 1.0);\n bezier.poleProductsXYZW(coffF, ayx, ayy, ayz, ayw);\n univariateBezierG.addSquaredSquaredBezier(coffF, 1.0);\n bezier.poleProductsXYZW(coffF, awx, awy, awz, aww);\n univariateBezierG.addSquaredSquaredBezier(coffF, -1.0);\n const roots = univariateBezierG.roots(0.0, true);\n if (roots) {\n for (const root of roots) {\n const fractionB = bezier.fractionToParentFraction(root);\n // The univariate bezier (which has been transformed by the view transform) evaluates into xyw space\n const bcurvePoint4d = bezier.fractionToPoint4d(root);\n const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);\n const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);\n const arcFraction = cpA.sweep.radiansToSignedPeriodicFraction(Math.atan2(s, c));\n if (this.acceptFraction(extendA, arcFraction, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(arcFraction, cpA, 0, 1,\n fractionB, cpB, 0, 1, reversed);\n }\n }\n }\n }\n }\n }\n */\n }\n /*\n // apply the transformation to bezier curves. optionally construct ranges.\n private transformBeziers(beziers: BezierCurve3dH[]) {\n if (this._worldToLocalAffine) {\n for (const bezier of beziers) bezier.tryTransformInPlace(this._worldToLocalAffine);\n } else if (this._worldToLocalPerspective) {\n for (const bezier of beziers) bezier.tryMultiplyMatrix4dInPlace(this._worldToLocalPerspective);\n }\n }\n */\n /*\n private getRanges(beziers: BezierCurveBase[]): Range3d[] {\n const ranges: Range3d[] = [];\n ranges.length = 0;\n for (const b of beziers) {\n ranges.push(b.range());\n }\n return ranges;\n }\n private _xyzwA0?: Point4d;\n private _xyzwA1?: Point4d;\n private _xyzwPlane?: Point4d;\n private _xyzwB?: Point4d;\n\n private dispatchBezierBezierStrokeFirst(\n bezierA: BezierCurve3dH,\n bcurveA: BSplineCurve3dBase,\n strokeCountA: number,\n bezierB: BezierCurve3dH,\n bcurveB: BSplineCurve3dBase,\n _strokeCountB: number,\n univariateBezierB: UnivariateBezier, // caller-allocated for univariate coefficients.\n reversed: boolean) {\n if (!this._xyzwA0) this._xyzwA0 = Point4d.create();\n if (!this._xyzwA1) this._xyzwA1 = Point4d.create();\n if (!this._xyzwPlane) this._xyzwPlane = Point4d.create();\n if (!this._xyzwB) this._xyzwB = Point4d.create();\n const roots = univariateBezierG.roots(0.0, true);\n if (roots) {\n for (const root of roots) {\n const fractionB = bezier.fractionToParentFraction(root);\n // The univariate bezier (which has been transformed by the view transform) evaluates into xyw space\n const bcurvePoint4d = bezier.fractionToPoint4d(root);\n const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);\n const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);\n const arcFraction = cpA.sweep.radiansToSignedPeriodicFraction(Math.atan2(s, c));\n if (this.acceptFraction(extendA, arcFraction, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(arcFraction, cpA, 0, 1,\n fractionB, cpB, 0, 1, reversed);\n }\n }\n bezierA.fractionToPoint4d(0.0, this._xyzwA0);\n let f0 = 0.0;\n let f1 = 1.0;\n const intervalTolerance = 1.0e-5;\n const df = 1.0 / strokeCountA;\n for (let i = 1; i <= strokeCountA; i++ , f0 = f1, this._xyzwA0.setFrom(this._xyzwA1)) {\n f1 = i * df;\n bezierA.fractionToPoint4d(f1, this._xyzwA1);\n Point4d.createPlanePointPointZ(this._xyzwA0, this._xyzwA1, this._xyzwPlane);\n bezierB.poleProductsXYZW(univariateBezierB.coffs, this._xyzwPlane.x, this._xyzwPlane.y, this._xyzwPlane.z, this._xyzwPlane.w);\n let errors = 0;\n const roots = univariateBezierB.roots(0.0, true);\n if (roots)\n for (const r of roots) {\n const bezierBFraction = r;\n bezierB.fractionToPoint4d(bezierBFraction, this._xyzwB);\n const segmentAFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(this._xyzwA0, this._xyzwA1, this._xyzwB);\n if (segmentAFraction && Geometry.isIn01WithTolerance(segmentAFraction, intervalTolerance)) {\n const bezierAFraction = Geometry.interpolate(f0, segmentAFraction, f1);\n /*- TODO implement newton search\n const xyMatchingFunction = new BezierBezierIntersectionXYRRToRRD(bezierA, bezierB);\n const newtonSearcher = new Newton2dUnboundedWithDerivative(xyMatchingFunction);\n newtonSearcher.setUV(bezierAFraction, bezierBFraction);\n if (newtonSearcher.runIterations()) {\n bezierAFraction = newtonSearcher.getU();\n bezierBFraction = newtonSearcher.getV();\n }\n // We have a near intersection at fractions on the two beziers !!!\n // Iterate on the curves for a true intersection ....\n // NEEDS WORK -- just accept . . .\n const bcurveAFraction = bezierA.fractionToParentFraction(bezierAFraction);\n const bcurveBFraction = bezierB.fractionToParentFraction(bezierBFraction);\n const xyzA0 = bezierA.fractionToPoint(bezierAFraction);\n const xyzA1 = bcurveA.fractionToPoint(bcurveAFraction);\n const xyzB0 = bezierB.fractionToPoint(bezierBFraction);\n const xyzB1 = bcurveB.fractionToPoint(bcurveBFraction);\n if (!xyzA0.isAlmostEqualXY(xyzA1))\n errors++;\n if (!xyzB0.isAlmostEqualXY(xyzB1))\n errors++;\n if (errors > 0 && !xyzA0.isAlmostEqual(xyzB0))\n errors++;\n if (errors > 0 && !xyzA1.isAlmostEqual(xyzB1))\n errors++;\n if (this.acceptFraction(false, bcurveAFraction, false) && this.acceptFraction(false, bcurveBFraction, false)) {\n this.recordPointWithLocalFractions(bcurveAFraction, bcurveA, 0, 1,\n bcurveBFraction, bcurveB, 0, 1, reversed);\n }\n }\n }\n }\n }\n */\n // Caller accesses data from two arcs.\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\n // Solves the arc-arc equations\n private dispatchBSplineCurve3dBSplineCurve3d(\n _bcurveA: BSplineCurve3dBase, _bcurveB: BSplineCurve3dBase, _reversed: boolean,\n ): void {\n /*\n const bezierSpanA = bcurveA.collectBezierSpans(true) as BezierCurve3dH[];\n const bezierSpanB = bcurveB.collectBezierSpans(true) as BezierCurve3dH[];\n const numA = bezierSpanA.length;\n const numB = bezierSpanB.length;\n this.transformBeziers(bezierSpanA);\n this.transformBeziers(bezierSpanB);\n const rangeA = this.getRanges(bezierSpanA);\n const rangeB = this.getRanges(bezierSpanB);\n const orderA = bcurveA.order;\n const orderB = bcurveB.order;\n const univariateCoffsA = new UnivariateBezier(orderA);\n const univariateCoffsB = new UnivariateBezier(orderB);\n for (let a = 0; a < numA; a++) {\n for (let b = 0; b < numB; b++) {\n if (rangeA[a].intersectsRangeXY(rangeB[b])) {\n const strokeCountA = bezierSpanA[a].computeStrokeCountForOptions();\n const strokeCountB = bezierSpanB[b].computeStrokeCountForOptions();\n if (strokeCountA < strokeCountB)\n this.dispatchBezierBezierStrokeFirst(bezierSpanA[a], bcurveA, strokeCountA, bezierSpanB[b], bcurveB, strokeCountB, univariateCoffsB, !_reversed);\n else\n this.dispatchBezierBezierStrokeFirst(bezierSpanB[b], bcurveB, strokeCountB, bezierSpanA[a], bcurveA, strokeCountA, univariateCoffsA, _reversed);\n }\n }\n }\n */\n }\n /*\n /**\n * Apply the projection transform (if any) to (xyz, w)\n * @param xyz xyz parts of input point.\n * @param w weight to use for homogeneous effects\n */\n /*\n private projectPoint(xyz: XYAndZ, w: number = 1.0): Point4d {\n if (this._worldToLocalPerspective)\n return this._worldToLocalPerspective.multiplyPoint3d(xyz, w);\n if (this._worldToLocalAffine)\n return this._worldToLocalAffine.multiplyXYZW(xyz.x, xyz.y, xyz.z, w);\n return Point4d.createFromPointAndWeight(xyz, w);\n }\n private mapNPCPlaneToWorld(npcPlane: Point4d, worldPlane: Point4d) {\n // for NPC pointY, Y^ * H = 0 is \"on\" plane H. (Hat is transpose)\n // NPC Y is A*X for our transform A and worldPointX.\n // hence (A X)^ * H = 0\n // hence X^ * A^ * H = 0\n // hence K = A^ * H\n if (this._worldToLocalAffine) {\n this._worldToLocalAffine.multiplyTransposeXYZW(npcPlane.x, npcPlane.y, npcPlane.z, npcPlane.w, worldPlane);\n } else if (this._worldToLocalPerspective) {\n this._worldToLocalPerspective.multiplyTransposePoint4d(npcPlane, worldPlane);\n } else {\n npcPlane.clone(worldPlane);\n }\n }\n */\n // Caller accesses data from segment and bsplineCurve\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\n // Solves the arc-arc equations\n private dispatchSegmentBsplineCurve(\n _cpA: CurvePrimitive,\n _extendA0: boolean,\n _pointA0: Point3d,\n _fractionA0: number,\n _pointA1: Point3d,\n _fractionA1: number,\n _extendA1: boolean,\n _bcurve: BSplineCurve3d,\n _extendB: boolean,\n _reversed: boolean,\n ): void {\n /*\n const pointA0H = this.projectPoint(pointA0);\n const pointA1H = this.projectPoint(pointA1);\n const planeCoffs = Point4d.createPlanePointPointZ(pointA0H, pointA1H);\n this.mapNPCPlaneToWorld(planeCoffs, planeCoffs);\n // NOW .. we have a plane in world space. Intersect it with the bspline:\n const intersections: CurveLocationDetail[] = [];\n bcurve.appendPlaneIntersectionPoints(planeCoffs, intersections);\n // intersections has WORLD points with bspline fractions. (The bspline fractions are all good 0..1 fractions within the spline.)\n // accept those that are within the segment range.\n for (const detail of intersections) {\n const fractionB = detail.fraction;\n const curvePoint = detail.point;\n const curvePointH = this.projectPoint(curvePoint);\n const lineFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(pointA0H, pointA1H, curvePointH);\n if (lineFraction !== undefined && this.acceptFraction(extendA0, lineFraction, extendA1) && this.acceptFraction(extendB, fractionB, extendB)) {\n this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1,\n fractionB, bcurve, 0, 1, reversed);\n }\n }\n */\n }\n /** Low level dispatch of linestring with (beziers of) a bspline curve */\n public dispatchLineStringBSplineCurve(\n _lsA: LineString3d, _extendA: boolean, _curveB: BSplineCurve3d, _extendB: boolean, _reversed: boolean,\n ): any {\n /*\n const numA = lsA.numPoints();\n if (numA > 1) {\n const dfA = 1.0 / (numA - 1);\n let fA0;\n let fA1;\n fA0 = 0.0;\n const pointA0 = CurveCurveIntersectXYZ._workPointA0;\n const pointA1 = CurveCurveIntersectXYZ._workPointA1;\n lsA.pointAt(0, pointA0);\n for (let iA = 1; iA < numA; iA++ , pointA0.setFrom(pointA1), fA0 = fA1) {\n lsA.pointAt(iA, pointA1);\n fA1 = iA * dfA;\n this.dispatchSegmentBsplineCurve(\n lsA, iA === 1 && extendA, pointA0, fA0, pointA1, fA1, (iA + 1) === numA && extendA,\n curveB, extendB, reversed);\n }\n }\n return undefined;\n */\n }\n /** Detail computation for segment intersecting linestring. */\n public computeSegmentLineString(\n lsA: LineSegment3d, extendA: boolean, lsB: LineString3d, extendB: boolean, reversed: boolean,\n ): any {\n const pointA0 = lsA.point0Ref;\n const pointA1 = lsA.point1Ref;\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\n const numB = lsB.numPoints();\n if (numB > 1) {\n const dfB = 1.0 / (numB - 1);\n let fB0;\n let fB1;\n fB0 = 0.0;\n lsB.pointAt(0, pointB0);\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\n lsB.pointAt(ib, pointB1);\n fB1 = ib * dfB;\n this.dispatchSegmentSegment(\n lsA, extendA, pointA0, 0.0, pointA1, 1.0, extendA, lsB, ib === 1 && extendB,\n pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB, reversed,\n );\n }\n }\n return undefined;\n }\n /** Detail computation for arc intersecting linestring. */\n public computeArcLineString(\n arcA: Arc3d, extendA: boolean, lsB: LineString3d, extendB: boolean, reversed: boolean,\n ): any {\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\n const numB = lsB.numPoints();\n if (numB > 1) {\n const dfB = 1.0 / (numB - 1);\n let fB0;\n let fB1;\n fB0 = 0.0;\n lsB.pointAt(0, pointB0);\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\n lsB.pointAt(ib, pointB1);\n fB1 = ib * dfB;\n this.dispatchSegmentArc(\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1,\n (ib + 1) === numB && extendB, arcA, extendA, extendA, !reversed);\n }\n }\n return undefined;\n }\n /** Double dispatch handler for strongly typed segment. */\n public override handleLineSegment3d(segmentA: LineSegment3d): any {\n if (this._geometryB instanceof LineSegment3d) {\n const segmentB = this._geometryB;\n this.dispatchSegmentSegment(\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA,\n segmentB, this._extendB, segmentB.point0Ref, 0.0, segmentB.point1Ref, 1.0, this._extendB,\n false,\n );\n } else if (this._geometryB instanceof LineString3d) {\n this.computeSegmentLineString(segmentA, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchSegmentArc(\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref,\n 1.0, this._extendA, this._geometryB, this._extendB, this._extendB, false,\n );\n } else if (this._geometryB instanceof BSplineCurve3d) {\n this.dispatchSegmentBsplineCurve(\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref,\n 1.0, this._extendA, this._geometryB, this._extendB, false,\n );\n }\n }\n /** double dispatch handler for strongly typed linestring .. */\n public override handleLineString3d(lsA: LineString3d): any {\n if (this._geometryB instanceof LineString3d) {\n const lsB = this._geometryB;\n const pointA0 = CurveCurveIntersectXYZ._workPointAA0;\n const pointA1 = CurveCurveIntersectXYZ._workPointAA1;\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\n const numA = lsA.numPoints();\n const numB = lsB.numPoints();\n if (numA > 1 && numB > 1) {\n lsA.pointAt(0, pointA0);\n const dfA = 1.0 / (numA - 1);\n const dfB = 1.0 / (numB - 1);\n let fA0 = 0.0;\n let fA1, fB0, fB1;\n const extendA = this._extendA;\n const extendB = this._extendB;\n lsA.pointAt(0, pointA0);\n for (let ia = 1; ia < numA; ia++, pointA0.setFrom(pointA1), fA0 = fA1) {\n fA1 = ia * dfA;\n fB0 = 0.0;\n lsA.pointAt(ia, pointA1);\n lsB.pointAt(0, pointB0);\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\n lsB.pointAt(ib, pointB1);\n fB1 = ib * dfB;\n this.dispatchSegmentSegment(\n lsA, ia === 1 && extendA, pointA0, fA0, pointA1, fA1, (ia + 1) === numA && extendA,\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB,\n false,\n );\n }\n }\n }\n } else if (this._geometryB instanceof LineSegment3d) {\n this.computeSegmentLineString(this._geometryB, this._extendB, lsA, this._extendA, true);\n } else if (this._geometryB instanceof Arc3d) {\n this.computeArcLineString(this._geometryB, this._extendB, lsA, this._extendA, true);\n } else if (this._geometryB instanceof BSplineCurve3d) {\n this.dispatchLineStringBSplineCurve(lsA, this._extendA, this._geometryB, this._extendB, false);\n }\n return undefined;\n }\n /** Double dispatch handler for strongly typed arc. */\n public override handleArc3d(arc0: Arc3d): any {\n if (this._geometryB instanceof LineSegment3d) {\n this.dispatchSegmentArc(\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref,\n 1.0, this._extendB, arc0, this._extendA, this._extendA, true,\n );\n } else if (this._geometryB instanceof LineString3d) {\n this.computeArcLineString(arc0, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchArcArc(arc0, this._extendA, this._geometryB, this._extendB, false);\n } else if (this._geometryB instanceof BSplineCurve3d) {\n this.dispatchArcBsplineCurve3d(arc0, this._extendA, this._geometryB, this._extendB, false);\n }\n return undefined;\n }\n /** Double dispatch handler for strongly typed bspline curve.. */\n public override handleBSplineCurve3d(curve: BSplineCurve3d): any {\n if (this._geometryB instanceof LineSegment3d) {\n this.dispatchSegmentBsplineCurve(\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref,\n 1.0, this._extendB, curve, this._extendA, true,\n );\n } else if (this._geometryB instanceof LineString3d) {\n this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB, curve, this._extendA, true);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB, curve, this._extendA, true);\n } else if (this._geometryB instanceof BSplineCurve3dBase) {\n this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);\n }\n return undefined;\n }\n /** Double dispatch handler for strongly typed homogeneous bspline curve. */\n public override handleBSplineCurve3dH(_curve: BSplineCurve3dH): any {\n /*\n // NEEDS WORK -- make \"dispatch\" methods tolerant of both 3d and 3dH\n // \"easy\" if both present BezierCurve3dH span loaders\n if (this._geometryB instanceof LineSegment3d) {\n this.dispatchSegmentBsplineCurve(\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref, 1.0, this._extendB,\n curve, this._extendA, true);\n } else if (this._geometryB instanceof LineString3d) {\n this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB, curve, this._extendA, true);\n } else if (this._geometryB instanceof Arc3d) {\n this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB, curve, this._extendA, true);\n }\n */\n return undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CurveCurveIntersectXYZ.js","sourceRoot":"","sources":["../../../src/curve/CurveCurveIntersectXYZ.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,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,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,EACzF,GAAG,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAC/C,CAAC;SACH;aAAM,IAAI,IAAI,CAAC,UAAU,YAAY,YAAY,EAAE;YAClD,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;SACjG;aAAM,IAAI,IAAI,CAAC,UAAU,YAAY,KAAK,EAAE;YAC3C,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;SAC5F;aAAM,IAAI,IAAI,CAAC,UAAU,YAAY,kBAAkB,EAAE;YACxD,IAAI,CAAC,oCAAoC,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;SAC1E;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,4EAA4E;IAC5D,qBAAqB,CAAC,MAAuB;QAC3D;;;;;;;;;;;;UAYE;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;;AA7tBc,qCAAc,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;AACnC,oCAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AACjC,oCAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AACjC,oCAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AACjC,oCAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;SAVrC,sBAAsB","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 Curve\r\n */\r\n\r\nimport { BSplineCurve3d, BSplineCurve3dBase } from \"../bspline/BSplineCurve\";\r\nimport { BSplineCurve3dH } from \"../bspline/BSplineCurve3dH\";\r\nimport { Geometry } from \"../Geometry\";\r\nimport { NullGeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { SmallSystem, TrigPolynomial } from \"../numerics/Polynomials\";\r\nimport { Arc3d } from \"./Arc3d\";\r\nimport { CurveLocationDetailArrayPair } from \"./CurveCurveIntersectXY\";\r\nimport { CurveIntervalRole, CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { LineSegment3d } from \"./LineSegment3d\";\r\nimport { LineString3d } from \"./LineString3d\";\r\n\r\n// cspell:word XYRR\r\n\r\n/**\r\n * Handler class for XYZ intersections between _geometryB and another geometry.\r\n * * **NOTE:** GeometryQuery input (_geometryB) should really be AnyCurve.\r\n * * Instances are initialized and called from CurveCurve.\r\n * * geometryB is saved for later reference.\r\n * @internal\r\n */\r\nexport class CurveCurveIntersectXYZ extends NullGeometryHandler {\r\n private _extendA: boolean;\r\n private _geometryB: GeometryQuery;\r\n private _extendB: boolean;\r\n private _results!: CurveLocationDetailArrayPair;\r\n\r\n private static _workVector2dA = Vector2d.create();\r\n private static _workPointAA0 = Point3d.create();\r\n private static _workPointAA1 = Point3d.create();\r\n private static _workPointBB0 = Point3d.create();\r\n private static _workPointBB1 = Point3d.create();\r\n\r\n private reinitialize() {\r\n this._results = new CurveLocationDetailArrayPair();\r\n }\r\n /**\r\n * @param extendA flag to enable using extension of the other geometry.\r\n * @param geometryB second curve for intersection. Saved for reference by specific handler methods.\r\n * @param extendB flag for extension of geometryB.\r\n */\r\n public constructor(extendA: boolean, geometryB: GeometryQuery, extendB: boolean) {\r\n super();\r\n this._extendA = extendA;\r\n this._geometryB = geometryB;\r\n this._extendB = extendB;\r\n this.reinitialize();\r\n }\r\n /**\r\n * * Return the results structure for the intersection calculation.\r\n * @param reinitialize if true, a new results structure is created for use by later calls.\r\n */\r\n public grabResults(reinitialize: boolean = false): CurveLocationDetailArrayPair {\r\n const result = this._results;\r\n if (reinitialize)\r\n this.reinitialize();\r\n return result;\r\n }\r\n private acceptFraction(extend0: boolean, fraction: number, extend1: boolean) {\r\n if (!extend0 && fraction < 0.0)\r\n return false;\r\n if (!extend1 && fraction > 1.0)\r\n return false;\r\n return true;\r\n }\r\n /**\r\n * Compute intersection of two line segments.\r\n * Filter by extension rules.\r\n * Reject if evaluated points do not match coordinates (e.g. close approach point).\r\n * Record with fraction mapping.\r\n */\r\n private recordPointWithLocalFractions(\r\n localFractionA: number,\r\n cpA: CurvePrimitive,\r\n fractionA0: number,\r\n fractionA1: number,\r\n localFractionB: number, // Computed intersection fraction\r\n cpB: CurvePrimitive,\r\n fractionB0: number,\r\n fractionB1: number,\r\n reversed: boolean,\r\n ): void {\r\n const globalFractionA = Geometry.interpolate(fractionA0, localFractionA, fractionA1);\r\n const globalFractionB = Geometry.interpolate(fractionB0, localFractionB, fractionB1);\r\n // ignore duplicate of most recent point . ..\r\n const numPrevious = this._results.dataA.length;\r\n if (numPrevious > 0) {\r\n const topFractionA = this._results.dataA[numPrevious - 1].fraction;\r\n const topFractionB = this._results.dataB[numPrevious - 1].fraction;\r\n if (reversed) {\r\n if (Geometry.isAlmostEqualNumber(topFractionA, globalFractionB) &&\r\n Geometry.isAlmostEqualNumber(topFractionB, globalFractionA))\r\n return;\r\n } else {\r\n if (Geometry.isAlmostEqualNumber(topFractionA, globalFractionA) &&\r\n Geometry.isAlmostEqualNumber(topFractionB, globalFractionB))\r\n return;\r\n }\r\n }\r\n const pointA = cpA.fractionToPoint(globalFractionA);\r\n const pointB = cpB.fractionToPoint(globalFractionB);\r\n if (!pointA.isAlmostEqualMetric(pointB))\r\n return;\r\n\r\n const detailA = CurveLocationDetail.createCurveFractionPoint(cpA, globalFractionA, pointA);\r\n detailA.setIntervalRole(CurveIntervalRole.isolated);\r\n const detailB = CurveLocationDetail.createCurveFractionPoint(cpB, globalFractionB, pointB);\r\n detailB.setIntervalRole(CurveIntervalRole.isolated);\r\n if (reversed) {\r\n this._results.dataA.push(detailB);\r\n this._results.dataB.push(detailA);\r\n } else {\r\n this._results.dataA.push(detailA);\r\n this._results.dataB.push(detailB);\r\n }\r\n }\r\n /**\r\n * Compute intersection of two line segments.\r\n * Filter by extension rules.\r\n * Record with fraction mapping.\r\n */\r\n private computeSegmentSegment3D(\r\n cpA: CurvePrimitive,\r\n extendA0: boolean,\r\n pointA0: Point3d,\r\n fractionA0: number,\r\n pointA1: Point3d,\r\n fractionA1: number,\r\n extendA1: boolean,\r\n cpB: CurvePrimitive,\r\n extendB0: boolean,\r\n pointB0: Point3d,\r\n fractionB0: number,\r\n pointB1: Point3d,\r\n fractionB1: number,\r\n extendB1: boolean,\r\n reversed: boolean,\r\n ): void {\r\n const uv = CurveCurveIntersectXYZ._workVector2dA;\r\n if (SmallSystem.lineSegment3dClosestApproachUnbounded(pointA0, pointA1, pointB0, pointB1, uv) &&\r\n this.acceptFraction(extendA0, uv.x, extendA1) && this.acceptFraction(extendB0, uv.y, extendB1)) {\r\n this.recordPointWithLocalFractions(uv.x, cpA, fractionA0, fractionA1, uv.y, cpB, fractionB0, fractionB1, reversed);\r\n }\r\n }\r\n // Caller accesses data from a line segment and passes to here.\r\n // (The line segment in question might be (a) a full line segment or (b) a fragment within a linestring. The fraction and extend parameters\r\n // allow all combinations to be passed in)\r\n // This method applies transform.\r\n private dispatchSegmentSegment(\r\n cpA: CurvePrimitive,\r\n extendA0: boolean,\r\n pointA0: Point3d,\r\n fractionA0: number,\r\n pointA1: Point3d,\r\n fractionA1: number,\r\n extendA1: boolean,\r\n cpB: CurvePrimitive,\r\n extendB0: boolean,\r\n pointB0: Point3d,\r\n fractionB0: number,\r\n pointB1: Point3d,\r\n fractionB1: number,\r\n extendB1: boolean,\r\n reversed: boolean,\r\n ): void {\r\n this.computeSegmentSegment3D(\r\n cpA, extendA0, pointA0, fractionA0, pointA1, fractionA1, extendA1,\r\n cpB, extendB0, pointB0, fractionB0, pointB1, fractionB1, extendB1,\r\n reversed,\r\n );\r\n }\r\n /**\r\n * Create a plane whose normal is the \"better\" cross product: `vectorA.crossProduct(vectorB)` or\r\n * `vectorA.crossProduct(vectorC)`\r\n * * The heuristic for \"better\" is:\r\n * * first choice is cross product with `vectorB`, if `vectorA` and `vectorB` are sufficiently far from parallel\r\n * (or anti-parallel).\r\n * * otherwise use vectorC\r\n * @param origin plane origin\r\n * @param vectorA vector which must be in the plane.\r\n * @param cosineValue largest cosine of the angle theta between vectorA and vectorB to prefer their cross product, e.g.\r\n * passing 0.94 ~ cos(20deg) will switch to using vectorC in the cross product if theta < ~20deg or theta > ~160deg.\r\n * @param vectorB first candidate for additional in-plane vector\r\n * @param vectorC second candidate for additional in-plane vector\r\n */\r\n public createPlaneWithPreferredPerpendicular(\r\n origin: Point3d, vectorA: Vector3d, cosineValue: number, vectorB: Vector3d, vectorC: Vector3d,\r\n ): Plane3dByOriginAndUnitNormal | undefined {\r\n cosineValue = Geometry.restrictToInterval(Math.abs(cosineValue), 0.0, 1.0 - Geometry.smallFraction);\r\n const dotAA = vectorA.magnitudeSquared();\r\n const dotBB = vectorB.magnitudeSquared();\r\n const dotAB = Math.abs(vectorA.dotProduct(vectorB));\r\n const cross = vectorA.unitCrossProduct(dotAB * dotAB <= cosineValue * cosineValue * dotAA * dotBB ? vectorB : vectorC);\r\n if (cross)\r\n return Plane3dByOriginAndUnitNormal.create(origin, cross);\r\n return undefined;\r\n }\r\n // Caller accesses data from a linestring or segment and passes it here.\r\n // (The line segment in question might be (a) a full line segment or (b) a fragment within a linestring. The fraction and extend parameters\r\n // allow all combinations to be passed in)\r\n private dispatchSegmentArc(\r\n cpA: CurvePrimitive,\r\n extendA0: boolean,\r\n pointA0: Point3d,\r\n fractionA0: number,\r\n pointA1: Point3d,\r\n fractionA1: number,\r\n extendA1: boolean,\r\n arc: Arc3d,\r\n extendB0: boolean,\r\n extendB1: boolean,\r\n reversed: boolean,\r\n ): void {\r\n const lineVector = Vector3d.createStartEnd(pointA0, pointA1);\r\n const plane = this.createPlaneWithPreferredPerpendicular(\r\n pointA0, lineVector, 0.94, arc.perpendicularVector, arc.vector0);\r\n if (plane !== undefined) {\r\n const candidates: CurveLocationDetail[] = [];\r\n arc.appendPlaneIntersectionPoints(plane, candidates);\r\n let lineFraction;\r\n let linePoint: Point3d | undefined;\r\n for (const c of candidates) {\r\n if (this.acceptFraction(extendB0, c.fraction, extendB1)) {\r\n lineFraction = SmallSystem.lineSegment3dClosestPointUnbounded(pointA0, pointA1, c.point);\r\n if (lineFraction !== undefined) {\r\n linePoint = pointA0.interpolate(lineFraction, pointA1, linePoint);\r\n if (linePoint.isAlmostEqualMetric(c.point)\r\n && this.acceptFraction(extendA0, lineFraction, extendA1)) {\r\n this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1,\r\n c.fraction, arc, 0, 1, reversed);\r\n\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Caller promises arcs are coplanar.\r\n // Passes \"other\" as {center, vector0, vector90} in local xy space of cpA\r\n // Solves the arc-arc equations for that local ellipse with unit circle.\r\n // Solution fractions map directly to original arcs.\r\n private dispatchArcArcInPlane(\r\n cpA: Arc3d, extendA: boolean, cpB: Arc3d, extendB: boolean, reversed: boolean,\r\n ): void {\r\n const otherVectors = cpA.otherArcAsLocalVectors(cpB);\r\n if (otherVectors !== undefined) {\r\n const ellipseRadians: number[] = [];\r\n const circleRadians: number[] = [];\r\n TrigPolynomial.solveUnitCircleHomogeneousEllipseIntersection(\r\n otherVectors.center.x, otherVectors.center.y, 1.0,\r\n otherVectors.vector0.x, otherVectors.vector0.y, 0.0,\r\n otherVectors.vector90.x, otherVectors.vector90.y, 0.0,\r\n ellipseRadians, circleRadians,\r\n );\r\n for (let i = 0; i < ellipseRadians.length; i++) {\r\n const fractionA = cpA.sweep.radiansToSignedPeriodicFraction(circleRadians[i]);\r\n const fractionB = cpA.sweep.radiansToSignedPeriodicFraction(ellipseRadians[i]);\r\n // hm .. do we really need to check the fractions? We know they are internal to the beziers\r\n if (this.acceptFraction(extendA, fractionA, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\r\n this.recordPointWithLocalFractions(fractionA, cpA, 0, 1, fractionB, cpB, 0, 1, reversed);\r\n }\r\n }\r\n }\r\n }\r\n // Caller accesses data from two arcs.\r\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\r\n // Solves the arc-arc equations\r\n private dispatchArcArc(\r\n cpA: Arc3d, extendA: boolean, cpB: Arc3d, extendB: boolean, reversed: boolean,\r\n ): void {\r\n // If arcs are in different planes:\r\n // 1) Intersect each plane with the other arc (quadratic)\r\n // 2) accept points that appear in both intersection sets.\r\n // If arcs are in parallel planes -- no intersections\r\n // If arcs are in the same plane -- xy intersection in that plane.\r\n const planeA = Plane3dByOriginAndUnitNormal.create(cpA.center, cpA.perpendicularVector);\r\n const planeB = Plane3dByOriginAndUnitNormal.create(cpB.center, cpB.perpendicularVector);\r\n if (planeA === undefined || planeB === undefined)\r\n return;\r\n if (planeA.getNormalRef().isParallelTo(planeB.getNormalRef())) {\r\n if (planeA.isPointInPlane(planeB.getOriginRef()) && planeB.isPointInPlane(planeA.getOriginRef())) {\r\n // coplanar !!!\r\n this.dispatchArcArcInPlane(cpA, extendA, cpB, extendB, reversed);\r\n }\r\n } else {\r\n const arcBPoints: CurveLocationDetail[] = [];\r\n cpB.appendPlaneIntersectionPoints(planeA, arcBPoints);\r\n const arcAPoints: CurveLocationDetail[] = [];\r\n cpA.appendPlaneIntersectionPoints(planeB, arcAPoints);\r\n for (const detailB of arcBPoints) {\r\n for (const detailA of arcAPoints) {\r\n if (detailA.point.isAlmostEqual(detailB.point)) {\r\n if (this.acceptFraction(extendA, detailA.fraction, extendA)\r\n && this.acceptFraction(extendB, detailB.fraction, extendB)) {\r\n this.recordPointWithLocalFractions(detailA.fraction, cpA, 0, 1, detailB.fraction, cpB, 0, 1, reversed);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Caller accesses data from two arcs.\r\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\r\n // Solves the arc-arc equations\r\n private dispatchArcBsplineCurve3d(\r\n _arc: Arc3d, _extendA: boolean, _cpB: BSplineCurve3d, _extendB: boolean, _reversed: boolean,\r\n ): void {\r\n /*\r\n // Arc: X = C + cU + sV\r\n // implicitize the arc as viewed. This \"3d\" matrix is homogeneous \"XYW\" not \"xyz\"\r\n let matrixA: Matrix3d;\r\n if (this._worldToLocalPerspective) {\r\n const dataA = cpA.toTransformedPoint4d(this._worldToLocalPerspective);\r\n matrixA = Matrix3d.createColumnsXYW(dataA.vector0, dataA.vector0.w, dataA.vector90, dataA.vector90.w, dataA.center, dataA.center.w);\r\n } else {\r\n const dataA = cpA.toTransformedVectors(this._worldToLocalAffine);\r\n matrixA = Matrix3d.createColumnsXYW(dataA.vector0, 0, dataA.vector90, 0, dataA.center, 1);\r\n }\r\n // The worldToLocal has moved the arc vectors into local space.\r\n // matrixA captures the xyw parts (ignoring z)\r\n // for any point in world space,\r\n // THIS CODE ONLY WORKS FOR\r\n const matrixAInverse = matrixA.inverse();\r\n if (matrixAInverse) {\r\n const orderF = cpB.order; // order of the beziers for simple coordinates\r\n const orderG = 2 * orderF - 1; // order of the (single) bezier for squared coordinates.\r\n const coffF = new Float64Array(orderF);\r\n const univariateBezierG = new UnivariateBezier(orderG);\r\n const axx = matrixAInverse.at(0, 0); const axy = matrixAInverse.at(0, 1); const axz = 0.0; const axw = matrixAInverse.at(0, 2);\r\n const ayx = matrixAInverse.at(1, 0); const ayy = matrixAInverse.at(1, 1); const ayz = 0.0; const ayw = matrixAInverse.at(1, 2);\r\n const awx = matrixAInverse.at(2, 0); const awy = matrixAInverse.at(2, 1); const awz = 0.0; const aww = matrixAInverse.at(2, 2);\r\n\r\n if (matrixAInverse) {\r\n let bezier: BezierCurve3dH | undefined;\r\n for (let spanIndex = 0; ; spanIndex++) {\r\n bezier = cpB.getSaturatedBezierSpan3dH(spanIndex, bezier);\r\n if (!bezier) break;\r\n if (this._worldToLocalPerspective)\r\n bezier.tryMultiplyMatrix4dInPlace(this._worldToLocalPerspective);\r\n else if (this._worldToLocalAffine)\r\n bezier.tryTransformInPlace(this._worldToLocalAffine);\r\n univariateBezierG.zero();\r\n bezier.poleProductsXYZW(coffF, axx, axy, axz, axw);\r\n univariateBezierG.addSquaredSquaredBezier(coffF, 1.0);\r\n bezier.poleProductsXYZW(coffF, ayx, ayy, ayz, ayw);\r\n univariateBezierG.addSquaredSquaredBezier(coffF, 1.0);\r\n bezier.poleProductsXYZW(coffF, awx, awy, awz, aww);\r\n univariateBezierG.addSquaredSquaredBezier(coffF, -1.0);\r\n const roots = univariateBezierG.roots(0.0, true);\r\n if (roots) {\r\n for (const root of roots) {\r\n const fractionB = bezier.fractionToParentFraction(root);\r\n // The univariate bezier (which has been transformed by the view transform) evaluates into xyw space\r\n const bcurvePoint4d = bezier.fractionToPoint4d(root);\r\n const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);\r\n const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);\r\n const arcFraction = cpA.sweep.radiansToSignedPeriodicFraction(Math.atan2(s, c));\r\n if (this.acceptFraction(extendA, arcFraction, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\r\n this.recordPointWithLocalFractions(arcFraction, cpA, 0, 1,\r\n fractionB, cpB, 0, 1, reversed);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n */\r\n }\r\n /*\r\n // apply the transformation to bezier curves. optionally construct ranges.\r\n private transformBeziers(beziers: BezierCurve3dH[]) {\r\n if (this._worldToLocalAffine) {\r\n for (const bezier of beziers) bezier.tryTransformInPlace(this._worldToLocalAffine);\r\n } else if (this._worldToLocalPerspective) {\r\n for (const bezier of beziers) bezier.tryMultiplyMatrix4dInPlace(this._worldToLocalPerspective);\r\n }\r\n }\r\n */\r\n /*\r\n private getRanges(beziers: BezierCurveBase[]): Range3d[] {\r\n const ranges: Range3d[] = [];\r\n ranges.length = 0;\r\n for (const b of beziers) {\r\n ranges.push(b.range());\r\n }\r\n return ranges;\r\n }\r\n private _xyzwA0?: Point4d;\r\n private _xyzwA1?: Point4d;\r\n private _xyzwPlane?: Point4d;\r\n private _xyzwB?: Point4d;\r\n\r\n private dispatchBezierBezierStrokeFirst(\r\n bezierA: BezierCurve3dH,\r\n bcurveA: BSplineCurve3dBase,\r\n strokeCountA: number,\r\n bezierB: BezierCurve3dH,\r\n bcurveB: BSplineCurve3dBase,\r\n _strokeCountB: number,\r\n univariateBezierB: UnivariateBezier, // caller-allocated for univariate coefficients.\r\n reversed: boolean) {\r\n if (!this._xyzwA0) this._xyzwA0 = Point4d.create();\r\n if (!this._xyzwA1) this._xyzwA1 = Point4d.create();\r\n if (!this._xyzwPlane) this._xyzwPlane = Point4d.create();\r\n if (!this._xyzwB) this._xyzwB = Point4d.create();\r\n const roots = univariateBezierG.roots(0.0, true);\r\n if (roots) {\r\n for (const root of roots) {\r\n const fractionB = bezier.fractionToParentFraction(root);\r\n // The univariate bezier (which has been transformed by the view transform) evaluates into xyw space\r\n const bcurvePoint4d = bezier.fractionToPoint4d(root);\r\n const c = bcurvePoint4d.dotProductXYZW(axx, axy, axz, axw);\r\n const s = bcurvePoint4d.dotProductXYZW(ayx, ayy, ayz, ayw);\r\n const arcFraction = cpA.sweep.radiansToSignedPeriodicFraction(Math.atan2(s, c));\r\n if (this.acceptFraction(extendA, arcFraction, extendA) && this.acceptFraction(extendB, fractionB, extendB)) {\r\n this.recordPointWithLocalFractions(arcFraction, cpA, 0, 1,\r\n fractionB, cpB, 0, 1, reversed);\r\n }\r\n }\r\n bezierA.fractionToPoint4d(0.0, this._xyzwA0);\r\n let f0 = 0.0;\r\n let f1 = 1.0;\r\n const intervalTolerance = 1.0e-5;\r\n const df = 1.0 / strokeCountA;\r\n for (let i = 1; i <= strokeCountA; i++ , f0 = f1, this._xyzwA0.setFrom(this._xyzwA1)) {\r\n f1 = i * df;\r\n bezierA.fractionToPoint4d(f1, this._xyzwA1);\r\n Point4d.createPlanePointPointZ(this._xyzwA0, this._xyzwA1, this._xyzwPlane);\r\n bezierB.poleProductsXYZW(univariateBezierB.coffs, this._xyzwPlane.x, this._xyzwPlane.y, this._xyzwPlane.z, this._xyzwPlane.w);\r\n let errors = 0;\r\n const roots = univariateBezierB.roots(0.0, true);\r\n if (roots)\r\n for (const r of roots) {\r\n const bezierBFraction = r;\r\n bezierB.fractionToPoint4d(bezierBFraction, this._xyzwB);\r\n const segmentAFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(this._xyzwA0, this._xyzwA1, this._xyzwB);\r\n if (segmentAFraction && Geometry.isIn01WithTolerance(segmentAFraction, intervalTolerance)) {\r\n const bezierAFraction = Geometry.interpolate(f0, segmentAFraction, f1);\r\n /*- TODO implement newton search\r\n const xyMatchingFunction = new BezierBezierIntersectionXYRRToRRD(bezierA, bezierB);\r\n const newtonSearcher = new Newton2dUnboundedWithDerivative(xyMatchingFunction);\r\n newtonSearcher.setUV(bezierAFraction, bezierBFraction);\r\n if (newtonSearcher.runIterations()) {\r\n bezierAFraction = newtonSearcher.getU();\r\n bezierBFraction = newtonSearcher.getV();\r\n }\r\n // We have a near intersection at fractions on the two beziers !!!\r\n // Iterate on the curves for a true intersection ....\r\n // NEEDS WORK -- just accept . . .\r\n const bcurveAFraction = bezierA.fractionToParentFraction(bezierAFraction);\r\n const bcurveBFraction = bezierB.fractionToParentFraction(bezierBFraction);\r\n const xyzA0 = bezierA.fractionToPoint(bezierAFraction);\r\n const xyzA1 = bcurveA.fractionToPoint(bcurveAFraction);\r\n const xyzB0 = bezierB.fractionToPoint(bezierBFraction);\r\n const xyzB1 = bcurveB.fractionToPoint(bcurveBFraction);\r\n if (!xyzA0.isAlmostEqualXY(xyzA1))\r\n errors++;\r\n if (!xyzB0.isAlmostEqualXY(xyzB1))\r\n errors++;\r\n if (errors > 0 && !xyzA0.isAlmostEqual(xyzB0))\r\n errors++;\r\n if (errors > 0 && !xyzA1.isAlmostEqual(xyzB1))\r\n errors++;\r\n if (this.acceptFraction(false, bcurveAFraction, false) && this.acceptFraction(false, bcurveBFraction, false)) {\r\n this.recordPointWithLocalFractions(bcurveAFraction, bcurveA, 0, 1,\r\n bcurveBFraction, bcurveB, 0, 1, reversed);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n */\r\n // Caller accesses data from two arcs.\r\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\r\n // Solves the arc-arc equations\r\n private dispatchBSplineCurve3dBSplineCurve3d(\r\n _bcurveA: BSplineCurve3dBase, _bcurveB: BSplineCurve3dBase, _reversed: boolean,\r\n ): void {\r\n /*\r\n const bezierSpanA = bcurveA.collectBezierSpans(true) as BezierCurve3dH[];\r\n const bezierSpanB = bcurveB.collectBezierSpans(true) as BezierCurve3dH[];\r\n const numA = bezierSpanA.length;\r\n const numB = bezierSpanB.length;\r\n this.transformBeziers(bezierSpanA);\r\n this.transformBeziers(bezierSpanB);\r\n const rangeA = this.getRanges(bezierSpanA);\r\n const rangeB = this.getRanges(bezierSpanB);\r\n const orderA = bcurveA.order;\r\n const orderB = bcurveB.order;\r\n const univariateCoffsA = new UnivariateBezier(orderA);\r\n const univariateCoffsB = new UnivariateBezier(orderB);\r\n for (let a = 0; a < numA; a++) {\r\n for (let b = 0; b < numB; b++) {\r\n if (rangeA[a].intersectsRangeXY(rangeB[b])) {\r\n const strokeCountA = bezierSpanA[a].computeStrokeCountForOptions();\r\n const strokeCountB = bezierSpanB[b].computeStrokeCountForOptions();\r\n if (strokeCountA < strokeCountB)\r\n this.dispatchBezierBezierStrokeFirst(bezierSpanA[a], bcurveA, strokeCountA, bezierSpanB[b], bcurveB, strokeCountB, univariateCoffsB, !_reversed);\r\n else\r\n this.dispatchBezierBezierStrokeFirst(bezierSpanB[b], bcurveB, strokeCountB, bezierSpanA[a], bcurveA, strokeCountA, univariateCoffsA, _reversed);\r\n }\r\n }\r\n }\r\n */\r\n }\r\n /*\r\n /**\r\n * Apply the projection transform (if any) to (xyz, w)\r\n * @param xyz xyz parts of input point.\r\n * @param w weight to use for homogeneous effects\r\n */\r\n /*\r\n private projectPoint(xyz: XYAndZ, w: number = 1.0): Point4d {\r\n if (this._worldToLocalPerspective)\r\n return this._worldToLocalPerspective.multiplyPoint3d(xyz, w);\r\n if (this._worldToLocalAffine)\r\n return this._worldToLocalAffine.multiplyXYZW(xyz.x, xyz.y, xyz.z, w);\r\n return Point4d.createFromPointAndWeight(xyz, w);\r\n }\r\n private mapNPCPlaneToWorld(npcPlane: Point4d, worldPlane: Point4d) {\r\n // for NPC pointY, Y^ * H = 0 is \"on\" plane H. (Hat is transpose)\r\n // NPC Y is A*X for our transform A and worldPointX.\r\n // hence (A X)^ * H = 0\r\n // hence X^ * A^ * H = 0\r\n // hence K = A^ * H\r\n if (this._worldToLocalAffine) {\r\n this._worldToLocalAffine.multiplyTransposeXYZW(npcPlane.x, npcPlane.y, npcPlane.z, npcPlane.w, worldPlane);\r\n } else if (this._worldToLocalPerspective) {\r\n this._worldToLocalPerspective.multiplyTransposePoint4d(npcPlane, worldPlane);\r\n } else {\r\n npcPlane.clone(worldPlane);\r\n }\r\n }\r\n */\r\n // Caller accesses data from segment and bsplineCurve\r\n // Selects the best conditioned arc (in xy parts) as \"circle after inversion\"\r\n // Solves the arc-arc equations\r\n private dispatchSegmentBsplineCurve(\r\n _cpA: CurvePrimitive,\r\n _extendA0: boolean,\r\n _pointA0: Point3d,\r\n _fractionA0: number,\r\n _pointA1: Point3d,\r\n _fractionA1: number,\r\n _extendA1: boolean,\r\n _bcurve: BSplineCurve3d,\r\n _extendB: boolean,\r\n _reversed: boolean,\r\n ): void {\r\n /*\r\n const pointA0H = this.projectPoint(pointA0);\r\n const pointA1H = this.projectPoint(pointA1);\r\n const planeCoffs = Point4d.createPlanePointPointZ(pointA0H, pointA1H);\r\n this.mapNPCPlaneToWorld(planeCoffs, planeCoffs);\r\n // NOW .. we have a plane in world space. Intersect it with the bspline:\r\n const intersections: CurveLocationDetail[] = [];\r\n bcurve.appendPlaneIntersectionPoints(planeCoffs, intersections);\r\n // intersections has WORLD points with bspline fractions. (The bspline fractions are all good 0..1 fractions within the spline.)\r\n // accept those that are within the segment range.\r\n for (const detail of intersections) {\r\n const fractionB = detail.fraction;\r\n const curvePoint = detail.point;\r\n const curvePointH = this.projectPoint(curvePoint);\r\n const lineFraction = SmallSystem.lineSegment3dHXYClosestPointUnbounded(pointA0H, pointA1H, curvePointH);\r\n if (lineFraction !== undefined && this.acceptFraction(extendA0, lineFraction, extendA1) && this.acceptFraction(extendB, fractionB, extendB)) {\r\n this.recordPointWithLocalFractions(lineFraction, cpA, fractionA0, fractionA1,\r\n fractionB, bcurve, 0, 1, reversed);\r\n }\r\n }\r\n */\r\n }\r\n /** Low level dispatch of linestring with (beziers of) a bspline curve */\r\n public dispatchLineStringBSplineCurve(\r\n _lsA: LineString3d, _extendA: boolean, _curveB: BSplineCurve3d, _extendB: boolean, _reversed: boolean,\r\n ): any {\r\n /*\r\n const numA = lsA.numPoints();\r\n if (numA > 1) {\r\n const dfA = 1.0 / (numA - 1);\r\n let fA0;\r\n let fA1;\r\n fA0 = 0.0;\r\n const pointA0 = CurveCurveIntersectXYZ._workPointA0;\r\n const pointA1 = CurveCurveIntersectXYZ._workPointA1;\r\n lsA.pointAt(0, pointA0);\r\n for (let iA = 1; iA < numA; iA++ , pointA0.setFrom(pointA1), fA0 = fA1) {\r\n lsA.pointAt(iA, pointA1);\r\n fA1 = iA * dfA;\r\n this.dispatchSegmentBsplineCurve(\r\n lsA, iA === 1 && extendA, pointA0, fA0, pointA1, fA1, (iA + 1) === numA && extendA,\r\n curveB, extendB, reversed);\r\n }\r\n }\r\n return undefined;\r\n */\r\n }\r\n /** Detail computation for segment intersecting linestring. */\r\n public computeSegmentLineString(\r\n lsA: LineSegment3d, extendA: boolean, lsB: LineString3d, extendB: boolean, reversed: boolean,\r\n ): any {\r\n const pointA0 = lsA.point0Ref;\r\n const pointA1 = lsA.point1Ref;\r\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\r\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\r\n const numB = lsB.numPoints();\r\n if (numB > 1) {\r\n const dfB = 1.0 / (numB - 1);\r\n let fB0;\r\n let fB1;\r\n fB0 = 0.0;\r\n lsB.pointAt(0, pointB0);\r\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\r\n lsB.pointAt(ib, pointB1);\r\n fB1 = ib * dfB;\r\n this.dispatchSegmentSegment(\r\n lsA, extendA, pointA0, 0.0, pointA1, 1.0, extendA, lsB, ib === 1 && extendB,\r\n pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB, reversed,\r\n );\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Detail computation for arc intersecting linestring. */\r\n public computeArcLineString(\r\n arcA: Arc3d, extendA: boolean, lsB: LineString3d, extendB: boolean, reversed: boolean,\r\n ): any {\r\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\r\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\r\n const numB = lsB.numPoints();\r\n if (numB > 1) {\r\n const dfB = 1.0 / (numB - 1);\r\n let fB0;\r\n let fB1;\r\n fB0 = 0.0;\r\n lsB.pointAt(0, pointB0);\r\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\r\n lsB.pointAt(ib, pointB1);\r\n fB1 = ib * dfB;\r\n this.dispatchSegmentArc(\r\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1,\r\n (ib + 1) === numB && extendB, arcA, extendA, extendA, !reversed);\r\n }\r\n }\r\n return undefined;\r\n }\r\n /** Double dispatch handler for strongly typed segment. */\r\n public override handleLineSegment3d(segmentA: LineSegment3d): any {\r\n if (this._geometryB instanceof LineSegment3d) {\r\n const segmentB = this._geometryB;\r\n this.dispatchSegmentSegment(\r\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA,\r\n segmentB, this._extendB, segmentB.point0Ref, 0.0, segmentB.point1Ref, 1.0, this._extendB,\r\n false,\r\n );\r\n } else if (this._geometryB instanceof LineString3d) {\r\n this.computeSegmentLineString(segmentA, this._extendA, this._geometryB, this._extendB, false);\r\n } else if (this._geometryB instanceof Arc3d) {\r\n this.dispatchSegmentArc(\r\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref,\r\n 1.0, this._extendA, this._geometryB, this._extendB, this._extendB, false,\r\n );\r\n } else if (this._geometryB instanceof BSplineCurve3d) {\r\n this.dispatchSegmentBsplineCurve(\r\n segmentA, this._extendA, segmentA.point0Ref, 0.0, segmentA.point1Ref,\r\n 1.0, this._extendA, this._geometryB, this._extendB, false,\r\n );\r\n }\r\n }\r\n /** double dispatch handler for strongly typed linestring .. */\r\n public override handleLineString3d(lsA: LineString3d): any {\r\n if (this._geometryB instanceof LineString3d) {\r\n const lsB = this._geometryB;\r\n const pointA0 = CurveCurveIntersectXYZ._workPointAA0;\r\n const pointA1 = CurveCurveIntersectXYZ._workPointAA1;\r\n const pointB0 = CurveCurveIntersectXYZ._workPointBB0;\r\n const pointB1 = CurveCurveIntersectXYZ._workPointBB1;\r\n const numA = lsA.numPoints();\r\n const numB = lsB.numPoints();\r\n if (numA > 1 && numB > 1) {\r\n lsA.pointAt(0, pointA0);\r\n const dfA = 1.0 / (numA - 1);\r\n const dfB = 1.0 / (numB - 1);\r\n let fA0 = 0.0;\r\n let fA1, fB0, fB1;\r\n const extendA = this._extendA;\r\n const extendB = this._extendB;\r\n lsA.pointAt(0, pointA0);\r\n for (let ia = 1; ia < numA; ia++, pointA0.setFrom(pointA1), fA0 = fA1) {\r\n fA1 = ia * dfA;\r\n fB0 = 0.0;\r\n lsA.pointAt(ia, pointA1);\r\n lsB.pointAt(0, pointB0);\r\n for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {\r\n lsB.pointAt(ib, pointB1);\r\n fB1 = ib * dfB;\r\n this.dispatchSegmentSegment(\r\n lsA, ia === 1 && extendA, pointA0, fA0, pointA1, fA1, (ia + 1) === numA && extendA,\r\n lsB, ib === 1 && extendB, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB,\r\n false,\r\n );\r\n }\r\n }\r\n }\r\n } else if (this._geometryB instanceof LineSegment3d) {\r\n this.computeSegmentLineString(this._geometryB, this._extendB, lsA, this._extendA, true);\r\n } else if (this._geometryB instanceof Arc3d) {\r\n this.computeArcLineString(this._geometryB, this._extendB, lsA, this._extendA, true);\r\n } else if (this._geometryB instanceof BSplineCurve3d) {\r\n this.dispatchLineStringBSplineCurve(lsA, this._extendA, this._geometryB, this._extendB, false);\r\n }\r\n return undefined;\r\n }\r\n /** Double dispatch handler for strongly typed arc. */\r\n public override handleArc3d(arc0: Arc3d): any {\r\n if (this._geometryB instanceof LineSegment3d) {\r\n this.dispatchSegmentArc(\r\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref,\r\n 1.0, this._extendB, arc0, this._extendA, this._extendA, true,\r\n );\r\n } else if (this._geometryB instanceof LineString3d) {\r\n this.computeArcLineString(arc0, this._extendA, this._geometryB, this._extendB, false);\r\n } else if (this._geometryB instanceof Arc3d) {\r\n this.dispatchArcArc(arc0, this._extendA, this._geometryB, this._extendB, false);\r\n } else if (this._geometryB instanceof BSplineCurve3d) {\r\n this.dispatchArcBsplineCurve3d(arc0, this._extendA, this._geometryB, this._extendB, false);\r\n }\r\n return undefined;\r\n }\r\n /** Double dispatch handler for strongly typed bspline curve.. */\r\n public override handleBSplineCurve3d(curve: BSplineCurve3d): any {\r\n if (this._geometryB instanceof LineSegment3d) {\r\n this.dispatchSegmentBsplineCurve(\r\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref,\r\n 1.0, this._extendB, curve, this._extendA, true,\r\n );\r\n } else if (this._geometryB instanceof LineString3d) {\r\n this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB, curve, this._extendA, true);\r\n } else if (this._geometryB instanceof Arc3d) {\r\n this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB, curve, this._extendA, true);\r\n } else if (this._geometryB instanceof BSplineCurve3dBase) {\r\n this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);\r\n }\r\n return undefined;\r\n }\r\n /** Double dispatch handler for strongly typed homogeneous bspline curve. */\r\n public override handleBSplineCurve3dH(_curve: BSplineCurve3dH): any {\r\n /*\r\n // NEEDS WORK -- make \"dispatch\" methods tolerant of both 3d and 3dH\r\n // \"easy\" if both present BezierCurve3dH span loaders\r\n if (this._geometryB instanceof LineSegment3d) {\r\n this.dispatchSegmentBsplineCurve(\r\n this._geometryB, this._extendB, this._geometryB.point0Ref, 0.0, this._geometryB.point1Ref, 1.0, this._extendB,\r\n curve, this._extendA, true);\r\n } else if (this._geometryB instanceof LineString3d) {\r\n this.dispatchLineStringBSplineCurve(this._geometryB, this._extendB, curve, this._extendA, true);\r\n } else if (this._geometryB instanceof Arc3d) {\r\n this.dispatchArcBsplineCurve3d(this._geometryB, this._extendB, curve, this._extendA, true);\r\n }\r\n */\r\n return undefined;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveExtendMode.js","sourceRoot":"","sources":["../../../src/curve/CurveExtendMode.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QA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,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE;YACpC,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC;YAC9C,MAAM,KAAK,GAAG,kBAAkB,CAAC,mDAAmD,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;YACrG,MAAM,KAAK,GAAG,kBAAkB,CAAC,mDAAmD,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;YACrG,IAAI,KAAK,KAAK,eAAe,CAAC,IAAI,EAAE;gBAClC,IAAI,KAAK,KAAK,eAAe,CAAC,IAAI,EAAE;oBAClC,yEAAyE;oBACzE,QAAQ,GAAG,KAAK,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC;iBAC3D;qBAAM;oBACL,gCAAgC;oBAChC,IAAI,QAAQ,GAAG,GAAG;wBAChB,QAAQ,IAAI,cAAc,CAAC;iBAC9B;aACF;iBAAM,IAAI,KAAK,KAAK,eAAe,CAAC,IAAI,EAAE;gBACzC,IAAI,QAAQ,GAAG,GAAG;oBAChB,QAAQ,IAAI,cAAc,CAAC;aAC9B;iBAAM,EAAK,oBAAoB;gBAC9B,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3C;SACF;QACD,OAAO,QAAQ,CAAC;IAClB,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 Curve\n */\n\nimport { Geometry } from \"../Geometry\";\nimport { AngleSweep } from \"../geometry3d/AngleSweep\";\n\n/** module Curve */\n/** enumeration of condition for extending a curve beyond start or end point.\n * * Not all CurvePrimitives support these modes.\n * @public\n */\nexport enum CurveExtendMode {\n /** No extension allowed. */\n None = 0,\n /** Extend along continuation of the end tangent */\n OnTangent = 1,\n /** Extend along continuation of the curve. */\n OnCurve = 2,\n}\n/** Logic for deciding how a curve may be extended for closest point or intersection searches.\n * @public\n */\nexport class CurveExtendOptions {\n /** Given an ExtendParameter, isolate the particular CurveExtendOptions in effect at an end.\n * * Return undefined if `param === false`\n * * return the (strongly typed) pointer to the param if it is a single CurveExtendOptions.\n * * Return dereferenced array entry 0 or 1 if the param is an array of CurveExtendOptions.\n */\n public static resolveVariantCurveExtendParameterToCurveExtendMode(param: VariantCurveExtendParameter, endIndex: 0 | 1): CurveExtendMode {\n if (param === false)\n return CurveExtendMode.None;\n if (param === true)\n return CurveExtendMode.OnCurve;\n if (Array.isArray(param))\n return param[endIndex];\n return param;\n }\n /**\n *\n * * if fraction is between 0 and 1 return it unchanged.\n * * if fraction is less than 0 use the variant param to choose the fraction or 0\n * * if fraction is greater than 1 use the variant param to choose the fraction or 1\n *\n */\n public static correctFraction(extendParam: VariantCurveExtendParameter, fraction: number): number {\n if (fraction < 0) {\n const mode = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 0);\n if (mode === CurveExtendMode.None)\n fraction = 0.0;\n } else if (fraction > 1.0) {\n const mode = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 1);\n if (mode === CurveExtendMode.None)\n fraction = 1.0;\n }\n return fraction;\n }\n /**\n * Adjust a radians value to an angle sweep, allowing the extendParam to affect choice among periodic fractions.\n * * if radians is within the sweep, convert it to a fraction of the sweep.\n * * if radians is outside, use the extendParam to choose among:\n * * fraction below 0\n * * fraction above 1\n */\n public static resolveRadiansToSweepFraction(extendParam: VariantCurveExtendParameter, radians: number, sweep: AngleSweep): number {\n let fraction = sweep.radiansToSignedPeriodicFraction(radians);\n if (!sweep.isRadiansInSweep(radians)) {\n const fractionPeriod = sweep.fractionPeriod();\n const mode0 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 0);\n const mode1 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 1);\n if (mode0 !== CurveExtendMode.None) {\n if (mode1 !== CurveExtendMode.None) {\n // both extensions possible ... let the sweep resolve to the \"closer\" end\n fraction = sweep.radiansToSignedPeriodicFraction(radians);\n } else {\n // only extend to negative .....\n if (fraction > 1.0)\n fraction -= fractionPeriod;\n }\n } else if (mode1 !== CurveExtendMode.None) {\n if (fraction < 0.0)\n fraction += fractionPeriod;\n } else { // both clamped !!!!\n fraction = Geometry.clamp(fraction, 0, 1);\n }\n }\n return fraction;\n }\n}\n/** Variants of a single parameter.\n * Use this type in a function signature where caller may want simple true, false, or same extend mode for both ends.\n * @public\n */\nexport type VariantCurveExtendParameter = boolean | CurveExtendMode | CurveExtendMode[];\n"]}
|
|
1
|
+
{"version":3,"file":"CurveExtendMode.js","sourceRoot":"","sources":["../../../src/curve/CurveExtendMode.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,mBAAmB;AACnB;;;GAGG;AACH,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,4BAA4B;IAC5B,qDAAQ,CAAA;IACR,mDAAmD;IACnD,+DAAa,CAAA;IACb,8CAA8C;IAC9C,2DAAW,CAAA;AACb,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B;AACD;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC7B;;;;OAIG;IACI,MAAM,CAAC,mDAAmD,CAAC,KAAkC,EAAE,QAAe;QACnH,IAAI,KAAK,KAAK,KAAK;YACjB,OAAO,eAAe,CAAC,IAAI,CAAC;QAC9B,IAAI,KAAK,KAAK,IAAI;YAChB,OAAO,eAAe,CAAC,OAAO,CAAC;QACjC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACtB,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;QACzB,OAAO,KAAK,CAAC;IACf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ACF;iBAAM,IAAI,KAAK,KAAK,eAAe,CAAC,IAAI,EAAE;gBACzC,IAAI,QAAQ,GAAG,GAAG;oBAChB,QAAQ,IAAI,cAAc,CAAC;aAC9B;iBAAM,EAAK,oBAAoB;gBAC9B,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;aAC3C;SACF;QACD,OAAO,QAAQ,CAAC;IAClB,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/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { AngleSweep } from \"../geometry3d/AngleSweep\";\r\n\r\n/** module Curve */\r\n/** enumeration of condition for extending a curve beyond start or end point.\r\n * * Not all CurvePrimitives support these modes.\r\n * @public\r\n */\r\nexport enum CurveExtendMode {\r\n /** No extension allowed. */\r\n None = 0,\r\n /** Extend along continuation of the end tangent */\r\n OnTangent = 1,\r\n /** Extend along continuation of the curve. */\r\n OnCurve = 2,\r\n}\r\n/** Logic for deciding how a curve may be extended for closest point or intersection searches.\r\n * @public\r\n */\r\nexport class CurveExtendOptions {\r\n /** Given an ExtendParameter, isolate the particular CurveExtendOptions in effect at an end.\r\n * * Return undefined if `param === false`\r\n * * return the (strongly typed) pointer to the param if it is a single CurveExtendOptions.\r\n * * Return dereferenced array entry 0 or 1 if the param is an array of CurveExtendOptions.\r\n */\r\n public static resolveVariantCurveExtendParameterToCurveExtendMode(param: VariantCurveExtendParameter, endIndex: 0 | 1): CurveExtendMode {\r\n if (param === false)\r\n return CurveExtendMode.None;\r\n if (param === true)\r\n return CurveExtendMode.OnCurve;\r\n if (Array.isArray(param))\r\n return param[endIndex];\r\n return param;\r\n }\r\n /**\r\n *\r\n * * if fraction is between 0 and 1 return it unchanged.\r\n * * if fraction is less than 0 use the variant param to choose the fraction or 0\r\n * * if fraction is greater than 1 use the variant param to choose the fraction or 1\r\n *\r\n */\r\n public static correctFraction(extendParam: VariantCurveExtendParameter, fraction: number): number {\r\n if (fraction < 0) {\r\n const mode = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 0);\r\n if (mode === CurveExtendMode.None)\r\n fraction = 0.0;\r\n } else if (fraction > 1.0) {\r\n const mode = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 1);\r\n if (mode === CurveExtendMode.None)\r\n fraction = 1.0;\r\n }\r\n return fraction;\r\n }\r\n /**\r\n * Adjust a radians value to an angle sweep, allowing the extendParam to affect choice among periodic fractions.\r\n * * if radians is within the sweep, convert it to a fraction of the sweep.\r\n * * if radians is outside, use the extendParam to choose among:\r\n * * fraction below 0\r\n * * fraction above 1\r\n */\r\n public static resolveRadiansToSweepFraction(extendParam: VariantCurveExtendParameter, radians: number, sweep: AngleSweep): number {\r\n let fraction = sweep.radiansToSignedPeriodicFraction(radians);\r\n if (!sweep.isRadiansInSweep(radians)) {\r\n const fractionPeriod = sweep.fractionPeriod();\r\n const mode0 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 0);\r\n const mode1 = CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extendParam, 1);\r\n if (mode0 !== CurveExtendMode.None) {\r\n if (mode1 !== CurveExtendMode.None) {\r\n // both extensions possible ... let the sweep resolve to the \"closer\" end\r\n fraction = sweep.radiansToSignedPeriodicFraction(radians);\r\n } else {\r\n // only extend to negative .....\r\n if (fraction > 1.0)\r\n fraction -= fractionPeriod;\r\n }\r\n } else if (mode1 !== CurveExtendMode.None) {\r\n if (fraction < 0.0)\r\n fraction += fractionPeriod;\r\n } else { // both clamped !!!!\r\n fraction = Geometry.clamp(fraction, 0, 1);\r\n }\r\n }\r\n return fraction;\r\n }\r\n}\r\n/** Variants of a single parameter.\r\n * Use this type in a function signature where caller may want simple true, false, or same extend mode for both ends.\r\n * @public\r\n */\r\nexport type VariantCurveExtendParameter = boolean | CurveExtendMode | CurveExtendMode[];\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveFactory.js","sourceRoot":"","sources":["../../../src/curve/CurveFactory.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,6DAA6D;AAE7D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAA0B,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAgB,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OA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QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnF,MAAM,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnF,MAAM,SAAS,GAAG,WAAW,CAAC,cAAc,CAC1C,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAC5B,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAC5B,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAC5B,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAC/B,IAAI,SAAS,KAAK,SAAS,EAAE;YAC3B,OAAO,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;SAChG;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CAEF;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,OAAiB,EAAE,OAAiB,EAAE,WAAqB,EAAE,MAAiB;IACvG,gEAAgE;IAChE,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IACzD,OAAO,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\n\n// import { Geometry, Angle, AngleSweep } from \"../Geometry\";\n\nimport { AxisIndex, AxisOrder, Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\nimport { Angle } from \"../geometry3d/Angle\";\nimport { AngleSweep } from \"../geometry3d/AngleSweep\";\nimport { Ellipsoid, GeodesicPathPoint } from \"../geometry3d/Ellipsoid\";\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3dArrayCarrier } from \"../geometry3d/Point3dArrayCarrier\";\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\nimport { PolylineOps } from \"../geometry3d/PolylineOps\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { Segment1d } from \"../geometry3d/Segment1d\";\nimport { Transform } from \"../geometry3d/Transform\";\nimport { XAndY } from \"../geometry3d/XYZProps\";\nimport { SmallSystem } from \"../numerics/Polynomials\";\nimport { IndexedPolyface } from \"../polyface/Polyface\";\nimport { PolyfaceBuilder } from \"../polyface/PolyfaceBuilder\";\nimport { Cone } from \"../solid/Cone\";\nimport { RuledSweep } from \"../solid/RuledSweep\";\nimport { TorusPipe } from \"../solid/TorusPipe\";\nimport { Arc3d, ArcBlendData } from \"./Arc3d\";\nimport { AnyCurve } from \"./CurveChain\";\nimport { CurveChain } from \"./CurveCollection\";\nimport { CurvePrimitive } from \"./CurvePrimitive\";\nimport { GeometryQuery } from \"./GeometryQuery\";\nimport { LineSegment3d } from \"./LineSegment3d\";\nimport { LineString3d } from \"./LineString3d\";\nimport { Loop } from \"./Loop\";\nimport { Path } from \"./Path\";\nimport { IntegratedSpiral3d } from \"./spiral/IntegratedSpiral3d\";\nimport { IntegratedSpiralTypeName } from \"./spiral/TransitionSpiral3d\";\nimport { StrokeOptions } from \"./StrokeOptions\";\n\n// cspell:word CCWXY\n\n/**\n * Interface to carry parallel arrays of planes and sections, and optional geometry assembled from them, as returned by [CurveFactory.createMiteredSweepSections].\n * @public\n */\nexport interface SectionSequenceWithPlanes {\n /** the plane of each section */\n planes: Plane3dByOriginAndUnitNormal[];\n /** section curve projected onto the corresponding plane */\n sections: AnyCurve[];\n /**\n * Optional `RuledSweep` generated from the sections.\n * * The `RuledSweep` and sections array refer to the same section objects.\n */\n ruledSweep?: RuledSweep;\n /** Optional mesh generated from the `RuledSweep` generated from the sections. */\n mesh?: IndexedPolyface;\n}\n\n/**\n * Enumeration of geometric output for [CurveFactory.createMiteredSweepSections].\n * @public\n */\nexport enum MiteredSweepOutputSelect {\n /** Output only the parallel arrays of planes and sections. */\n Sections = 0,\n /** Output planes and sections, as well as the assembled ruled sweep. */\n AlsoRuledSweep = 1,\n /** Output planes and sections, as well as the assembled ruled sweep and its stroked mesh. */\n AlsoMesh = 2,\n}\n\n/**\n * Interface bundling options for [CurveFactory.createMiteredSweepSections].\n * @public\n */\nexport interface MiteredSweepOptions {\n /** Whether first and last planes are averaged and equated when the centerline is physically closed. Default value is `false`. */\n wrapIfPhysicallyClosed?: boolean;\n /** Whether to output sections only, or sections plus optional geometry constructed from them. Default value is `MiteredSweepOutputSelect.Sections`. */\n outputSelect?: MiteredSweepOutputSelect;\n /** How to stroke the ruled sweep if outputting a mesh. If undefined, default stroke options are used. */\n strokeOptions?: StrokeOptions;\n /** Whether to cap the ruled sweep if outputting a ruled sweep or mesh. Default value is `false`. */\n capped?: boolean;\n}\n\n/**\n * The `CurveFactory` class contains methods for specialized curve constructions.\n * @public\n */\nexport class CurveFactory {\n /** (cautiously) construct and save a line segment between fractional positions. */\n private static addPartialSegment(path: Path, allowBackup: boolean, pointA: Point3d | undefined, pointB: Point3d | undefined, fraction0: number, fraction1: number) {\n if (allowBackup || (fraction1 > fraction0)) {\n if (pointA !== undefined && pointB !== undefined && !Geometry.isAlmostEqualNumber(fraction0, fraction1))\n path.tryAddChild(LineSegment3d.create(pointA.interpolate(fraction0, pointB), pointA.interpolate(fraction1, pointB)));\n }\n }\n\n /**\n * Create a circular arc from start point, tangent at start, and another point (endpoint) on the arc.\n * @param pointA\n * @param tangentA\n * @param pointB\n */\n public static createArcPointTangentPoint(pointA: Point3d, tangentA: Vector3d, pointB: Point3d): Arc3d | undefined {\n const vectorV = Vector3d.createStartEnd(pointA, pointB);\n const frame = Matrix3d.createRigidFromColumns(tangentA, vectorV, AxisOrder.XYZ);\n if (frame !== undefined) {\n const vv = vectorV.dotProduct(vectorV);\n const vw = frame.dotColumnY(vectorV);\n const alpha = Geometry.conditionalDivideCoordinate(vv, 2 * vw);\n if (alpha !== undefined) {\n const vector0 = frame.columnY();\n vector0.scaleInPlace(-alpha);\n const vector90 = frame.columnX();\n vector90.scaleInPlace(alpha);\n const centerToEnd = vector0.plus(vectorV);\n const sweepAngle = vector0.angleTo(centerToEnd);\n let sweepRadians = sweepAngle.radians; // That's always positive and less than PI.\n if (tangentA.dotProduct(centerToEnd) < 0.0) // ah, sweepRadians is the wrong way\n sweepRadians = 2.0 * Math.PI - sweepRadians;\n const center = pointA.plusScaled(vector0, -1.0);\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, sweepRadians));\n }\n }\n return undefined;\n }\n\n /**\n * Construct a sequence of alternating lines and arcs with the arcs creating tangent transition between consecutive edges.\n * * If the radius parameter is a number, that radius is used throughout.\n * * If the radius parameter is an array of numbers, `radius[i]` is applied at `point[i]`.\n * * Note that since no fillet is constructed at the initial or final point, those entries in `radius[]` are never referenced.\n * * A zero radius for any point indicates to leave the as a simple corner.\n * @param points point source\n * @param radius fillet radius or array of radii indexed to correspond to the points.\n * @param allowBackupAlongEdge true to allow edges to be created going \"backwards\" along edges if needed to create the blend.\n */\n public static createFilletsInLineString(points: LineString3d | IndexedXYZCollection | Point3d[], radius: number | number[], allowBackupAlongEdge: boolean = true): Path | undefined {\n if (Array.isArray(points))\n return this.createFilletsInLineString(new Point3dArrayCarrier(points), radius, allowBackupAlongEdge);\n if (points instanceof LineString3d)\n return this.createFilletsInLineString(points.packedPoints, radius, allowBackupAlongEdge);\n\n const n = points.length;\n if (n <= 1)\n return undefined;\n const pointA = points.getPoint3dAtCheckedPointIndex(0)!;\n const pointB = points.getPoint3dAtCheckedPointIndex(1)!;\n // remark: n=2 and n=3 cases should fall out from loop logic\n const blendArray: ArcBlendData[] = [];\n // build one-sided blends at each end . .\n blendArray.push({ fraction10: 0.0, fraction12: 0.0, point: pointA.clone() });\n\n for (let i = 1; i + 1 < n; i++) {\n const pointC = points.getPoint3dAtCheckedPointIndex(i + 1)!;\n let thisRadius = 0;\n if (Array.isArray(radius)) {\n if (i < radius.length)\n thisRadius = radius[i];\n } else if (Number.isFinite(radius))\n thisRadius = radius;\n\n if (thisRadius !== 0.0)\n blendArray.push(Arc3d.createFilletArc(pointA, pointB, pointC, thisRadius));\n else\n blendArray.push({ fraction10: 0.0, fraction12: 0.0, point: pointB.clone() });\n pointA.setFromPoint3d(pointB);\n pointB.setFromPoint3d(pointC);\n }\n blendArray.push({ fraction10: 0.0, fraction12: 0.0, point: pointB.clone() });\n if (!allowBackupAlongEdge) {\n // suppress arcs that have overlap with both neighbors or flood either neighbor ..\n for (let i = 1; i + 1 < n; i++) {\n const b = blendArray[i];\n if (b.fraction10 > 1.0\n || b.fraction12 > 1.0\n || 1.0 - b.fraction10 < blendArray[i - 1].fraction12\n || b.fraction12 > 1.0 - blendArray[i + 1].fraction10) {\n b.fraction10 = 0.0;\n b.fraction12 = 0.0;\n blendArray[i].arc = undefined;\n }\n }\n /* The \"1-b\" logic above prevents this loop from ever doing anything.\n // on edge with conflict, suppress the arc with larger fraction\n for (let i = 1; i < n; i++) {\n const b0 = blendArray[i - 1];\n const b1 = blendArray[i];\n if (b0.fraction12 > 1 - b1.fraction10) {\n const b = b0.fraction12 > b1.fraction12 ? b1 : b0;\n b.fraction10 = 0.0;\n b.fraction12 = 0.0;\n blendArray[i].arc = undefined;\n }\n } */\n }\n const path = Path.create();\n this.addPartialSegment(path, allowBackupAlongEdge, blendArray[0].point, blendArray[1].point, blendArray[0].fraction12, 1.0 - blendArray[1].fraction10);\n // add each path and successor edge ...\n for (let i = 1; i + 1 < points.length; i++) {\n const b0 = blendArray[i];\n const b1 = blendArray[i + 1];\n path.tryAddChild(b0.arc);\n this.addPartialSegment(path, allowBackupAlongEdge, b0.point, b1.point, b0.fraction12, 1.0 - b1.fraction10);\n }\n return path;\n }\n\n /** Create a `Loop` with given xy corners and fixed z.\n * * The corners always proceed counter clockwise from lower left.\n * * If the radius is too large for the outer rectangle size, it is reduced to half of the the smaller x or y size.\n */\n public static createRectangleXY(x0: number, y0: number, x1: number, y1: number, z: number = 0, filletRadius?: number): Loop {\n let radius = Geometry.correctSmallMetricDistance(filletRadius);\n const xMin = Math.min(x0, x1);\n const xMax = Math.max(x0, x1);\n const yMin = Math.min(y0, y1);\n const yMax = Math.max(y0, y1);\n radius = Math.min(Math.abs(radius), 0.5 * (xMax - xMin), 0.5 * (yMax - yMin));\n if (radius === 0.0)\n return Loop.createPolygon([Point3d.create(xMin, yMin, z), Point3d.create(xMax, yMin, z), Point3d.create(xMax, yMax, z), Point3d.create(xMin, yMax, z), Point3d.create(xMin, yMin, z)]);\n else {\n const vectorU = Vector3d.create(radius, 0, 0);\n const vectorV = Vector3d.create(0, radius, 0);\n const x0A = xMin + radius;\n const y0A = yMin + radius;\n const x1A = xMax - radius;\n const y1A = yMax - radius;\n const centers = [Point3d.create(x1A, y1A, z), Point3d.create(x0A, y1A, z), Point3d.create(x0A, y0A, z), Point3d.create(x1A, y0A, z)];\n const loop = Loop.create();\n for (let i = 0; i < 4; i++) {\n const center = centers[i];\n const nextCenter = centers[(i + 1) % 4];\n const edgeVector = Vector3d.createStartEnd(center, nextCenter);\n const arc = Arc3d.create(center, vectorU, vectorV, AngleSweep.createStartEndDegrees(0, 90));\n loop.tryAddChild(arc);\n const arcEnd = arc.endPoint();\n if (!edgeVector.isAlmostZero)\n loop.tryAddChild(LineSegment3d.create(arcEnd, arcEnd.plus(edgeVector)));\n vectorU.rotate90CCWXY(vectorU);\n vectorV.rotate90CCWXY(vectorV);\n }\n return loop;\n }\n }\n\n /**\n * If `arcB` is a continuation of `arcA`, extend `arcA` (in place) to include the range of `arcB`\n * * This only succeeds if the two arcs are part of identical complete arcs and end of `arcA` matches the beginning of `arcB`.\n * * \"Reversed\"\n * @param arcA\n * @param arcB\n */\n public static appendToArcInPlace(arcA: Arc3d, arcB: Arc3d, allowReverse: boolean = false): boolean {\n if (arcA.center.isAlmostEqual(arcB.center)) {\n const sweepSign = Geometry.split3WaySign(arcA.sweep.sweepRadians * arcB.sweep.sweepRadians, -1, 0, 1);\n // evaluate derivatives wrt radians (not fraction!), but adjust direction for sweep signs\n const endA = arcA.angleToPointAndDerivative(arcA.sweep.fractionToAngle(1.0));\n if (arcA.sweep.sweepRadians < 0)\n endA.direction.scaleInPlace(-1.0);\n const startB = arcB.angleToPointAndDerivative(arcB.sweep.fractionToAngle(0.0));\n if (arcB.sweep.sweepRadians < 0)\n startB.direction.scaleInPlace(-1.0);\n\n if (endA.isAlmostEqual(startB)) {\n arcA.sweep.setStartEndRadians(arcA.sweep.startRadians, arcA.sweep.startRadians + arcA.sweep.sweepRadians + sweepSign * arcB.sweep.sweepRadians);\n return true;\n }\n // Also ok if negated tangent . ..\n if (allowReverse) {\n startB.direction.scaleInPlace(-1.0);\n if (endA.isAlmostEqual(startB)) {\n arcA.sweep.setStartEndRadians(arcA.sweep.startRadians, arcA.sweep.startRadians + arcA.sweep.sweepRadians - sweepSign * arcB.sweep.sweepRadians);\n return true;\n }\n }\n\n }\n return false;\n }\n\n /**\n * Return a `Path` containing arcs are on the surface of an ellipsoid and pass through a sequence of points.\n * * Each arc passes through the two given endpoints and in the plane containing the true surface normal at given `fractionForIntermediateNormal`\n * @param ellipsoid\n * @param pathPoints\n * @param fractionForIntermediateNormal fractional position for surface normal used to create the section plane.\n */\n public static assembleArcChainOnEllipsoid(ellipsoid: Ellipsoid, pathPoints: GeodesicPathPoint[], fractionForIntermediateNormal: number = 0.5): Path {\n const arcPath = Path.create();\n for (let i = 0; i + 1 < pathPoints.length; i++) {\n const arc = ellipsoid.sectionArcWithIntermediateNormal(\n pathPoints[i].toAngles(),\n fractionForIntermediateNormal,\n pathPoints[i + 1].toAngles());\n arcPath.tryAddChild(arc);\n }\n return arcPath;\n }\n\n private static appendGeometryQueryArray(candidate: GeometryQuery | GeometryQuery[] | undefined, result: GeometryQuery[]) {\n if (candidate instanceof GeometryQuery)\n result.push(candidate);\n else if (Array.isArray(candidate)) {\n for (const p of candidate)\n this.appendGeometryQueryArray(p, result);\n }\n\n }\n\n /**\n * Create solid primitives for pipe segments (e.g. Cone or TorusPipe) around line and arc primitives.\n * @param centerline centerline geometry/\n * @param pipeRadius radius of pipe.\n */\n public static createPipeSegments(centerline: CurvePrimitive | CurveChain, pipeRadius: number): GeometryQuery | GeometryQuery[] | undefined {\n if (centerline instanceof LineSegment3d) {\n return Cone.createAxisPoints(centerline.startPoint(), centerline.endPoint(), pipeRadius, pipeRadius, false);\n } else if (centerline instanceof Arc3d) {\n return TorusPipe.createAlongArc(centerline, pipeRadius, false);\n } else if (centerline instanceof CurvePrimitive) {\n const builder = PolyfaceBuilder.create();\n builder.addMiteredPipes(centerline, pipeRadius);\n return builder.claimPolyface();\n } else if (centerline instanceof CurveChain) {\n const result: GeometryQuery[] = [];\n for (const p of centerline.children) {\n const pipe = this.createPipeSegments(p, pipeRadius);\n this.appendGeometryQueryArray(pipe, result);\n }\n return result;\n }\n return undefined;\n }\n\n /**\n * * Create section arcs for mitered pipe.\n * * At each end of each pipe, the pipe is cut by the plane that bisects the angle between successive pipe centerlines.\n * * The arc definitions are constructed so that lines between corresponding fractional positions on the arcs are\n * axial lines on the pipes.\n * * This means that each arc definition axes (aka vector0 and vector90) are _not_ perpendicular to each other.\n * * Circular or elliptical pipe cross sections can be specified by supplying either a radius, a pair of semi-axis lengths, or a full Arc3d.\n * * For semi-axis length input, x corresponds to an ellipse local axis nominally situated parallel to the xy-plane.\n * * The center of Arc3d input is translated to the centerline start point to act as initial cross section.\n * @param centerline centerline of pipe\n * @param sectionData circle radius, ellipse semi-axis lengths, or full Arc3d\n */\n public static createMiteredPipeSections(centerline: IndexedXYZCollection, sectionData: number | XAndY | Arc3d): Arc3d[] {\n const arcs: Arc3d[] = [];\n if (centerline.length < 2)\n return [];\n\n const vector0 = Vector3d.create();\n const vector90 = Vector3d.create();\n const vectorBC = Vector3d.create();\n const currentCenter = Point3d.create();\n centerline.vectorIndexIndex(0, 1, vectorBC)!;\n centerline.getPoint3dAtUncheckedPointIndex(0, currentCenter);\n\n let initialSection: Arc3d;\n if (sectionData instanceof Arc3d) {\n initialSection = sectionData.clone();\n initialSection.center.setFrom(currentCenter);\n vector0.setFrom(sectionData.vector0);\n vector90.setFrom(sectionData.vector90);\n } else if (typeof sectionData === \"number\" || Point3d.isXAndY(sectionData)) {\n const length0 = (typeof sectionData === \"number\") ? sectionData : sectionData.x;\n const length90 = (typeof sectionData === \"number\") ? sectionData : sectionData.y;\n const baseFrame = Matrix3d.createRigidHeadsUp(vectorBC, AxisOrder.ZXY);\n baseFrame.columnX(vector0).scaleInPlace(length0);\n baseFrame.columnY(vector90).scaleInPlace(length90);\n initialSection = Arc3d.create(currentCenter, vector0, vector90, AngleSweep.create360());\n } else {\n return [];\n }\n arcs.push(initialSection);\n\n const vectorAB = Vector3d.create();\n const bisector = Vector3d.create();\n for (let i = 1; i < centerline.length; i++) {\n vectorAB.setFromVector3d(vectorBC);\n centerline.getPoint3dAtUncheckedPointIndex(i, currentCenter);\n if (i + 1 < centerline.length) {\n centerline.vectorIndexIndex(i, i + 1, vectorBC)!;\n } else {\n vectorBC.setFromVector3d(vectorAB);\n }\n if (vectorAB.normalizeInPlace() && vectorBC.normalizeInPlace()) {\n vectorAB.interpolate(0.5, vectorBC, bisector);\n // On the end ellipse for this pipe section. ..\n // center comes directly from centerline[i]\n // vector0 and vector90 are obtained by sweeping the corresponding vectors of the start ellipse to the split plane.\n moveVectorToPlane(vector0, vectorAB, bisector, vector0);\n moveVectorToPlane(vector90, vectorAB, bisector, vector90);\n arcs.push(Arc3d.create(currentCenter, vector0, vector90, AngleSweep.create360()));\n }\n }\n return arcs;\n }\n\n /**\n * Sweep the initialSection along each segment of the centerLine until it hits the bisector plane at the next vertex.\n * * The caller should place the initialSection on a plane perpendicular to the first edge.\n * * This plane is commonly (but not necessarily) through the start point itself.\n * * If the geometry is not \"on a perpendicular plane\", the output geometry will still be flattened onto the various planes.\n * * In the \"open path\" case (i.e when wrapIfPhysicallyClosed is false or the path does not have matched first and last points)\n * the first/last output plane will be at the start/end of the first/last edge and on a perpendicular plane.\n * * In the \"closed path\" case, the output plane for the first and last point is the bisector of the start and end planes from the \"open path\" case,\n * and the first/last section geometry may be different from `initialSection`.\n * * The centerline path does NOT have to be planar, however twisting effects effects will appear in the various bisector planes.\n * @param centerline sweep path, e.g., as stroked from a smooth centerline curve\n * @param initialSection profile curve to be swept. As noted above, this should be on a plane perpendicular to the first segment of the centerline.\n * @param options options for computation and output\n * @return array of sections, starting with `initialSection` projected along the first edge to the first plane.\n */\n public static createMiteredSweepSections(centerline: IndexedXYZCollection | Point3d[], initialSection: AnyCurve, options: MiteredSweepOptions): SectionSequenceWithPlanes | undefined {\n const sectionData: SectionSequenceWithPlanes = { sections: [], planes: [] };\n const planes = PolylineOps.createBisectorPlanesForDistinctPoints(centerline, options.wrapIfPhysicallyClosed);\n if (planes !== undefined && planes.length > 1) {\n // Projection to target plane, constructing sweep direction from two given planes.\n // If successful, push the target plane and swept section to the output arrays and return the swept section.\n // If unsuccessful, leave the output arrays alone and return the input section.\n const doSweepToPlane = function (edgePlane0: Plane3dByOriginAndUnitNormal, edgePlane1: Plane3dByOriginAndUnitNormal,\n targetPlane: Plane3dByOriginAndUnitNormal,\n section: AnyCurve) {\n const sweepVector = Vector3d.createStartEnd(edgePlane0.getOriginRef(), edgePlane1.getOriginRef());\n const transform = Transform.createFlattenAlongVectorToPlane(sweepVector, targetPlane.getOriginRef(), targetPlane.getNormalRef());\n if (transform === undefined)\n return section;\n const section1 = section.cloneTransformed(transform);\n if (section1 === undefined)\n return section;\n sectionData.planes.push(targetPlane);\n sectionData.sections.push(section1);\n return section1;\n };\n\n let currentSection = doSweepToPlane(planes[0], planes[1], planes[0], initialSection);\n for (let i = 1; i < planes.length; i++) {\n currentSection = doSweepToPlane(planes[i - 1], planes[i], planes[i], currentSection);\n }\n\n if (options.outputSelect) {\n const ruledSweep = RuledSweep.create(sectionData.sections, options.capped ?? false);\n if (ruledSweep) {\n sectionData.ruledSweep = ruledSweep;\n if (MiteredSweepOutputSelect.AlsoMesh === options.outputSelect) {\n const builder = PolyfaceBuilder.create(options.strokeOptions);\n builder.addRuledSweep(ruledSweep);\n sectionData.mesh = builder.claimPolyface();\n }\n }\n }\n return sectionData;\n }\n return undefined;\n }\n\n /**\n * Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep\n * * The vector from start point to center is in the direction of upVector crossed with tangentA.\n * @param pointA start point\n * @param tangentA vector in tangent direction at the start\n * @param radius signed radius.\n * @param upVector optional out-of-plane vector. Defaults to positive Z\n * @param sweep angular range. If single `Angle` is given, start angle is at 0 degrees (the start point).\n *\n */\n public static createArcPointTangentRadius(pointA: Point3d, tangentA: Vector3d, radius: number, upVector?: Vector3d, sweep?: Angle | AngleSweep): Arc3d | undefined {\n if (upVector === undefined)\n upVector = Vector3d.unitZ();\n const vector0 = upVector.unitCrossProduct(tangentA);\n if (vector0 === undefined)\n return undefined;\n const center = pointA.plusScaled(vector0, radius);\n // reverse the A-to-center vector and bring it up to scale ...\n vector0.scaleInPlace(-radius);\n const vector90 = tangentA.scaleToLength(Math.abs(radius))!; // (Cannot fail -- prior unitCrossProduct would have failed first)\n return Arc3d.create(center, vector0, vector90, AngleSweep.create(sweep));\n }\n\n /**\n * Compute 2 spirals (all in XY) for a symmetric line-to-line transition.\n * * First spiral begins at given start point.\n * * first tangent aims at shoulder\n * * outbound spiral joins line from shoulder to target.\n * @param spiralType name of spiral type. THIS MUST BE AN \"Integrated\" SPIRAL TYPE\n * @param startPoint inbound start point.\n * @param shoulder point target point for (both) spiral-to-line tangencies\n * @return array with the computed spirals, or undefined if failure.\n */\n public static createLineSpiralSpiralLine(\n spiralType: IntegratedSpiralTypeName,\n startPoint: Point3d,\n shoulderPoint: Point3d,\n targetPoint: Point3d,\n ): GeometryQuery[] | undefined {\n const vectorAB = Vector3d.createStartEnd(startPoint, shoulderPoint);\n const vectorBC0 = Vector3d.createStartEnd(shoulderPoint, targetPoint);\n const referenceLength = vectorAB.magnitude();\n const radiansAB = Math.atan2(vectorAB.y, vectorAB.x);\n const lineTurnRadians = vectorAB.angleToXY(vectorBC0);\n const spiralTurnRadians = 0.5 * lineTurnRadians.radians;\n const radiansBC = radiansAB + lineTurnRadians.radians;\n const axesA = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, Angle.createRadians(radiansAB));\n const frameA = Transform.createRefs(startPoint.clone(), axesA);\n // We know how much it has to turn, and but not the length or end radius.\n // make a spiral of referenceLength and scale it back to the junction line\n const spiralARefLength = IntegratedSpiral3d.createFrom4OutOf5(spiralType, 0.0, undefined,\n Angle.createRadians(0), Angle.createRadians(spiralTurnRadians), referenceLength, undefined, frameA);\n if (spiralARefLength) {\n const midPlanePerpendicularRadians = radiansAB + spiralTurnRadians;\n const midPlanePerpendicularVector = Vector3d.createPolar(1.0, Angle.createRadians(midPlanePerpendicularRadians));\n const altitudeB = midPlanePerpendicularVector.dotProductStartEnd(startPoint, shoulderPoint);\n const altitudeSpiralEnd = midPlanePerpendicularVector.dotProductStartEnd(startPoint, spiralARefLength.endPoint());\n const scaleFactor = altitudeB / altitudeSpiralEnd;\n const spiralA = IntegratedSpiral3d.createFrom4OutOf5(spiralType, 0.0, undefined,\n Angle.createRadians(0), Angle.createRadians(spiralTurnRadians), referenceLength * scaleFactor, undefined, frameA)!;\n const distanceAB = vectorAB.magnitude();\n const vectorBC = Vector3d.createStartEnd(shoulderPoint, targetPoint);\n vectorBC.scaleToLength(distanceAB, vectorBC);\n const pointC = shoulderPoint.plus(vectorBC);\n const axesC = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, Angle.createRadians(radiansBC + Math.PI));\n const frameC = Transform.createRefs(pointC, axesC);\n const spiralC = IntegratedSpiral3d.createFrom4OutOf5(spiralType,\n 0, -spiralA.radius01.x1, Angle.zero(), undefined, spiralA.curveLength(), Segment1d.create(1, 0), frameC)!;\n return [spiralA, spiralC];\n }\n return undefined;\n }\n\n /**\n * Compute 2 spirals (all in XY) for a symmetric line-to-line transition.\n * * Spiral length is given.\n * * tangency points float on both lines.\n * @param spiralType name of spiral type. THIS MUST BE AN \"Integrated\" SPIRAL TYPE\n * @param pointA inbound start point.\n * @param shoulder point target point for (both) spiral-to-line tangencies\n * @param spiralLength for each part of the spiral pair.\n * @return array with the computed spirals, or undefined if failure.\n */\n public static createLineSpiralSpiralLineWithSpiralLength(\n spiralType: IntegratedSpiralTypeName,\n pointA: Point3d,\n pointB: Point3d,\n pointC: Point3d,\n spiralLength: number,\n ): GeometryQuery[] | undefined {\n const vectorAB = Vector3d.createStartEnd(pointA, pointB);\n const vectorBC = Vector3d.createStartEnd(pointB, pointC);\n const radiansAB = Math.atan2(vectorAB.y, vectorAB.x);\n const lineTurnAngle = vectorAB.angleToXY(vectorBC);\n const spiralTurnRadians = 0.5 * lineTurnAngle.radians;\n const bisectorRadians = 0.5 * (Math.PI - lineTurnAngle.radians);\n const radiansCB = Math.atan2(-vectorBC.y, -vectorBC.x);\n const spiralAB0 = IntegratedSpiral3d.createFrom4OutOf5(spiralType, 0, undefined, Angle.zero(), Angle.createRadians(spiralTurnRadians),\n spiralLength, undefined, Transform.createIdentity());\n if (spiralAB0) {\n const localEndPoint = spiralAB0.fractionToPoint(1);\n const distanceAB = pointA.distance(pointB);\n const distanceCB = pointC.distance(pointB);\n // The spiral eventually has to end on the bisector, at localEndPoint.y height from the inbound line\n // distance from shoulder to projection of that point to point E on the inbound line is\n const distanceBE = localEndPoint.y / Math.tan(bisectorRadians);\n const xFractionAB = Geometry.conditionalDivideFraction(distanceAB - distanceBE - localEndPoint.x, distanceAB);\n const xFractionCB = Geometry.conditionalDivideFraction(distanceCB - distanceBE - localEndPoint.x, distanceCB);\n if (xFractionAB !== undefined && xFractionCB !== undefined) {\n const axesA = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, Angle.createRadians(radiansAB));\n const frameAOrigin = pointA.interpolate(xFractionAB, pointB);\n const frameA = Transform.createRefs(frameAOrigin, axesA);\n const spiralAB = IntegratedSpiral3d.createFrom4OutOf5(spiralType, 0, undefined, Angle.zero(), Angle.createRadians(spiralTurnRadians),\n spiralLength, undefined, frameA)!;\n const axesB = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, Angle.createRadians(radiansCB));\n const frameBOrigin = pointC.interpolate(xFractionCB, pointB);\n const frameB = Transform.createRefs(frameBOrigin, axesB);\n const spiralBC = IntegratedSpiral3d.createFrom4OutOf5(spiralType, 0, undefined, Angle.zero(), Angle.createRadians(-spiralTurnRadians),\n spiralLength, undefined, frameB)!;\n return [spiralAB, spiralBC];\n }\n }\n return undefined;\n }\n\n /**\n * Compute 2 spirals and an arc (all in XY) for a symmetric line-to-line transition.\n * Spiral lengths and arc radius are given. (e.g. from design speed standards.)\n * @param spiralType name of spiral type. THIS MUST BE AN \"Integrated\" SPIRAL TYPE\n * @param pointA inbound start point.\n * @param pointB shoulder (target) point for (both) spiral-to-line tangencies\n * @param lengthA inbound spiral length\n * @param lengthB outbound spiral length\n * @return array with the computed spirals, or undefined if failure.\n */\n public static createLineSpiralArcSpiralLine(\n spiralType: IntegratedSpiralTypeName,\n pointA: Point3d,\n pointB: Point3d,\n pointC: Point3d,\n lengthA: number,\n lengthB: number,\n arcRadius: number,\n ): GeometryQuery[] | undefined {\n const vectorAB = Vector3d.createStartEnd(pointA, pointB); vectorAB.z = 0;\n const vectorCB = Vector3d.createStartEnd(pointC, pointB); vectorCB.z = 0;\n const unitAB = vectorAB.normalize();\n const unitCB = vectorCB.normalize();\n if (unitAB === undefined || unitCB === undefined)\n return undefined;\n const unitPerpAB = unitAB.unitPerpendicularXY();\n const unitPerpCB = unitCB.unitPerpendicularXY();\n const thetaABC = vectorAB.angleToXY(vectorCB);\n const sideA = Geometry.split3WaySign(thetaABC.radians, 1, -1, -1);\n const sideB = - sideA;\n const radiusA = sideA * Math.abs(arcRadius);\n const radiusB = sideB * Math.abs(arcRadius);\n const spiralA = IntegratedSpiral3d.createFrom4OutOf5(spiralType,\n 0, radiusA, Angle.zero(), undefined, lengthA, undefined, Transform.createIdentity())!;\n const spiralB = IntegratedSpiral3d.createFrom4OutOf5(spiralType,\n 0, radiusB, Angle.zero(), undefined, lengthB, undefined, Transform.createIdentity())!;\n const spiralEndA = spiralA.fractionToPointAndUnitTangent(1.0);\n const spiralEndB = spiralB.fractionToPointAndUnitTangent(1.0);\n // From the end of spiral, step away to arc center (and this is in local coordinates of each spiral)\n const sA = spiralEndA.origin.x - radiusA * spiralEndA.direction.y;\n const tA = spiralEndA.origin.y + radiusA * spiralEndA.direction.x;\n\n const sB = spiralEndB.origin.x - radiusB * spiralEndB.direction.y;\n const tB = spiralEndB.origin.y + radiusB * spiralEndB.direction.x;\n\n // Those local coordinates are rotated to unitAB and unitBC ...\n const vectorA = Vector3d.createAdd2Scaled(unitAB, sA, unitPerpAB, tA);\n const vectorB = Vector3d.createAdd2Scaled(unitCB, sB, unitPerpCB, tB);\n const uv = Vector2d.create();\n if (SmallSystem.linearSystem2d(\n unitAB.x, -unitCB.x,\n unitAB.y, -unitCB.y,\n vectorB.x - vectorA.x, vectorB.y - vectorA.y, uv)) {\n const tangencyAB = pointB.plusScaled(unitAB, uv.x);\n const tangencyCB = pointB.plusScaled(unitCB, uv.y);\n const frameA = Transform.createOriginAndMatrixColumns(tangencyAB, unitAB, unitPerpAB, Vector3d.unitZ());\n const frameB = Transform.createOriginAndMatrixColumns(tangencyCB, unitCB, unitPerpCB, Vector3d.unitZ());\n spiralA.tryTransformInPlace(frameA);\n spiralB.tryTransformInPlace(frameB);\n const rayA1 = spiralA.fractionToPointAndUnitTangent(1.0);\n const rayB0 = spiralB.fractionToPointAndUnitTangent(1.0);\n rayB0.direction.scaleInPlace(-1.0);\n const sweep = rayA1.direction.angleToXY(rayB0.direction);\n if (radiusA < 0)\n sweep.setRadians(- sweep.radians);\n const arc = CurveFactory.createArcPointTangentRadius(rayA1.origin, rayA1.direction, radiusA, undefined, sweep)!;\n return [spiralA, arc, spiralB];\n }\n return undefined;\n }\n /**\n * Return the intersection point of 3 planes.\n * @param planeA\n * @param planeB\n * @param planeC\n */\n public static planePlaneIntersectionRay(\n planeA: PlaneAltitudeEvaluator, planeB: PlaneAltitudeEvaluator): Ray3d | undefined {\n const altitudeA = planeA.altitudeXYZ(0, 0, 0);\n const altitudeB = planeB.altitudeXYZ(0, 0, 0);\n const normalAx = planeA.normalX();\n const normalAy = planeA.normalY();\n const normalAz = planeA.normalZ();\n const normalBx = planeB.normalX();\n const normalBy = planeB.normalY();\n const normalBz = planeB.normalZ();\n const normalCx = Geometry.crossProductXYXY(normalAy, normalAz, normalBy, normalBz);\n const normalCy = Geometry.crossProductXYXY(normalAz, normalAx, normalBz, normalBx);\n const normalCz = Geometry.crossProductXYXY(normalAx, normalAy, normalBx, normalBy);\n const rayOrigin = SmallSystem.linearSystem3d(\n normalAx, normalAy, normalAz,\n normalBx, normalBy, normalBz,\n normalCx, normalCy, normalCz,\n -altitudeA, -altitudeB, 0.0);\n if (rayOrigin !== undefined) {\n return Ray3d.createXYZUVW(rayOrigin.x, rayOrigin.y, rayOrigin.z, normalCx, normalCy, normalCz);\n }\n return undefined;\n }\n\n}\n\n/**\n * Starting at vectorR, move parallel to vectorV until perpendicular to planeNormal\n */\nfunction moveVectorToPlane(vectorR: Vector3d, vectorV: Vector3d, planeNormal: Vector3d, result?: Vector3d): Vector3d {\n // find s such that (vectorR + s * vectorV) DOT planeNormal = 0.\n const dotRN = vectorR.dotProduct(planeNormal);\n const dotVN = vectorV.dotProduct(planeNormal);\n const s = Geometry.safeDivideFraction(dotRN, dotVN, 0.0);\n return vectorR.plusScaled(vectorV, -s, result);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CurveFactory.js","sourceRoot":"","sources":["../../../src/curve/CurveFactory.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,6DAA6D;AAE7D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAA0B,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAgB,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,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AgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnF,MAAM,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnF,MAAM,SAAS,GAAG,WAAW,CAAC,cAAc,CAC1C,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAC5B,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAC5B,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAC5B,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAC/B,IAAI,SAAS,KAAK,SAAS,EAAE;YAC3B,OAAO,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;SAChG;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CAEF;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,OAAiB,EAAE,OAAiB,EAAE,WAAqB,EAAE,MAAiB;IACvG,gEAAgE;IAChE,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IACzD,OAAO,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC","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 Curve\r\n */\r\n\r\n// import { Geometry, Angle, AngleSweep } from \"../Geometry\";\r\n\r\nimport { AxisIndex, AxisOrder, Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\nimport { AngleSweep } from \"../geometry3d/AngleSweep\";\r\nimport { Ellipsoid, GeodesicPathPoint } from \"../geometry3d/Ellipsoid\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Vector2d } from \"../geometry3d/Point2dVector2d\";\r\nimport { Point3dArrayCarrier } from \"../geometry3d/Point3dArrayCarrier\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { PolylineOps } from \"../geometry3d/PolylineOps\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Segment1d } from \"../geometry3d/Segment1d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { XAndY } from \"../geometry3d/XYZProps\";\r\nimport { SmallSystem } from \"../numerics/Polynomials\";\r\nimport { IndexedPolyface } from \"../polyface/Polyface\";\r\nimport { PolyfaceBuilder } from \"../polyface/PolyfaceBuilder\";\r\nimport { Cone } from \"../solid/Cone\";\r\nimport { RuledSweep } from \"../solid/RuledSweep\";\r\nimport { TorusPipe } from \"../solid/TorusPipe\";\r\nimport { Arc3d, ArcBlendData } from \"./Arc3d\";\r\nimport { AnyCurve } from \"./CurveChain\";\r\nimport { CurveChain } from \"./CurveCollection\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { LineSegment3d } from \"./LineSegment3d\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { Loop } from \"./Loop\";\r\nimport { Path } from \"./Path\";\r\nimport { IntegratedSpiral3d } from \"./spiral/IntegratedSpiral3d\";\r\nimport { IntegratedSpiralTypeName } from \"./spiral/TransitionSpiral3d\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n// cspell:word CCWXY\r\n\r\n/**\r\n * Interface to carry parallel arrays of planes and sections, and optional geometry assembled from them, as returned by [CurveFactory.createMiteredSweepSections].\r\n * @public\r\n */\r\nexport interface SectionSequenceWithPlanes {\r\n /** the plane of each section */\r\n planes: Plane3dByOriginAndUnitNormal[];\r\n /** section curve projected onto the corresponding plane */\r\n sections: AnyCurve[];\r\n /**\r\n * Optional `RuledSweep` generated from the sections.\r\n * * The `RuledSweep` and sections array refer to the same section objects.\r\n */\r\n ruledSweep?: RuledSweep;\r\n /** Optional mesh generated from the `RuledSweep` generated from the sections. */\r\n mesh?: IndexedPolyface;\r\n}\r\n\r\n/**\r\n * Enumeration of geometric output for [CurveFactory.createMiteredSweepSections].\r\n * @public\r\n */\r\nexport enum MiteredSweepOutputSelect {\r\n /** Output only the parallel arrays of planes and sections. */\r\n Sections = 0,\r\n /** Output planes and sections, as well as the assembled ruled sweep. */\r\n AlsoRuledSweep = 1,\r\n /** Output planes and sections, as well as the assembled ruled sweep and its stroked mesh. */\r\n AlsoMesh = 2,\r\n}\r\n\r\n/**\r\n * Interface bundling options for [CurveFactory.createMiteredSweepSections].\r\n * @public\r\n */\r\nexport interface MiteredSweepOptions {\r\n /** Whether first and last planes are averaged and equated when the centerline is physically closed. Default value is `false`. */\r\n wrapIfPhysicallyClosed?: boolean;\r\n /** Whether to output sections only, or sections plus optional geometry constructed from them. Default value is `MiteredSweepOutputSelect.Sections`. */\r\n outputSelect?: MiteredSweepOutputSelect;\r\n /** How to stroke the ruled sweep if outputting a mesh. If undefined, default stroke options are used. */\r\n strokeOptions?: StrokeOptions;\r\n /** Whether to cap the ruled sweep if outputting a ruled sweep or mesh. Default value is `false`. */\r\n capped?: boolean;\r\n}\r\n\r\n/**\r\n * The `CurveFactory` class contains methods for specialized curve constructions.\r\n * @public\r\n */\r\nexport class CurveFactory {\r\n /** (cautiously) construct and save a line segment between fractional positions. */\r\n private static addPartialSegment(path: Path, allowBackup: boolean, pointA: Point3d | undefined, pointB: Point3d | undefined, fraction0: number, fraction1: number) {\r\n if (allowBackup || (fraction1 > fraction0)) {\r\n if (pointA !== undefined && pointB !== undefined && !Geometry.isAlmostEqualNumber(fraction0, fraction1))\r\n path.tryAddChild(LineSegment3d.create(pointA.interpolate(fraction0, pointB), pointA.interpolate(fraction1, pointB)));\r\n }\r\n }\r\n\r\n /**\r\n * Create a circular arc from start point, tangent at start, and another point (endpoint) on the arc.\r\n * @param pointA\r\n * @param tangentA\r\n * @param pointB\r\n */\r\n public static createArcPointTangentPoint(pointA: Point3d, tangentA: Vector3d, pointB: Point3d): Arc3d | undefined {\r\n const vectorV = Vector3d.createStartEnd(pointA, pointB);\r\n const frame = Matrix3d.createRigidFromColumns(tangentA, vectorV, AxisOrder.XYZ);\r\n if (frame !== undefined) {\r\n const vv = vectorV.dotProduct(vectorV);\r\n const vw = frame.dotColumnY(vectorV);\r\n const alpha = Geometry.conditionalDivideCoordinate(vv, 2 * vw);\r\n if (alpha !== undefined) {\r\n const vector0 = frame.columnY();\r\n vector0.scaleInPlace(-alpha);\r\n const vector90 = frame.columnX();\r\n vector90.scaleInPlace(alpha);\r\n const centerToEnd = vector0.plus(vectorV);\r\n const sweepAngle = vector0.angleTo(centerToEnd);\r\n let sweepRadians = sweepAngle.radians; // That's always positive and less than PI.\r\n if (tangentA.dotProduct(centerToEnd) < 0.0) // ah, sweepRadians is the wrong way\r\n sweepRadians = 2.0 * Math.PI - sweepRadians;\r\n const center = pointA.plusScaled(vector0, -1.0);\r\n return Arc3d.create(center, vector0, vector90, AngleSweep.createStartEndRadians(0.0, sweepRadians));\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Construct a sequence of alternating lines and arcs with the arcs creating tangent transition between consecutive edges.\r\n * * If the radius parameter is a number, that radius is used throughout.\r\n * * If the radius parameter is an array of numbers, `radius[i]` is applied at `point[i]`.\r\n * * Note that since no fillet is constructed at the initial or final point, those entries in `radius[]` are never referenced.\r\n * * A zero radius for any point indicates to leave the as a simple corner.\r\n * @param points point source\r\n * @param radius fillet radius or array of radii indexed to correspond to the points.\r\n * @param allowBackupAlongEdge true to allow edges to be created going \"backwards\" along edges if needed to create the blend.\r\n */\r\n public static createFilletsInLineString(points: LineString3d | IndexedXYZCollection | Point3d[], radius: number | number[], allowBackupAlongEdge: boolean = true): Path | undefined {\r\n if (Array.isArray(points))\r\n return this.createFilletsInLineString(new Point3dArrayCarrier(points), radius, allowBackupAlongEdge);\r\n if (points instanceof LineString3d)\r\n return this.createFilletsInLineString(points.packedPoints, radius, allowBackupAlongEdge);\r\n\r\n const n = points.length;\r\n if (n <= 1)\r\n return undefined;\r\n const pointA = points.getPoint3dAtCheckedPointIndex(0)!;\r\n const pointB = points.getPoint3dAtCheckedPointIndex(1)!;\r\n // remark: n=2 and n=3 cases should fall out from loop logic\r\n const blendArray: ArcBlendData[] = [];\r\n // build one-sided blends at each end . .\r\n blendArray.push({ fraction10: 0.0, fraction12: 0.0, point: pointA.clone() });\r\n\r\n for (let i = 1; i + 1 < n; i++) {\r\n const pointC = points.getPoint3dAtCheckedPointIndex(i + 1)!;\r\n let thisRadius = 0;\r\n if (Array.isArray(radius)) {\r\n if (i < radius.length)\r\n thisRadius = radius[i];\r\n } else if (Number.isFinite(radius))\r\n thisRadius = radius;\r\n\r\n if (thisRadius !== 0.0)\r\n blendArray.push(Arc3d.createFilletArc(pointA, pointB, pointC, thisRadius));\r\n else\r\n blendArray.push({ fraction10: 0.0, fraction12: 0.0, point: pointB.clone() });\r\n pointA.setFromPoint3d(pointB);\r\n pointB.setFromPoint3d(pointC);\r\n }\r\n blendArray.push({ fraction10: 0.0, fraction12: 0.0, point: pointB.clone() });\r\n if (!allowBackupAlongEdge) {\r\n // suppress arcs that have overlap with both neighbors or flood either neighbor ..\r\n for (let i = 1; i + 1 < n; i++) {\r\n const b = blendArray[i];\r\n if (b.fraction10 > 1.0\r\n || b.fraction12 > 1.0\r\n || 1.0 - b.fraction10 < blendArray[i - 1].fraction12\r\n || b.fraction12 > 1.0 - blendArray[i + 1].fraction10) {\r\n b.fraction10 = 0.0;\r\n b.fraction12 = 0.0;\r\n blendArray[i].arc = undefined;\r\n }\r\n }\r\n /* The \"1-b\" logic above prevents this loop from ever doing anything.\r\n // on edge with conflict, suppress the arc with larger fraction\r\n for (let i = 1; i < n; i++) {\r\n const b0 = blendArray[i - 1];\r\n const b1 = blendArray[i];\r\n if (b0.fraction12 > 1 - b1.fraction10) {\r\n const b = b0.fraction12 > b1.fraction12 ? b1 : b0;\r\n b.fraction10 = 0.0;\r\n b.fraction12 = 0.0;\r\n blendArray[i].arc = undefined;\r\n }\r\n } */\r\n }\r\n const path = Path.create();\r\n this.addPartialSegment(path, allowBackupAlongEdge, blendArray[0].point, blendArray[1].point, blendArray[0].fraction12, 1.0 - blendArray[1].fraction10);\r\n // add each path and successor edge ...\r\n for (let i = 1; i + 1 < points.length; i++) {\r\n const b0 = blendArray[i];\r\n const b1 = blendArray[i + 1];\r\n path.tryAddChild(b0.arc);\r\n this.addPartialSegment(path, allowBackupAlongEdge, b0.point, b1.point, b0.fraction12, 1.0 - b1.fraction10);\r\n }\r\n return path;\r\n }\r\n\r\n /** Create a `Loop` with given xy corners and fixed z.\r\n * * The corners always proceed counter clockwise from lower left.\r\n * * If the radius is too large for the outer rectangle size, it is reduced to half of the the smaller x or y size.\r\n */\r\n public static createRectangleXY(x0: number, y0: number, x1: number, y1: number, z: number = 0, filletRadius?: number): Loop {\r\n let radius = Geometry.correctSmallMetricDistance(filletRadius);\r\n const xMin = Math.min(x0, x1);\r\n const xMax = Math.max(x0, x1);\r\n const yMin = Math.min(y0, y1);\r\n const yMax = Math.max(y0, y1);\r\n radius = Math.min(Math.abs(radius), 0.5 * (xMax - xMin), 0.5 * (yMax - yMin));\r\n if (radius === 0.0)\r\n return Loop.createPolygon([Point3d.create(xMin, yMin, z), Point3d.create(xMax, yMin, z), Point3d.create(xMax, yMax, z), Point3d.create(xMin, yMax, z), Point3d.create(xMin, yMin, z)]);\r\n else {\r\n const vectorU = Vector3d.create(radius, 0, 0);\r\n const vectorV = Vector3d.create(0, radius, 0);\r\n const x0A = xMin + radius;\r\n const y0A = yMin + radius;\r\n const x1A = xMax - radius;\r\n const y1A = yMax - radius;\r\n const centers = [Point3d.create(x1A, y1A, z), Point3d.create(x0A, y1A, z), Point3d.create(x0A, y0A, z), Point3d.create(x1A, y0A, z)];\r\n const loop = Loop.create();\r\n for (let i = 0; i < 4; i++) {\r\n const center = centers[i];\r\n const nextCenter = centers[(i + 1) % 4];\r\n const edgeVector = Vector3d.createStartEnd(center, nextCenter);\r\n const arc = Arc3d.create(center, vectorU, vectorV, AngleSweep.createStartEndDegrees(0, 90));\r\n loop.tryAddChild(arc);\r\n const arcEnd = arc.endPoint();\r\n if (!edgeVector.isAlmostZero)\r\n loop.tryAddChild(LineSegment3d.create(arcEnd, arcEnd.plus(edgeVector)));\r\n vectorU.rotate90CCWXY(vectorU);\r\n vectorV.rotate90CCWXY(vectorV);\r\n }\r\n return loop;\r\n }\r\n }\r\n\r\n /**\r\n * If `arcB` is a continuation of `arcA`, extend `arcA` (in place) to include the range of `arcB`\r\n * * This only succeeds if the two arcs are part of identical complete arcs and end of `arcA` matches the beginning of `arcB`.\r\n * * \"Reversed\"\r\n * @param arcA\r\n * @param arcB\r\n */\r\n public static appendToArcInPlace(arcA: Arc3d, arcB: Arc3d, allowReverse: boolean = false): boolean {\r\n if (arcA.center.isAlmostEqual(arcB.center)) {\r\n const sweepSign = Geometry.split3WaySign(arcA.sweep.sweepRadians * arcB.sweep.sweepRadians, -1, 0, 1);\r\n // evaluate derivatives wrt radians (not fraction!), but adjust direction for sweep signs\r\n const endA = arcA.angleToPointAndDerivative(arcA.sweep.fractionToAngle(1.0));\r\n if (arcA.sweep.sweepRadians < 0)\r\n endA.direction.scaleInPlace(-1.0);\r\n const startB = arcB.angleToPointAndDerivative(arcB.sweep.fractionToAngle(0.0));\r\n if (arcB.sweep.sweepRadians < 0)\r\n startB.direction.scaleInPlace(-1.0);\r\n\r\n if (endA.isAlmostEqual(startB)) {\r\n arcA.sweep.setStartEndRadians(arcA.sweep.startRadians, arcA.sweep.startRadians + arcA.sweep.sweepRadians + sweepSign * arcB.sweep.sweepRadians);\r\n return true;\r\n }\r\n // Also ok if negated tangent . ..\r\n if (allowReverse) {\r\n startB.direction.scaleInPlace(-1.0);\r\n if (endA.isAlmostEqual(startB)) {\r\n arcA.sweep.setStartEndRadians(arcA.sweep.startRadians, arcA.sweep.startRadians + arcA.sweep.sweepRadians - sweepSign * arcB.sweep.sweepRadians);\r\n return true;\r\n }\r\n }\r\n\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Return a `Path` containing arcs are on the surface of an ellipsoid and pass through a sequence of points.\r\n * * Each arc passes through the two given endpoints and in the plane containing the true surface normal at given `fractionForIntermediateNormal`\r\n * @param ellipsoid\r\n * @param pathPoints\r\n * @param fractionForIntermediateNormal fractional position for surface normal used to create the section plane.\r\n */\r\n public static assembleArcChainOnEllipsoid(ellipsoid: Ellipsoid, pathPoints: GeodesicPathPoint[], fractionForIntermediateNormal: number = 0.5): Path {\r\n const arcPath = Path.create();\r\n for (let i = 0; i + 1 < pathPoints.length; i++) {\r\n const arc = ellipsoid.sectionArcWithIntermediateNormal(\r\n pathPoints[i].toAngles(),\r\n fractionForIntermediateNormal,\r\n pathPoints[i + 1].toAngles());\r\n arcPath.tryAddChild(arc);\r\n }\r\n return arcPath;\r\n }\r\n\r\n private static appendGeometryQueryArray(candidate: GeometryQuery | GeometryQuery[] | undefined, result: GeometryQuery[]) {\r\n if (candidate instanceof GeometryQuery)\r\n result.push(candidate);\r\n else if (Array.isArray(candidate)) {\r\n for (const p of candidate)\r\n this.appendGeometryQueryArray(p, result);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Create solid primitives for pipe segments (e.g. Cone or TorusPipe) around line and arc primitives.\r\n * @param centerline centerline geometry/\r\n * @param pipeRadius radius of pipe.\r\n */\r\n public static createPipeSegments(centerline: CurvePrimitive | CurveChain, pipeRadius: number): GeometryQuery | GeometryQuery[] | undefined {\r\n if (centerline instanceof LineSegment3d) {\r\n return Cone.createAxisPoints(centerline.startPoint(), centerline.endPoint(), pipeRadius, pipeRadius, false);\r\n } else if (centerline instanceof Arc3d) {\r\n return TorusPipe.createAlongArc(centerline, pipeRadius, false);\r\n } else if (centerline instanceof CurvePrimitive) {\r\n const builder = PolyfaceBuilder.create();\r\n builder.addMiteredPipes(centerline, pipeRadius);\r\n return builder.claimPolyface();\r\n } else if (centerline instanceof CurveChain) {\r\n const result: GeometryQuery[] = [];\r\n for (const p of centerline.children) {\r\n const pipe = this.createPipeSegments(p, pipeRadius);\r\n this.appendGeometryQueryArray(pipe, result);\r\n }\r\n return result;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * * Create section arcs for mitered pipe.\r\n * * At each end of each pipe, the pipe is cut by the plane that bisects the angle between successive pipe centerlines.\r\n * * The arc definitions are constructed so that lines between corresponding fractional positions on the arcs are\r\n * axial lines on the pipes.\r\n * * This means that each arc definition axes (aka vector0 and vector90) are _not_ perpendicular to each other.\r\n * * Circular or elliptical pipe cross sections can be specified by supplying either a radius, a pair of semi-axis lengths, or a full Arc3d.\r\n * * For semi-axis length input, x corresponds to an ellipse local axis nominally situated parallel to the xy-plane.\r\n * * The center of Arc3d input is translated to the centerline start point to act as initial cross section.\r\n * @param centerline centerline of pipe\r\n * @param sectionData circle radius, ellipse semi-axis lengths, or full Arc3d\r\n */\r\n public static createMiteredPipeSections(centerline: IndexedXYZCollection, sectionData: number | XAndY | Arc3d): Arc3d[] {\r\n const arcs: Arc3d[] = [];\r\n if (centerline.length < 2)\r\n return [];\r\n\r\n const vector0 = Vector3d.create();\r\n const vector90 = Vector3d.create();\r\n const vectorBC = Vector3d.create();\r\n const currentCenter = Point3d.create();\r\n centerline.vectorIndexIndex(0, 1, vectorBC)!;\r\n centerline.getPoint3dAtUncheckedPointIndex(0, currentCenter);\r\n\r\n let initialSection: Arc3d;\r\n if (sectionData instanceof Arc3d) {\r\n initialSection = sectionData.clone();\r\n initialSection.center.setFrom(currentCenter);\r\n vector0.setFrom(sectionData.vector0);\r\n vector90.setFrom(sectionData.vector90);\r\n } else if (typeof sectionData === \"number\" || Point3d.isXAndY(sectionData)) {\r\n const length0 = (typeof sectionData === \"number\") ? sectionData : sectionData.x;\r\n const length90 = (typeof sectionData === \"number\") ? sectionData : sectionData.y;\r\n const baseFrame = Matrix3d.createRigidHeadsUp(vectorBC, AxisOrder.ZXY);\r\n baseFrame.columnX(vector0).scaleInPlace(length0);\r\n baseFrame.columnY(vector90).scaleInPlace(length90);\r\n initialSection = Arc3d.create(currentCenter, vector0, vector90, AngleSweep.create360());\r\n } else {\r\n return [];\r\n }\r\n arcs.push(initialSection);\r\n\r\n const vectorAB = Vector3d.create();\r\n const bisector = Vector3d.create();\r\n for (let i = 1; i < centerline.length; i++) {\r\n vectorAB.setFromVector3d(vectorBC);\r\n centerline.getPoint3dAtUncheckedPointIndex(i, currentCenter);\r\n if (i + 1 < centerline.length) {\r\n centerline.vectorIndexIndex(i, i + 1, vectorBC)!;\r\n } else {\r\n vectorBC.setFromVector3d(vectorAB);\r\n }\r\n if (vectorAB.normalizeInPlace() && vectorBC.normalizeInPlace()) {\r\n vectorAB.interpolate(0.5, vectorBC, bisector);\r\n // On the end ellipse for this pipe section. ..\r\n // center comes directly from centerline[i]\r\n // vector0 and vector90 are obtained by sweeping the corresponding vectors of the start ellipse to the split plane.\r\n moveVectorToPlane(vector0, vectorAB, bisector, vector0);\r\n moveVectorToPlane(vector90, vectorAB, bisector, vector90);\r\n arcs.push(Arc3d.create(currentCenter, vector0, vector90, AngleSweep.create360()));\r\n }\r\n }\r\n return arcs;\r\n }\r\n\r\n /**\r\n * Sweep the initialSection along each segment of the centerLine until it hits the bisector plane at the next vertex.\r\n * * The caller should place the initialSection on a plane perpendicular to the first edge.\r\n * * This plane is commonly (but not necessarily) through the start point itself.\r\n * * If the geometry is not \"on a perpendicular plane\", the output geometry will still be flattened onto the various planes.\r\n * * In the \"open path\" case (i.e when wrapIfPhysicallyClosed is false or the path does not have matched first and last points)\r\n * the first/last output plane will be at the start/end of the first/last edge and on a perpendicular plane.\r\n * * In the \"closed path\" case, the output plane for the first and last point is the bisector of the start and end planes from the \"open path\" case,\r\n * and the first/last section geometry may be different from `initialSection`.\r\n * * The centerline path does NOT have to be planar, however twisting effects effects will appear in the various bisector planes.\r\n * @param centerline sweep path, e.g., as stroked from a smooth centerline curve\r\n * @param initialSection profile curve to be swept. As noted above, this should be on a plane perpendicular to the first segment of the centerline.\r\n * @param options options for computation and output\r\n * @return array of sections, starting with `initialSection` projected along the first edge to the first plane.\r\n */\r\n public static createMiteredSweepSections(centerline: IndexedXYZCollection | Point3d[], initialSection: AnyCurve, options: MiteredSweepOptions): SectionSequenceWithPlanes | undefined {\r\n const sectionData: SectionSequenceWithPlanes = { sections: [], planes: [] };\r\n const planes = PolylineOps.createBisectorPlanesForDistinctPoints(centerline, options.wrapIfPhysicallyClosed);\r\n if (planes !== undefined && planes.length > 1) {\r\n // Projection to target plane, constructing sweep direction from two given planes.\r\n // If successful, push the target plane and swept section to the output arrays and return the swept section.\r\n // If unsuccessful, leave the output arrays alone and return the input section.\r\n const doSweepToPlane = function (edgePlane0: Plane3dByOriginAndUnitNormal, edgePlane1: Plane3dByOriginAndUnitNormal,\r\n targetPlane: Plane3dByOriginAndUnitNormal,\r\n section: AnyCurve) {\r\n const sweepVector = Vector3d.createStartEnd(edgePlane0.getOriginRef(), edgePlane1.getOriginRef());\r\n const transform = Transform.createFlattenAlongVectorToPlane(sweepVector, targetPlane.getOriginRef(), targetPlane.getNormalRef());\r\n if (transform === undefined)\r\n return section;\r\n const section1 = section.cloneTransformed(transform);\r\n if (section1 === undefined)\r\n return section;\r\n sectionData.planes.push(targetPlane);\r\n sectionData.sections.push(section1);\r\n return section1;\r\n };\r\n\r\n let currentSection = doSweepToPlane(planes[0], planes[1], planes[0], initialSection);\r\n for (let i = 1; i < planes.length; i++) {\r\n currentSection = doSweepToPlane(planes[i - 1], planes[i], planes[i], currentSection);\r\n }\r\n\r\n if (options.outputSelect) {\r\n const ruledSweep = RuledSweep.create(sectionData.sections, options.capped ?? false);\r\n if (ruledSweep) {\r\n sectionData.ruledSweep = ruledSweep;\r\n if (MiteredSweepOutputSelect.AlsoMesh === options.outputSelect) {\r\n const builder = PolyfaceBuilder.create(options.strokeOptions);\r\n builder.addRuledSweep(ruledSweep);\r\n sectionData.mesh = builder.claimPolyface();\r\n }\r\n }\r\n }\r\n return sectionData;\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep\r\n * * The vector from start point to center is in the direction of upVector crossed with tangentA.\r\n * @param pointA start point\r\n * @param tangentA vector in tangent direction at the start\r\n * @param radius signed radius.\r\n * @param upVector optional out-of-plane vector. Defaults to positive Z\r\n * @param sweep angular range. If single `Angle` is given, start angle is at 0 degrees (the start point).\r\n *\r\n */\r\n public static createArcPointTangentRadius(pointA: Point3d, tangentA: Vector3d, radius: number, upVector?: Vector3d, sweep?: Angle | AngleSweep): Arc3d | undefined {\r\n if (upVector === undefined)\r\n upVector = Vector3d.unitZ();\r\n const vector0 = upVector.unitCrossProduct(tangentA);\r\n if (vector0 === undefined)\r\n return undefined;\r\n const center = pointA.plusScaled(vector0, radius);\r\n // reverse the A-to-center vector and bring it up to scale ...\r\n vector0.scaleInPlace(-radius);\r\n const vector90 = tangentA.scaleToLength(Math.abs(radius))!; // (Cannot fail -- prior unitCrossProduct would have failed first)\r\n return Arc3d.create(center, vector0, vector90, AngleSweep.create(sweep));\r\n }\r\n\r\n /**\r\n * Compute 2 spirals (all in XY) for a symmetric line-to-line transition.\r\n * * First spiral begins at given start point.\r\n * * first tangent aims at shoulder\r\n * * outbound spiral joins line from shoulder to target.\r\n * @param spiralType name of spiral type. THIS MUST BE AN \"Integrated\" SPIRAL TYPE\r\n * @param startPoint inbound start point.\r\n * @param shoulder point target point for (both) spiral-to-line tangencies\r\n * @return array with the computed spirals, or undefined if failure.\r\n */\r\n public static createLineSpiralSpiralLine(\r\n spiralType: IntegratedSpiralTypeName,\r\n startPoint: Point3d,\r\n shoulderPoint: Point3d,\r\n targetPoint: Point3d,\r\n ): GeometryQuery[] | undefined {\r\n const vectorAB = Vector3d.createStartEnd(startPoint, shoulderPoint);\r\n const vectorBC0 = Vector3d.createStartEnd(shoulderPoint, targetPoint);\r\n const referenceLength = vectorAB.magnitude();\r\n const radiansAB = Math.atan2(vectorAB.y, vectorAB.x);\r\n const lineTurnRadians = vectorAB.angleToXY(vectorBC0);\r\n const spiralTurnRadians = 0.5 * lineTurnRadians.radians;\r\n const radiansBC = radiansAB + lineTurnRadians.radians;\r\n const axesA = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, Angle.createRadians(radiansAB));\r\n const frameA = Transform.createRefs(startPoint.clone(), axesA);\r\n // We know how much it has to turn, and but not the length or end radius.\r\n // make a spiral of referenceLength and scale it back to the junction line\r\n const spiralARefLength = IntegratedSpiral3d.createFrom4OutOf5(spiralType, 0.0, undefined,\r\n Angle.createRadians(0), Angle.createRadians(spiralTurnRadians), referenceLength, undefined, frameA);\r\n if (spiralARefLength) {\r\n const midPlanePerpendicularRadians = radiansAB + spiralTurnRadians;\r\n const midPlanePerpendicularVector = Vector3d.createPolar(1.0, Angle.createRadians(midPlanePerpendicularRadians));\r\n const altitudeB = midPlanePerpendicularVector.dotProductStartEnd(startPoint, shoulderPoint);\r\n const altitudeSpiralEnd = midPlanePerpendicularVector.dotProductStartEnd(startPoint, spiralARefLength.endPoint());\r\n const scaleFactor = altitudeB / altitudeSpiralEnd;\r\n const spiralA = IntegratedSpiral3d.createFrom4OutOf5(spiralType, 0.0, undefined,\r\n Angle.createRadians(0), Angle.createRadians(spiralTurnRadians), referenceLength * scaleFactor, undefined, frameA)!;\r\n const distanceAB = vectorAB.magnitude();\r\n const vectorBC = Vector3d.createStartEnd(shoulderPoint, targetPoint);\r\n vectorBC.scaleToLength(distanceAB, vectorBC);\r\n const pointC = shoulderPoint.plus(vectorBC);\r\n const axesC = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, Angle.createRadians(radiansBC + Math.PI));\r\n const frameC = Transform.createRefs(pointC, axesC);\r\n const spiralC = IntegratedSpiral3d.createFrom4OutOf5(spiralType,\r\n 0, -spiralA.radius01.x1, Angle.zero(), undefined, spiralA.curveLength(), Segment1d.create(1, 0), frameC)!;\r\n return [spiralA, spiralC];\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Compute 2 spirals (all in XY) for a symmetric line-to-line transition.\r\n * * Spiral length is given.\r\n * * tangency points float on both lines.\r\n * @param spiralType name of spiral type. THIS MUST BE AN \"Integrated\" SPIRAL TYPE\r\n * @param pointA inbound start point.\r\n * @param shoulder point target point for (both) spiral-to-line tangencies\r\n * @param spiralLength for each part of the spiral pair.\r\n * @return array with the computed spirals, or undefined if failure.\r\n */\r\n public static createLineSpiralSpiralLineWithSpiralLength(\r\n spiralType: IntegratedSpiralTypeName,\r\n pointA: Point3d,\r\n pointB: Point3d,\r\n pointC: Point3d,\r\n spiralLength: number,\r\n ): GeometryQuery[] | undefined {\r\n const vectorAB = Vector3d.createStartEnd(pointA, pointB);\r\n const vectorBC = Vector3d.createStartEnd(pointB, pointC);\r\n const radiansAB = Math.atan2(vectorAB.y, vectorAB.x);\r\n const lineTurnAngle = vectorAB.angleToXY(vectorBC);\r\n const spiralTurnRadians = 0.5 * lineTurnAngle.radians;\r\n const bisectorRadians = 0.5 * (Math.PI - lineTurnAngle.radians);\r\n const radiansCB = Math.atan2(-vectorBC.y, -vectorBC.x);\r\n const spiralAB0 = IntegratedSpiral3d.createFrom4OutOf5(spiralType, 0, undefined, Angle.zero(), Angle.createRadians(spiralTurnRadians),\r\n spiralLength, undefined, Transform.createIdentity());\r\n if (spiralAB0) {\r\n const localEndPoint = spiralAB0.fractionToPoint(1);\r\n const distanceAB = pointA.distance(pointB);\r\n const distanceCB = pointC.distance(pointB);\r\n // The spiral eventually has to end on the bisector, at localEndPoint.y height from the inbound line\r\n // distance from shoulder to projection of that point to point E on the inbound line is\r\n const distanceBE = localEndPoint.y / Math.tan(bisectorRadians);\r\n const xFractionAB = Geometry.conditionalDivideFraction(distanceAB - distanceBE - localEndPoint.x, distanceAB);\r\n const xFractionCB = Geometry.conditionalDivideFraction(distanceCB - distanceBE - localEndPoint.x, distanceCB);\r\n if (xFractionAB !== undefined && xFractionCB !== undefined) {\r\n const axesA = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, Angle.createRadians(radiansAB));\r\n const frameAOrigin = pointA.interpolate(xFractionAB, pointB);\r\n const frameA = Transform.createRefs(frameAOrigin, axesA);\r\n const spiralAB = IntegratedSpiral3d.createFrom4OutOf5(spiralType, 0, undefined, Angle.zero(), Angle.createRadians(spiralTurnRadians),\r\n spiralLength, undefined, frameA)!;\r\n const axesB = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, Angle.createRadians(radiansCB));\r\n const frameBOrigin = pointC.interpolate(xFractionCB, pointB);\r\n const frameB = Transform.createRefs(frameBOrigin, axesB);\r\n const spiralBC = IntegratedSpiral3d.createFrom4OutOf5(spiralType, 0, undefined, Angle.zero(), Angle.createRadians(-spiralTurnRadians),\r\n spiralLength, undefined, frameB)!;\r\n return [spiralAB, spiralBC];\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Compute 2 spirals and an arc (all in XY) for a symmetric line-to-line transition.\r\n * Spiral lengths and arc radius are given. (e.g. from design speed standards.)\r\n * @param spiralType name of spiral type. THIS MUST BE AN \"Integrated\" SPIRAL TYPE\r\n * @param pointA inbound start point.\r\n * @param pointB shoulder (target) point for (both) spiral-to-line tangencies\r\n * @param lengthA inbound spiral length\r\n * @param lengthB outbound spiral length\r\n * @return array with the computed spirals, or undefined if failure.\r\n */\r\n public static createLineSpiralArcSpiralLine(\r\n spiralType: IntegratedSpiralTypeName,\r\n pointA: Point3d,\r\n pointB: Point3d,\r\n pointC: Point3d,\r\n lengthA: number,\r\n lengthB: number,\r\n arcRadius: number,\r\n ): GeometryQuery[] | undefined {\r\n const vectorAB = Vector3d.createStartEnd(pointA, pointB); vectorAB.z = 0;\r\n const vectorCB = Vector3d.createStartEnd(pointC, pointB); vectorCB.z = 0;\r\n const unitAB = vectorAB.normalize();\r\n const unitCB = vectorCB.normalize();\r\n if (unitAB === undefined || unitCB === undefined)\r\n return undefined;\r\n const unitPerpAB = unitAB.unitPerpendicularXY();\r\n const unitPerpCB = unitCB.unitPerpendicularXY();\r\n const thetaABC = vectorAB.angleToXY(vectorCB);\r\n const sideA = Geometry.split3WaySign(thetaABC.radians, 1, -1, -1);\r\n const sideB = - sideA;\r\n const radiusA = sideA * Math.abs(arcRadius);\r\n const radiusB = sideB * Math.abs(arcRadius);\r\n const spiralA = IntegratedSpiral3d.createFrom4OutOf5(spiralType,\r\n 0, radiusA, Angle.zero(), undefined, lengthA, undefined, Transform.createIdentity())!;\r\n const spiralB = IntegratedSpiral3d.createFrom4OutOf5(spiralType,\r\n 0, radiusB, Angle.zero(), undefined, lengthB, undefined, Transform.createIdentity())!;\r\n const spiralEndA = spiralA.fractionToPointAndUnitTangent(1.0);\r\n const spiralEndB = spiralB.fractionToPointAndUnitTangent(1.0);\r\n // From the end of spiral, step away to arc center (and this is in local coordinates of each spiral)\r\n const sA = spiralEndA.origin.x - radiusA * spiralEndA.direction.y;\r\n const tA = spiralEndA.origin.y + radiusA * spiralEndA.direction.x;\r\n\r\n const sB = spiralEndB.origin.x - radiusB * spiralEndB.direction.y;\r\n const tB = spiralEndB.origin.y + radiusB * spiralEndB.direction.x;\r\n\r\n // Those local coordinates are rotated to unitAB and unitBC ...\r\n const vectorA = Vector3d.createAdd2Scaled(unitAB, sA, unitPerpAB, tA);\r\n const vectorB = Vector3d.createAdd2Scaled(unitCB, sB, unitPerpCB, tB);\r\n const uv = Vector2d.create();\r\n if (SmallSystem.linearSystem2d(\r\n unitAB.x, -unitCB.x,\r\n unitAB.y, -unitCB.y,\r\n vectorB.x - vectorA.x, vectorB.y - vectorA.y, uv)) {\r\n const tangencyAB = pointB.plusScaled(unitAB, uv.x);\r\n const tangencyCB = pointB.plusScaled(unitCB, uv.y);\r\n const frameA = Transform.createOriginAndMatrixColumns(tangencyAB, unitAB, unitPerpAB, Vector3d.unitZ());\r\n const frameB = Transform.createOriginAndMatrixColumns(tangencyCB, unitCB, unitPerpCB, Vector3d.unitZ());\r\n spiralA.tryTransformInPlace(frameA);\r\n spiralB.tryTransformInPlace(frameB);\r\n const rayA1 = spiralA.fractionToPointAndUnitTangent(1.0);\r\n const rayB0 = spiralB.fractionToPointAndUnitTangent(1.0);\r\n rayB0.direction.scaleInPlace(-1.0);\r\n const sweep = rayA1.direction.angleToXY(rayB0.direction);\r\n if (radiusA < 0)\r\n sweep.setRadians(- sweep.radians);\r\n const arc = CurveFactory.createArcPointTangentRadius(rayA1.origin, rayA1.direction, radiusA, undefined, sweep)!;\r\n return [spiralA, arc, spiralB];\r\n }\r\n return undefined;\r\n }\r\n /**\r\n * Return the intersection point of 3 planes.\r\n * @param planeA\r\n * @param planeB\r\n * @param planeC\r\n */\r\n public static planePlaneIntersectionRay(\r\n planeA: PlaneAltitudeEvaluator, planeB: PlaneAltitudeEvaluator): Ray3d | undefined {\r\n const altitudeA = planeA.altitudeXYZ(0, 0, 0);\r\n const altitudeB = planeB.altitudeXYZ(0, 0, 0);\r\n const normalAx = planeA.normalX();\r\n const normalAy = planeA.normalY();\r\n const normalAz = planeA.normalZ();\r\n const normalBx = planeB.normalX();\r\n const normalBy = planeB.normalY();\r\n const normalBz = planeB.normalZ();\r\n const normalCx = Geometry.crossProductXYXY(normalAy, normalAz, normalBy, normalBz);\r\n const normalCy = Geometry.crossProductXYXY(normalAz, normalAx, normalBz, normalBx);\r\n const normalCz = Geometry.crossProductXYXY(normalAx, normalAy, normalBx, normalBy);\r\n const rayOrigin = SmallSystem.linearSystem3d(\r\n normalAx, normalAy, normalAz,\r\n normalBx, normalBy, normalBz,\r\n normalCx, normalCy, normalCz,\r\n -altitudeA, -altitudeB, 0.0);\r\n if (rayOrigin !== undefined) {\r\n return Ray3d.createXYZUVW(rayOrigin.x, rayOrigin.y, rayOrigin.z, normalCx, normalCy, normalCz);\r\n }\r\n return undefined;\r\n }\r\n\r\n}\r\n\r\n/**\r\n * Starting at vectorR, move parallel to vectorV until perpendicular to planeNormal\r\n */\r\nfunction moveVectorToPlane(vectorR: Vector3d, vectorV: Vector3d, planeNormal: Vector3d, result?: Vector3d): Vector3d {\r\n // find s such that (vectorR + s * vectorV) DOT planeNormal = 0.\r\n const dotRN = vectorR.dotProduct(planeNormal);\r\n const dotVN = vectorV.dotProduct(planeNormal);\r\n const s = Geometry.safeDivideFraction(dotRN, dotVN, 0.0);\r\n return vectorR.plusScaled(vectorV, -s, result);\r\n}\r\n"]}
|