@itwin/core-geometry 5.8.0-dev.2 → 5.8.0-dev.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -1
- package/lib/cjs/Constant.js.map +1 -1
- package/lib/cjs/Geometry.d.ts +24 -14
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js +34 -14
- 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.d.ts +1 -0
- package/lib/cjs/core-geometry.d.ts.map +1 -1
- package/lib/cjs/core-geometry.js +1 -0
- package/lib/cjs/core-geometry.js.map +1 -1
- package/lib/cjs/curve/Arc3d.d.ts +4 -0
- package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
- package/lib/cjs/curve/Arc3d.js +14 -0
- package/lib/cjs/curve/Arc3d.js.map +1 -1
- package/lib/cjs/curve/ConstrainedCurve2d.d.ts +149 -0
- package/lib/cjs/curve/ConstrainedCurve2d.d.ts.map +1 -0
- package/lib/cjs/curve/ConstrainedCurve2d.js +317 -0
- package/lib/cjs/curve/ConstrainedCurve2d.js.map +1 -0
- package/lib/cjs/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/cjs/curve/CoordinateXYZ.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurveCurve.js.map +1 -1
- package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
- package/lib/cjs/curve/CurveFactory.d.ts.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.d.ts +2 -2
- package/lib/cjs/curve/CurvePrimitive.js +2 -2
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/CurveProcessor.js.map +1 -1
- package/lib/cjs/curve/CurveTypes.js.map +1 -1
- package/lib/cjs/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/cjs/curve/GeometryQuery.js.map +1 -1
- package/lib/cjs/curve/LineSegment3d.js.map +1 -1
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/OffsetOptions.js.map +1 -1
- package/lib/cjs/curve/ParityRegion.js.map +1 -1
- package/lib/cjs/curve/Path.js.map +1 -1
- package/lib/cjs/curve/PointString3d.js.map +1 -1
- package/lib/cjs/curve/ProxyCurve.js.map +1 -1
- package/lib/cjs/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/cjs/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
- package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/cjs/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
- package/lib/cjs/curve/RegionOps.js.map +1 -1
- package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/cjs/curve/StrokeOptions.js.map +1 -1
- package/lib/cjs/curve/UnionRegion.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.d.ts +26 -0
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.js +78 -0
- package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
- package/lib/cjs/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts +152 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js +843 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.d.ts +97 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.js +300 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts +105 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.js +141 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts +27 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js +152 -0
- package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts +81 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.js +170 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts +96 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.js +187 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts +91 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js +197 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts +129 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.js +208 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.js.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts +87 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.js +193 -0
- package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.js.map +1 -0
- package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/cjs/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/cjs/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/cjs/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
- package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/cjs/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/cjs/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/cjs/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3d.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/cjs/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +7 -0
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +9 -0
- 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.d.ts.map +1 -1
- package/lib/cjs/numerics/Polynomials.js +8 -6
- package/lib/cjs/numerics/Polynomials.js.map +1 -1
- package/lib/cjs/numerics/Quadrature.js.map +1 -1
- package/lib/cjs/numerics/Range1dArray.js.map +1 -1
- package/lib/cjs/numerics/SmallSystem.js.map +1 -1
- package/lib/cjs/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/cjs/numerics/UnionFind.js.map +1 -1
- package/lib/cjs/numerics/UsageSums.js.map +1 -1
- package/lib/cjs/polyface/AuxData.js.map +1 -1
- package/lib/cjs/polyface/BoxTopology.js.map +1 -1
- package/lib/cjs/polyface/FacetFaceData.js.map +1 -1
- package/lib/cjs/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/cjs/polyface/FacetOrientation.js.map +1 -1
- package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/cjs/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/cjs/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/cjs/polyface/Polyface.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/cjs/polyface/RangeLengthData.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/cjs/polyface/TaggedNumericData.js.map +1 -1
- package/lib/cjs/polyface/TriangleCandidate.js.map +1 -1
- package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/cjs/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/cjs/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/cjs/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
- package/lib/cjs/serialization/BGFBReader.js.map +1 -1
- package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
- package/lib/cjs/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/cjs/serialization/DeepCompare.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
- package/lib/cjs/solid/Box.js.map +1 -1
- package/lib/cjs/solid/Cone.js.map +1 -1
- package/lib/cjs/solid/LinearSweep.js.map +1 -1
- package/lib/cjs/solid/RotationalSweep.js.map +1 -1
- package/lib/cjs/solid/RuledSweep.js.map +1 -1
- package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/SweepContour.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/cjs/topology/ChainMerge.js.map +1 -1
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.d.ts.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +3 -1
- package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/cjs/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/cjs/topology/MaskManager.js.map +1 -1
- package/lib/cjs/topology/Merging.js.map +1 -1
- package/lib/cjs/topology/RegularizeFace.js.map +1 -1
- package/lib/cjs/topology/SignedDataSummary.js.map +1 -1
- package/lib/cjs/topology/SpaceTriangulation.js.map +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/cjs/topology/Voronoi.js.map +1 -1
- package/lib/cjs/topology/XYParitySearchContext.js.map +1 -1
- package/lib/esm/Constant.js.map +1 -1
- package/lib/esm/Geometry.d.ts +24 -14
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js +34 -14
- 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.d.ts +1 -0
- package/lib/esm/core-geometry.d.ts.map +1 -1
- package/lib/esm/core-geometry.js +1 -0
- package/lib/esm/core-geometry.js.map +1 -1
- package/lib/esm/curve/Arc3d.d.ts +4 -0
- package/lib/esm/curve/Arc3d.d.ts.map +1 -1
- package/lib/esm/curve/Arc3d.js +14 -0
- package/lib/esm/curve/Arc3d.js.map +1 -1
- package/lib/esm/curve/ConstrainedCurve2d.d.ts +149 -0
- package/lib/esm/curve/ConstrainedCurve2d.d.ts.map +1 -0
- package/lib/esm/curve/ConstrainedCurve2d.js +313 -0
- package/lib/esm/curve/ConstrainedCurve2d.js.map +1 -0
- package/lib/esm/curve/ConstructCurveBetweenCurves.js.map +1 -1
- package/lib/esm/curve/CoordinateXYZ.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurveCurve.js.map +1 -1
- package/lib/esm/curve/CurveExtendMode.js.map +1 -1
- package/lib/esm/curve/CurveFactory.d.ts.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.d.ts +2 -2
- package/lib/esm/curve/CurvePrimitive.js +2 -2
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/CurveProcessor.js.map +1 -1
- package/lib/esm/curve/CurveTypes.js.map +1 -1
- package/lib/esm/curve/CurveWireMomentsXYZ.js.map +1 -1
- package/lib/esm/curve/GeometryQuery.js.map +1 -1
- package/lib/esm/curve/LineSegment3d.js.map +1 -1
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/OffsetOptions.js.map +1 -1
- package/lib/esm/curve/ParityRegion.js.map +1 -1
- package/lib/esm/curve/Path.js.map +1 -1
- package/lib/esm/curve/PointString3d.js.map +1 -1
- package/lib/esm/curve/ProxyCurve.js.map +1 -1
- package/lib/esm/curve/Query/ConsolidateAdjacentPrimitivesContext.js.map +1 -1
- package/lib/esm/curve/Query/CurveSplitContext.js.map +1 -1
- package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
- package/lib/esm/curve/Query/InOutTests.js.map +1 -1
- package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
- package/lib/esm/curve/Query/StrokeCountMap.js.map +1 -1
- package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
- package/lib/esm/curve/RegionOps.js.map +1 -1
- package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
- package/lib/esm/curve/StrokeOptions.js.map +1 -1
- package/lib/esm/curve/UnionRegion.js.map +1 -1
- package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/ChainCollectorContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneCurvesContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CloneWithExpandedLineStrings.js.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/CountLinearPartsSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveOffsetXYHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/GapSearchContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/MultiChainCollector.js.map +1 -1
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/PlaneAltitudeRangeContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.d.ts +26 -0
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.js +74 -0
- package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/SumLengthsContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/TransferWithSplitArcs.js.map +1 -1
- package/lib/esm/curve/internalContexts/TransformInPlaceContext.js.map +1 -1
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts +152 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js +839 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.d.ts +97 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.js +295 -0
- package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts +105 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.js +135 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts +27 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js +148 -0
- package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts +81 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.js +166 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts +96 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.js +183 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts +91 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js +193 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts +129 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.js +204 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.js.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts +87 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.js +189 -0
- package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.js.map +1 -0
- package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
- package/lib/esm/curve/spiral/CubicEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectHalfCosineSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/MXCubicAlongArcSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
- package/lib/esm/curve/spiral/PolishCubicSpiralEvaluator.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
- package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
- package/lib/esm/curve/spiral/XYCurveEvaluator.js.map +1 -1
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
- package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
- package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
- package/lib/esm/geometry3d/CoincidentGeometryOps.js.map +1 -1
- package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
- package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
- package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
- package/lib/esm/geometry3d/GeometryHandler.js.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/geometry3d/IndexedCollectionInterval.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYCollection.js.map +1 -1
- package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
- package/lib/esm/geometry3d/LongitudeLatitudeAltitude.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/OrderedRotationAngles.js.map +1 -1
- package/lib/esm/geometry3d/Plane3d.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
- package/lib/esm/geometry3d/Plane3dByOriginAndVectors.js.map +1 -1
- package/lib/esm/geometry3d/Point2dArrayCarrier.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +7 -0
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +9 -0
- 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.d.ts.map +1 -1
- package/lib/esm/numerics/Polynomials.js +8 -6
- package/lib/esm/numerics/Polynomials.js.map +1 -1
- package/lib/esm/numerics/Quadrature.js.map +1 -1
- package/lib/esm/numerics/Range1dArray.js.map +1 -1
- package/lib/esm/numerics/SmallSystem.js.map +1 -1
- package/lib/esm/numerics/TriDiagonalSystem.js.map +1 -1
- package/lib/esm/numerics/UnionFind.js.map +1 -1
- package/lib/esm/numerics/UsageSums.js.map +1 -1
- package/lib/esm/polyface/AuxData.js.map +1 -1
- package/lib/esm/polyface/BoxTopology.js.map +1 -1
- package/lib/esm/polyface/FacetFaceData.js.map +1 -1
- package/lib/esm/polyface/FacetLocationDetail.js.map +1 -1
- package/lib/esm/polyface/FacetOrientation.js.map +1 -1
- package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
- package/lib/esm/polyface/IndexedEdgeMatcher.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceVisitor.js.map +1 -1
- package/lib/esm/polyface/IndexedPolyfaceWalker.js.map +1 -1
- package/lib/esm/polyface/Polyface.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
- package/lib/esm/polyface/PolyfaceData.js.map +1 -1
- package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
- package/lib/esm/polyface/RangeLengthData.js.map +1 -1
- package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/MinimumValueTester.js.map +1 -1
- package/lib/esm/polyface/RangeTree/Point3dArrayRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/PolyfaceRangeTreeContext.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
- package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
- package/lib/esm/polyface/TaggedNumericData.js.map +1 -1
- package/lib/esm/polyface/TriangleCandidate.js.map +1 -1
- package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSet.js.map +1 -1
- package/lib/esm/polyface/multiclip/GriddedRaggedRange2dSetWithOverflow.js.map +1 -1
- package/lib/esm/polyface/multiclip/LinearSearchRange2dArray.js.map +1 -1
- package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/Range2dSearchInterface.js.map +1 -1
- package/lib/esm/polyface/multiclip/RangeSearch.js.map +1 -1
- package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
- package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
- package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
- package/lib/esm/serialization/BGFBReader.js.map +1 -1
- package/lib/esm/serialization/BGFBWriter.js.map +1 -1
- package/lib/esm/serialization/BentleyGeometryFlatBuffer.js.map +1 -1
- package/lib/esm/serialization/DeepCompare.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
- package/lib/esm/solid/Box.js.map +1 -1
- package/lib/esm/solid/Cone.js.map +1 -1
- package/lib/esm/solid/LinearSweep.js.map +1 -1
- package/lib/esm/solid/RotationalSweep.js.map +1 -1
- package/lib/esm/solid/RuledSweep.js.map +1 -1
- package/lib/esm/solid/SolidPrimitive.js.map +1 -1
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/SweepContour.js.map +1 -1
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/lib/esm/topology/ChainMerge.js.map +1 -1
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphFromIndexedLoopsContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.d.ts.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js +3 -1
- package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
- package/lib/esm/topology/HalfEdgeGraphValidation.js.map +1 -1
- package/lib/esm/topology/HalfEdgeMarkSet.js.map +1 -1
- package/lib/esm/topology/HalfEdgeNodeXYZUV.js.map +1 -1
- package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
- package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
- package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
- package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
- package/lib/esm/topology/MaskManager.js.map +1 -1
- package/lib/esm/topology/Merging.js.map +1 -1
- package/lib/esm/topology/RegularizeFace.js.map +1 -1
- package/lib/esm/topology/SignedDataSummary.js.map +1 -1
- package/lib/esm/topology/SpaceTriangulation.js.map +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/lib/esm/topology/Voronoi.js.map +1 -1
- package/lib/esm/topology/XYParitySearchContext.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module CartesianGeometry
|
|
3
|
+
*/
|
|
4
|
+
import { Point2d, Vector2d } from "../../../geometry3d/Point2dVector2d";
|
|
5
|
+
import { XAndY } from "../../../geometry3d/XYZProps";
|
|
6
|
+
import { ImplicitCurve2d } from "./ImplicitCurve2d";
|
|
7
|
+
/**
|
|
8
|
+
* Internal class for parabola in the xy plane, with an angular parameterization.
|
|
9
|
+
* * In uv local coordinates
|
|
10
|
+
* * Let c = cos(theta) and s = sin(theta)
|
|
11
|
+
* * The parabola is (u,v) = (s/(1+c), (1-c)/(1+c))
|
|
12
|
+
* * The uv derivative is (u',v') = (1/(c+1), 2s/(c+1))
|
|
13
|
+
* * Basic trig identities confirm that u^2 = v as expected for a parabola.
|
|
14
|
+
* * This traces the parabola in a full theta range (-2PI < theta < 2PI).
|
|
15
|
+
* * The angle theta = 2PI is the singular point.
|
|
16
|
+
* * In XY coordinates the mapped parabola is
|
|
17
|
+
* * x = A + Uu + Vv
|
|
18
|
+
* * X = A + U*s/(1+c) + V*(1-2*c/(1+c))
|
|
19
|
+
* * X' = U * (1/(c+1) + V*2s/(c+1))
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare class UnboundedParabola2d extends ImplicitCurve2d {
|
|
23
|
+
/** The Cartesian coordinates of any center on the line. */
|
|
24
|
+
center: Point2d;
|
|
25
|
+
/** The local u axis direction. */
|
|
26
|
+
vectorU: Vector2d;
|
|
27
|
+
/** The local v axis direction. */
|
|
28
|
+
vectorV: Vector2d;
|
|
29
|
+
private constructor();
|
|
30
|
+
/** Return a clone of this Parabola. */
|
|
31
|
+
clone(): UnboundedParabola2d;
|
|
32
|
+
/**
|
|
33
|
+
* Create an UnboundedParabola2d from an xy object and a radius.
|
|
34
|
+
* @param center xy coordinates of center
|
|
35
|
+
* @param vectorU vector from center to to theta=0 vertex, i.e., along axis on the "inside" of the curve
|
|
36
|
+
* @param vectorV vector from center to the transverse direction.
|
|
37
|
+
*/
|
|
38
|
+
static createCenterAndAxisVectors(center: XAndY, vectorU: XAndY, vectorV: XAndY): UnboundedParabola2d;
|
|
39
|
+
/**
|
|
40
|
+
* Return the local (uv) coordinate of a global point.
|
|
41
|
+
* @param spacePoint point for coordinate conversion
|
|
42
|
+
*/
|
|
43
|
+
globalToLocal(spacePoint: XAndY): Vector2d | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Returns xy coordinate on the Parabola.
|
|
46
|
+
* @param radians parametric angle on the Parabola
|
|
47
|
+
*/
|
|
48
|
+
radiansToPoint2d(radians: number): Point2d | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the tangent at given radians value.
|
|
51
|
+
* @param radians parametric angle on the parabola
|
|
52
|
+
*/
|
|
53
|
+
radiansToTangentVector2d(radians: number): Vector2d | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Return the implicit function value at xy.
|
|
56
|
+
* @param xy space point
|
|
57
|
+
* @returns v - u*u
|
|
58
|
+
*/
|
|
59
|
+
functionValue(xy: XAndY): number;
|
|
60
|
+
/**
|
|
61
|
+
* Evaluate the (global coordinates) gradient (steepest descent) of the implicit function.
|
|
62
|
+
* @param xy space point
|
|
63
|
+
* @returns gradient vector for the implicit function
|
|
64
|
+
*/
|
|
65
|
+
gradient(xy: XAndY): Vector2d;
|
|
66
|
+
/**
|
|
67
|
+
* Solve for parametric radians at Parabola points which are perpendicular projections of spacePoint.
|
|
68
|
+
* * Up to 4 solutions are possible.
|
|
69
|
+
* @param spacePoint the space point.
|
|
70
|
+
* @handler the handler to receive all the points on the curve and radians where perpendicular happens.
|
|
71
|
+
*/
|
|
72
|
+
emitPerpendiculars(spacePoint: Point2d, handler: (curvePoint: Point2d, radians: number | undefined) => any): void;
|
|
73
|
+
/** Returns true if the circle radius is near zero. */
|
|
74
|
+
isDegenerate(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Test if the centers and axes of the vectors are close
|
|
77
|
+
* @param other second Parabola
|
|
78
|
+
* @param negatedAndExchangedAxesAreEqual
|
|
79
|
+
* * if false, a strong equality test requiring both U and V vectors to match
|
|
80
|
+
* * This strong test is a test for identical parameterization
|
|
81
|
+
* * if true, a weak equality test that allows U and V to be negated and or exchanged.
|
|
82
|
+
* * The weak test is a test for the same implicit set
|
|
83
|
+
* @returns true if identical to tolerance.
|
|
84
|
+
*/
|
|
85
|
+
isSameParabola(other: UnboundedParabola2d, negatedAndExchangedAxesAreEqual?: boolean): boolean;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=UnboundedParabola2d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnboundedParabola2d.d.ts","sourceRoot":"","sources":["../../../../../src/curve/internalContexts/geometry2d/UnboundedParabola2d.ts"],"names":[],"mappings":"AAIA;;GAEG;AAKH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,mBAAoB,SAAQ,eAAe;IACtD,2DAA2D;IACpD,MAAM,EAAE,OAAO,CAAC;IACvB,kCAAkC;IAC3B,OAAO,EAAE,QAAQ,CAAC;IACzB,kCAAkC;IAC3B,OAAO,EAAE,QAAQ,CAAC;IAEzB,OAAO;IAMP,uCAAuC;IAChC,KAAK,IAAI,mBAAmB;IAInC;;;;;OAKG;WACW,0BAA0B,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,GAAG,mBAAmB;IAM5G;;;OAGG;IACI,aAAa,CAAC,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS;IAU7D;;;OAGG;IACa,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAQtE;;;OAGG;IACa,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAU/E;;;;OAIG;IACa,aAAa,CAAC,EAAE,EAAE,KAAK,GAAG,MAAM;IAMhD;;;;OAIG;IACa,QAAQ,CAAC,EAAE,EAAE,KAAK,GAAG,QAAQ;IAY7C;;;;;OAKG;IACa,kBAAkB,CAChC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,GAAG,GACtF,IAAI;IA2BP,sDAAsD;IAEtC,YAAY,IAAI,OAAO;IAGvC;;;;;;;;;OASG;IACI,cAAc,CAAC,KAAK,EAAE,mBAAmB,EAAE,+BAA+B,GAAE,OAAe,GAAG,OAAO;CAwB7G"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module CartesianGeometry
|
|
7
|
+
*/
|
|
8
|
+
import { SmallSystem } from "../../../numerics/SmallSystem";
|
|
9
|
+
import { Geometry } from "../../../Geometry";
|
|
10
|
+
import { Point2d, Vector2d } from "../../../geometry3d/Point2dVector2d";
|
|
11
|
+
import { TrigPolynomial } from "../../../numerics/Polynomials";
|
|
12
|
+
import { ImplicitCurve2d } from "./ImplicitCurve2d";
|
|
13
|
+
/**
|
|
14
|
+
* Internal class for parabola in the xy plane, with an angular parameterization.
|
|
15
|
+
* * In uv local coordinates
|
|
16
|
+
* * Let c = cos(theta) and s = sin(theta)
|
|
17
|
+
* * The parabola is (u,v) = (s/(1+c), (1-c)/(1+c))
|
|
18
|
+
* * The uv derivative is (u',v') = (1/(c+1), 2s/(c+1))
|
|
19
|
+
* * Basic trig identities confirm that u^2 = v as expected for a parabola.
|
|
20
|
+
* * This traces the parabola in a full theta range (-2PI < theta < 2PI).
|
|
21
|
+
* * The angle theta = 2PI is the singular point.
|
|
22
|
+
* * In XY coordinates the mapped parabola is
|
|
23
|
+
* * x = A + Uu + Vv
|
|
24
|
+
* * X = A + U*s/(1+c) + V*(1-2*c/(1+c))
|
|
25
|
+
* * X' = U * (1/(c+1) + V*2s/(c+1))
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export class UnboundedParabola2d extends ImplicitCurve2d {
|
|
29
|
+
/** The Cartesian coordinates of any center on the line. */
|
|
30
|
+
center;
|
|
31
|
+
/** The local u axis direction. */
|
|
32
|
+
vectorU;
|
|
33
|
+
/** The local v axis direction. */
|
|
34
|
+
vectorV;
|
|
35
|
+
/* Constructor - CAPTURE given center and axis vectors */
|
|
36
|
+
constructor(center, vectorU, vectorV) {
|
|
37
|
+
super();
|
|
38
|
+
this.center = center;
|
|
39
|
+
this.vectorU = vectorU;
|
|
40
|
+
this.vectorV = vectorV;
|
|
41
|
+
}
|
|
42
|
+
/** Return a clone of this Parabola. */
|
|
43
|
+
clone() {
|
|
44
|
+
// the create method clones the inputs
|
|
45
|
+
return UnboundedParabola2d.createCenterAndAxisVectors(this.center, this.vectorU, this.vectorV);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create an UnboundedParabola2d from an xy object and a radius.
|
|
49
|
+
* @param center xy coordinates of center
|
|
50
|
+
* @param vectorU vector from center to to theta=0 vertex, i.e., along axis on the "inside" of the curve
|
|
51
|
+
* @param vectorV vector from center to the transverse direction.
|
|
52
|
+
*/
|
|
53
|
+
static createCenterAndAxisVectors(center, vectorU, vectorV) {
|
|
54
|
+
return new UnboundedParabola2d(Point2d.create(center.x, center.y), Vector2d.create(vectorU.x, vectorU.y), Vector2d.create(vectorV.x, vectorV.y));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Return the local (uv) coordinate of a global point.
|
|
58
|
+
* @param spacePoint point for coordinate conversion
|
|
59
|
+
*/
|
|
60
|
+
globalToLocal(spacePoint) {
|
|
61
|
+
const result = Vector2d.create();
|
|
62
|
+
if (SmallSystem.linearSystem2d(this.vectorU.x, this.vectorV.x, this.vectorU.y, this.vectorV.y, spacePoint.x - this.center.x, spacePoint.y - this.center.y, result))
|
|
63
|
+
return result;
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Returns xy coordinate on the Parabola.
|
|
68
|
+
* @param radians parametric angle on the Parabola
|
|
69
|
+
*/
|
|
70
|
+
radiansToPoint2d(radians) {
|
|
71
|
+
const c = Math.cos(radians);
|
|
72
|
+
const s = Math.sin(radians);
|
|
73
|
+
const q = 1 + c;
|
|
74
|
+
if (Geometry.isSmallMetricDistance(Math.abs(q)))
|
|
75
|
+
return undefined;
|
|
76
|
+
return this.center.plus2Scaled(this.vectorU, s / q, this.vectorV, (1 - c) / q);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns the tangent at given radians value.
|
|
80
|
+
* @param radians parametric angle on the parabola
|
|
81
|
+
*/
|
|
82
|
+
radiansToTangentVector2d(radians) {
|
|
83
|
+
const c = Math.cos(radians);
|
|
84
|
+
const s = Math.sin(radians);
|
|
85
|
+
const q = 1 + c;
|
|
86
|
+
const u = Geometry.conditionalDivideCoordinate(1, q);
|
|
87
|
+
const v = Geometry.conditionalDivideCoordinate(2 * s, q * q);
|
|
88
|
+
if (u === undefined || v === undefined)
|
|
89
|
+
return undefined;
|
|
90
|
+
return Vector2d.createAdd2Scaled(this.vectorU, u, this.vectorV, v);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Return the implicit function value at xy.
|
|
94
|
+
* @param xy space point
|
|
95
|
+
* @returns v - u*u
|
|
96
|
+
*/
|
|
97
|
+
functionValue(xy) {
|
|
98
|
+
const vectorUV = this.globalToLocal(xy);
|
|
99
|
+
if (vectorUV === undefined)
|
|
100
|
+
return 0;
|
|
101
|
+
return vectorUV.y - vectorUV.x * vectorUV.x;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Evaluate the (global coordinates) gradient (steepest descent) of the implicit function.
|
|
105
|
+
* @param xy space point
|
|
106
|
+
* @returns gradient vector for the implicit function
|
|
107
|
+
*/
|
|
108
|
+
gradient(xy) {
|
|
109
|
+
const vectorUV = this.globalToLocal(xy);
|
|
110
|
+
const result = Vector2d.create();
|
|
111
|
+
// use INVERSE of TRANSPOSE of [UV] matrix to map gradient terms
|
|
112
|
+
if (vectorUV !== undefined && SmallSystem.linearSystem2d(this.vectorU.x, this.vectorU.y, this.vectorV.x, this.vectorV.y, -2 * vectorUV.x, 1.0, result))
|
|
113
|
+
return result;
|
|
114
|
+
return Vector2d.create(0, 0);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Solve for parametric radians at Parabola points which are perpendicular projections of spacePoint.
|
|
118
|
+
* * Up to 4 solutions are possible.
|
|
119
|
+
* @param spacePoint the space point.
|
|
120
|
+
* @handler the handler to receive all the points on the curve and radians where perpendicular happens.
|
|
121
|
+
*/
|
|
122
|
+
emitPerpendiculars(spacePoint, handler) {
|
|
123
|
+
const vectorW = Vector2d.createStartEnd(spacePoint, this.center);
|
|
124
|
+
// vectorW is from space point to curve origin.
|
|
125
|
+
// vector to curve at an angle theta is vectorW + (s/(1=c)) U + ((1-c)/(1-s)) V
|
|
126
|
+
// where c and s are cosine and sine of the parameterization angle.
|
|
127
|
+
// The dot product of the curve tangent vector with the vector from spacePoint to curve
|
|
128
|
+
// has trig terms appearing at highest degree 2, hence is solved by the function
|
|
129
|
+
// solveUnitCircleImplicitQuadricIntersection.
|
|
130
|
+
const dotWU = vectorW.dotProduct(this.vectorU);
|
|
131
|
+
const dotWV = vectorW.dotProduct(this.vectorV);
|
|
132
|
+
const dotUU = this.vectorU.dotProduct(this.vectorU);
|
|
133
|
+
const dotVV = this.vectorV.dotProduct(this.vectorV);
|
|
134
|
+
const dotUV = this.vectorU.dotProduct(this.vectorV);
|
|
135
|
+
const coff1 = dotWU;
|
|
136
|
+
const coffC = 2 * dotWU;
|
|
137
|
+
const coffS = 2 * dotWV + dotUU + 2 * dotVV;
|
|
138
|
+
const coffCC = dotWU;
|
|
139
|
+
const coffSC = 2 * dotWV + dotUU - 2 * dotVV;
|
|
140
|
+
const coffSS = 3 * dotUV;
|
|
141
|
+
const radiansSolutions = [];
|
|
142
|
+
TrigPolynomial.solveUnitCircleImplicitQuadricIntersection(coffCC, coffSC, coffSS, coffC, coffS, coff1, radiansSolutions);
|
|
143
|
+
for (const radians of radiansSolutions) {
|
|
144
|
+
const curvePoint = this.radiansToPoint2d(radians);
|
|
145
|
+
if (curvePoint !== undefined)
|
|
146
|
+
handler(curvePoint, radians);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/** Returns true if the circle radius is near zero. */
|
|
150
|
+
// eslint-disable-next-line @itwin/prefer-get
|
|
151
|
+
isDegenerate() {
|
|
152
|
+
return undefined === this.globalToLocal(Point2d.create(0, 0));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Test if the centers and axes of the vectors are close
|
|
156
|
+
* @param other second Parabola
|
|
157
|
+
* @param negatedAndExchangedAxesAreEqual
|
|
158
|
+
* * if false, a strong equality test requiring both U and V vectors to match
|
|
159
|
+
* * This strong test is a test for identical parameterization
|
|
160
|
+
* * if true, a weak equality test that allows U and V to be negated and or exchanged.
|
|
161
|
+
* * The weak test is a test for the same implicit set
|
|
162
|
+
* @returns true if identical to tolerance.
|
|
163
|
+
*/
|
|
164
|
+
isSameParabola(other, negatedAndExchangedAxesAreEqual = false) {
|
|
165
|
+
const almostEqualOrNegated = (vectorU, vectorV) => {
|
|
166
|
+
if (Geometry.isSameCoordinate(vectorU.x, vectorV.x)
|
|
167
|
+
&& Geometry.isSameCoordinate(vectorU.y, vectorV.y))
|
|
168
|
+
return 1;
|
|
169
|
+
if (Geometry.isSameCoordinate(vectorU.x, -vectorV.x)
|
|
170
|
+
&& Geometry.isSameCoordinate(vectorU.y, -vectorV.y))
|
|
171
|
+
return -1;
|
|
172
|
+
return 0;
|
|
173
|
+
};
|
|
174
|
+
if (Geometry.isSamePoint2d(this.center, other.center)) {
|
|
175
|
+
if (!negatedAndExchangedAxesAreEqual)
|
|
176
|
+
return this.vectorU.isAlmostEqualMetric(other.vectorU) && this.vectorV.isAlmostEqualMetric(other.vectorV);
|
|
177
|
+
const uuCode = almostEqualOrNegated(this.vectorU, other.vectorU);
|
|
178
|
+
const vvCode = almostEqualOrNegated(this.vectorV, other.vectorV);
|
|
179
|
+
if (uuCode !== 0 && vvCode !== 0)
|
|
180
|
+
return true;
|
|
181
|
+
const uvCode = almostEqualOrNegated(this.vectorU, other.vectorV);
|
|
182
|
+
const vuCode = almostEqualOrNegated(this.vectorV, other.vectorU);
|
|
183
|
+
if (uvCode !== 0 && vuCode !== 0)
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=UnboundedParabola2d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnboundedParabola2d.js","sourceRoot":"","sources":["../../../../../src/curve/internalContexts/geometry2d/UnboundedParabola2d.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,mBAAoB,SAAQ,eAAe;IACtD,2DAA2D;IACpD,MAAM,CAAU;IACvB,kCAAkC;IAC3B,OAAO,CAAW;IACzB,kCAAkC;IAC3B,OAAO,CAAW;IACzB,yDAAyD;IACzD,YAAoB,MAAe,EAAE,OAAiB,EAAE,OAAiB;QACvE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IACD,uCAAuC;IAChC,KAAK;QACV,sCAAsC;QACtC,OAAO,mBAAmB,CAAC,0BAA0B,C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AC,CAAC,CAAC;gBACnD,OAAO,CAAC,CAAC,CAAC;YACZ,OAAO,CAAC,CAAC;QACX,CAAC,CAAA;QACD,IAAI,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YACtD,IAAI,CAAC,+BAA+B;gBAClC,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC5G,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACjE,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACjE,IAAI,MAAM,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC;gBAC9B,OAAO,IAAI,CAAA;YACb,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACjE,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACjE,IAAI,MAAM,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC;gBAC9B,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,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 CartesianGeometry\n */\n\n\nimport { SmallSystem } from \"../../../numerics/SmallSystem\";\nimport { Geometry } from \"../../../Geometry\";\nimport { Point2d, Vector2d } from \"../../../geometry3d/Point2dVector2d\";\nimport { XAndY } from \"../../../geometry3d/XYZProps\";\nimport { TrigPolynomial } from \"../../../numerics/Polynomials\";\nimport { ImplicitCurve2d } from \"./ImplicitCurve2d\";\n\n/**\n * Internal class for parabola in the xy plane, with an angular parameterization.\n * * In uv local coordinates\n * * Let c = cos(theta) and s = sin(theta)\n * * The parabola is (u,v) = (s/(1+c), (1-c)/(1+c))\n * * The uv derivative is (u',v') = (1/(c+1), 2s/(c+1))\n * * Basic trig identities confirm that u^2 = v as expected for a parabola.\n * * This traces the parabola in a full theta range (-2PI < theta < 2PI).\n * * The angle theta = 2PI is the singular point.\n * * In XY coordinates the mapped parabola is\n * * x = A + Uu + Vv\n * * X = A + U*s/(1+c) + V*(1-2*c/(1+c))\n * * X' = U * (1/(c+1) + V*2s/(c+1))\n * @internal\n */\nexport class UnboundedParabola2d extends ImplicitCurve2d {\n /** The Cartesian coordinates of any center on the line. */\n public center: Point2d;\n /** The local u axis direction. */\n public vectorU: Vector2d;\n /** The local v axis direction. */\n public vectorV: Vector2d;\n /* Constructor - CAPTURE given center and axis vectors */\n private constructor(center: Point2d, vectorU: Vector2d, vectorV: Vector2d) {\n super();\n this.center = center;\n this.vectorU = vectorU;\n this.vectorV = vectorV;\n }\n /** Return a clone of this Parabola. */\n public clone(): UnboundedParabola2d {\n // the create method clones the inputs\n return UnboundedParabola2d.createCenterAndAxisVectors(this.center, this.vectorU, this.vectorV);\n }\n /**\n * Create an UnboundedParabola2d from an xy object and a radius.\n * @param center xy coordinates of center\n * @param vectorU vector from center to to theta=0 vertex, i.e., along axis on the \"inside\" of the curve\n * @param vectorV vector from center to the transverse direction.\n */\n public static createCenterAndAxisVectors(center: XAndY, vectorU: XAndY, vectorV: XAndY): UnboundedParabola2d {\n return new UnboundedParabola2d(Point2d.create(center.x, center.y),\n Vector2d.create(vectorU.x, vectorU.y),\n Vector2d.create(vectorV.x, vectorV.y),\n );\n }\n /**\n * Return the local (uv) coordinate of a global point.\n * @param spacePoint point for coordinate conversion\n */\n public globalToLocal(spacePoint: XAndY): Vector2d | undefined {\n const result = Vector2d.create();\n if (SmallSystem.linearSystem2d(\n this.vectorU.x, this.vectorV.x,\n this.vectorU.y, this.vectorV.y,\n spacePoint.x - this.center.x, spacePoint.y - this.center.y,\n result))\n return result;\n return undefined;\n }\n /**\n * Returns xy coordinate on the Parabola.\n * @param radians parametric angle on the Parabola\n */\n public override radiansToPoint2d(radians: number): Point2d | undefined {\n const c = Math.cos(radians);\n const s = Math.sin(radians);\n const q = 1 + c;\n if (Geometry.isSmallMetricDistance(Math.abs(q)))\n return undefined;\n return this.center.plus2Scaled(this.vectorU, s / q, this.vectorV, (1 - c) / q);\n }\n /**\n * Returns the tangent at given radians value.\n * @param radians parametric angle on the parabola\n */\n public override radiansToTangentVector2d(radians: number): Vector2d | undefined {\n const c = Math.cos(radians);\n const s = Math.sin(radians);\n const q = 1 + c;\n const u = Geometry.conditionalDivideCoordinate(1, q);\n const v = Geometry.conditionalDivideCoordinate(2 * s, q * q);\n if (u === undefined || v === undefined)\n return undefined;\n return Vector2d.createAdd2Scaled(this.vectorU, u, this.vectorV, v);\n }\n /**\n * Return the implicit function value at xy.\n * @param xy space point\n * @returns v - u*u\n */\n public override functionValue(xy: XAndY): number {\n const vectorUV = this.globalToLocal(xy);\n if (vectorUV === undefined)\n return 0;\n return vectorUV.y - vectorUV.x * vectorUV.x;\n }\n /**\n * Evaluate the (global coordinates) gradient (steepest descent) of the implicit function.\n * @param xy space point\n * @returns gradient vector for the implicit function\n */\n public override gradient(xy: XAndY): Vector2d {\n const vectorUV = this.globalToLocal(xy);\n const result = Vector2d.create();\n // use INVERSE of TRANSPOSE of [UV] matrix to map gradient terms\n if (vectorUV !== undefined && SmallSystem.linearSystem2d(\n this.vectorU.x, this.vectorU.y,\n this.vectorV.x, this.vectorV.y,\n - 2 * vectorUV.x, 1.0,\n result))\n return result;\n return Vector2d.create(0, 0);\n }\n /**\n * Solve for parametric radians at Parabola points which are perpendicular projections of spacePoint.\n * * Up to 4 solutions are possible.\n * @param spacePoint the space point.\n * @handler the handler to receive all the points on the curve and radians where perpendicular happens.\n */\n public override emitPerpendiculars(\n spacePoint: Point2d, handler: (curvePoint: Point2d, radians: number | undefined) => any,\n ): void {\n const vectorW = Vector2d.createStartEnd(spacePoint, this.center);\n // vectorW is from space point to curve origin.\n // vector to curve at an angle theta is vectorW + (s/(1=c)) U + ((1-c)/(1-s)) V\n // where c and s are cosine and sine of the parameterization angle.\n // The dot product of the curve tangent vector with the vector from spacePoint to curve\n // has trig terms appearing at highest degree 2, hence is solved by the function\n // solveUnitCircleImplicitQuadricIntersection.\n const dotWU = vectorW.dotProduct(this.vectorU);\n const dotWV = vectorW.dotProduct(this.vectorV);\n const dotUU = this.vectorU.dotProduct(this.vectorU);\n const dotVV = this.vectorV.dotProduct(this.vectorV);\n const dotUV = this.vectorU.dotProduct(this.vectorV);\n const coff1 = dotWU;\n const coffC = 2 * dotWU;\n const coffS = 2 * dotWV + dotUU + 2 * dotVV;\n const coffCC = dotWU;\n const coffSC = 2 * dotWV + dotUU - 2 * dotVV;\n const coffSS = 3 * dotUV;\n const radiansSolutions: number[] = [];\n TrigPolynomial.solveUnitCircleImplicitQuadricIntersection(coffCC, coffSC, coffSS, coffC, coffS, coff1, radiansSolutions);\n for (const radians of radiansSolutions) {\n const curvePoint = this.radiansToPoint2d(radians);\n if (curvePoint !== undefined)\n handler(curvePoint, radians);\n }\n }\n /** Returns true if the circle radius is near zero. */\n // eslint-disable-next-line @itwin/prefer-get\n public override isDegenerate(): boolean {\n return undefined === this.globalToLocal(Point2d.create(0, 0));\n }\n /**\n * Test if the centers and axes of the vectors are close\n * @param other second Parabola\n * @param negatedAndExchangedAxesAreEqual\n * * if false, a strong equality test requiring both U and V vectors to match\n * * This strong test is a test for identical parameterization\n * * if true, a weak equality test that allows U and V to be negated and or exchanged.\n * * The weak test is a test for the same implicit set\n * @returns true if identical to tolerance.\n */\n public isSameParabola(other: UnboundedParabola2d, negatedAndExchangedAxesAreEqual: boolean = false): boolean {\n const almostEqualOrNegated = (vectorU: Vector2d, vectorV: Vector2d): -1 | 0 | 1 => {\n if (Geometry.isSameCoordinate(vectorU.x, vectorV.x)\n && Geometry.isSameCoordinate(vectorU.y, vectorV.y))\n return 1;\n if (Geometry.isSameCoordinate(vectorU.x, -vectorV.x)\n && Geometry.isSameCoordinate(vectorU.y, -vectorV.y))\n return -1;\n return 0;\n }\n if (Geometry.isSamePoint2d(this.center, other.center)) {\n if (!negatedAndExchangedAxesAreEqual)\n return this.vectorU.isAlmostEqualMetric(other.vectorU) && this.vectorV.isAlmostEqualMetric(other.vectorV);\n const uuCode = almostEqualOrNegated(this.vectorU, other.vectorU);\n const vvCode = almostEqualOrNegated(this.vectorV, other.vectorV);\n if (uuCode !== 0 && vvCode !== 0)\n return true\n const uvCode = almostEqualOrNegated(this.vectorU, other.vectorV);\n const vuCode = almostEqualOrNegated(this.vectorV, other.vectorU);\n if (uvCode !== 0 && vuCode !== 0)\n return true;\n }\n return false;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AustralianRailCorpXYEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/AustralianRailCorpXYEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,OAAO,6BAA8B,SAAQ,cAAc;IACvD,eAAe,CAAS;IACxB,eAAe,CAAS;IAChC,YAAoB,cAAsB,EAAE,cAAsB,EAAE,UAAkB,EAAE,MAAc;QACpG,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,C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AM,CAAC;QAClB,MAAM,EAAE,GAAG,OAAO,CAAC;QACnB,MAAM,EAAE,GAAG,QAAQ,CAAC;QACpB,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACvB,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,CAAC;IACX,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { Angle } from \"../../geometry3d/Angle\";\r\nimport { CubicEvaluator } from \"./CubicEvaluator\";\r\n\r\n/**\r\n * AustralianRailCorp spiral (also known as New South Wales spiral)\r\n * * The ultimate curve is a cubic `y = m * x^3`.\r\n * * `m` is a constant throughout the curve.\r\n * * Computation of m from the R and L is an complicated sequence, but is only done at construction time.\r\n * @internal\r\n */\r\nexport class AustralianRailCorpXYEvaluator extends CubicEvaluator {\r\n private _nominalLength1: number;\r\n private _nominalRadius1: number;\r\n private constructor(nominalLength1: number, nominalRadius1: number, axisLength: number, cubicM: number) {\r\n super(axisLength, cubicM);\r\n this._nominalLength1 = nominalLength1;\r\n this._nominalRadius1 = nominalRadius1;\r\n }\r\n public get nominalLength1() {\r\n return this._nominalLength1;\r\n }\r\n public get nominalRadius1() {\r\n return this._nominalRadius1;\r\n }\r\n public clone(): AustralianRailCorpXYEvaluator {\r\n return new AustralianRailCorpXYEvaluator(this._nominalLength1, this._nominalRadius1, this._axisLength, this._cubicM);\r\n }\r\n public static create(nominalLength1: number, nominalRadius1: number): AustralianRailCorpXYEvaluator | undefined {\r\n const axisLength = AustralianRailCorpXYEvaluator.radiusAndNominalLengthToAxisLength(nominalRadius1, nominalLength1);\r\n const phi = this.radiusAndAxisLengthToPhi(nominalRadius1, axisLength);\r\n const xc2 = axisLength * axisLength;\r\n const cubicM = Math.tan(phi) / (3.0 * xc2);\r\n return new AustralianRailCorpXYEvaluator(nominalLength1, nominalRadius1, axisLength, cubicM);\r\n }\r\n /** Compute the phi constant for AustralianRail spiral with given end radius and length along axis. */\r\n public static radiusAndAxisLengthToPhi(nominalRadius1: number, axisLength: number): number {\r\n const xc = axisLength;\r\n const expr1 = (2. / Math.sqrt(3.));\r\n let expr2 = (-(3. / 4.) * Math.sqrt(3.) * xc / nominalRadius1);\r\n if (expr2 < -1.0)\r\n expr2 = -1.0;\r\n if (expr2 > 1.0)\r\n expr2 = 1.0;\r\n const expr3 = Angle.degreesToRadians(240);\r\n return Math.asin(expr1 * Math.cos(Math.acos(expr2) / 3. + expr3));\r\n }\r\n public override scaleInPlace(scaleFactor: number): void {\r\n // apply the scale factor to all contents; all distances scale directly\r\n this._nominalLength1 *= scaleFactor;\r\n this._nominalRadius1 *= scaleFactor;\r\n super.scaleInPlace(scaleFactor);\r\n }\r\n /** Compute length along axis for AustralianRail spiral nominal radius and length. */\r\n public static radiusAndNominalLengthToAxisLength(\r\n nominalRadius1: number, nominalLength1: number, tolerance: number = 1.0e-5, requiredConvergenceCount: number = 2,\r\n ): number {\r\n const R = nominalRadius1;\r\n let idx = 0;\r\n let m, phi, xc2;\r\n let xc = .7 * nominalLength1;\r\n let convergenceCount = 0;\r\n // remark: This converges quickly\r\n // for L=100, R=400\r\n // ** full precision at 7th iteration.\r\n // ** classic tolerance 1.0e-5 (7 digits from L) with requiredConvergenceCount = 1 gives 11 digits after 3 iterations\r\n // ** each iteration adds about 2 digits. This is quite good for a successive replacement without derivative\r\n // ** Unanswerable question: If this is only done once and reused over all evaluations, do you want:\r\n // * run the 7 iterations to get full precision\r\n // * stop with the classic tolerance to get compatibility?\r\n for (idx = 0; idx < 100; ++idx) {\r\n phi = this.radiusAndAxisLengthToPhi(R, xc);\r\n xc2 = xc * xc;\r\n m = Math.tan(phi) / (3.0 * xc2);\r\n const m2x4 = m * m * xc2 * xc2;\r\n const correction = xc * m2x4 * ((9. / 10) + m2x4 * (-(9. / 8.) + m2x4 * (+(729. / 208.) + m2x4 * -(32805. / 2176.))));\r\n const correctedLength = xc + correction;\r\n xc = (nominalLength1 / correctedLength) * xc;\r\n if (Math.abs(nominalLength1 - correctedLength) < tolerance) {\r\n convergenceCount++;\r\n if (convergenceCount >= requiredConvergenceCount)\r\n break;\r\n } else {\r\n convergenceCount = 0;\r\n }\r\n }\r\n return xc;\r\n }\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof AustralianRailCorpXYEvaluator) {\r\n return Geometry.isAlmostEqualNumber(this._cubicM, other._cubicM)\r\n && Geometry.isAlmostEqualNumber(this._axisLength, other._axisLength)\r\n && Geometry.isAlmostEqualNumber(this._nominalLength1, other._nominalLength1)\r\n && Geometry.isAlmostEqualNumber(this._nominalRadius1, other._nominalRadius1);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return a (quite good approximation) of fraction along x axis for given distance along spiral.\r\n * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to\r\n * an x coordinate.\r\n * * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used for\r\n * this.fractionToX(fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.\r\n * * The x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\r\n * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the\r\n * more accurate CurvePrimitive measurements.\r\n * * Round tripping distance through (a) distanceAlongSpiralToAustralianApproximateX, (b) xToFraction, and\r\n * (c) curveLengthBetweenFractions has 10 digit accuracy for L/R = 4, 12 digit accuracy for L/R = 10.\r\n * @param s distance along the axis.\r\n */\r\n public distanceAlongSpiralToAustralianApproximateX(s: number): number {\r\n const a1 = 0.9000;\r\n const a2 = 5.1750;\r\n const a3 = 43.1948;\r\n const a4 = 426.0564;\r\n const m = this._cubicM;\r\n const m2s4 = m * m * s * s * s * s;\r\n const x = s * (1.0 - m2s4 * (a1 - m2s4 * (a2 - m2s4 * (a3 - m2s4 * a4))));\r\n return x;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"AustralianRailCorpXYEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/AustralianRailCorpXYEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,OAAO,6BAA8B,SAAQ,cAAc;IACvD,eAAe,CAAS;IACxB,eAAe,CAAS;IAChC,YAAoB,cAAsB,EAAE,cAAsB,EAAE,UAAkB,EAAE,MAAc;QACpG,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IACD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACM,KAAK;QACV,OAAO,IAAI,6BAA6B,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACvH,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,cAAsB,EAA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E,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,CAAC;IACX,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { Geometry } from \"../../Geometry\";\nimport { Angle } from \"../../geometry3d/Angle\";\nimport { CubicEvaluator } from \"./CubicEvaluator\";\n\n/**\n * AustralianRailCorp spiral (also known as New South Wales spiral)\n * * The ultimate curve is a cubic `y = m * x^3`.\n * * `m` is a constant throughout the curve.\n * * Computation of m from the R and L is an complicated sequence, but is only done at construction time.\n * @internal\n */\nexport class AustralianRailCorpXYEvaluator extends CubicEvaluator {\n private _nominalLength1: number;\n private _nominalRadius1: number;\n private constructor(nominalLength1: number, nominalRadius1: number, axisLength: number, cubicM: number) {\n super(axisLength, cubicM);\n this._nominalLength1 = nominalLength1;\n this._nominalRadius1 = nominalRadius1;\n }\n public get nominalLength1() {\n return this._nominalLength1;\n }\n public get nominalRadius1() {\n return this._nominalRadius1;\n }\n public clone(): AustralianRailCorpXYEvaluator {\n return new AustralianRailCorpXYEvaluator(this._nominalLength1, this._nominalRadius1, this._axisLength, this._cubicM);\n }\n public static create(nominalLength1: number, nominalRadius1: number): AustralianRailCorpXYEvaluator | undefined {\n const axisLength = AustralianRailCorpXYEvaluator.radiusAndNominalLengthToAxisLength(nominalRadius1, nominalLength1);\n const phi = this.radiusAndAxisLengthToPhi(nominalRadius1, axisLength);\n const xc2 = axisLength * axisLength;\n const cubicM = Math.tan(phi) / (3.0 * xc2);\n return new AustralianRailCorpXYEvaluator(nominalLength1, nominalRadius1, axisLength, cubicM);\n }\n /** Compute the phi constant for AustralianRail spiral with given end radius and length along axis. */\n public static radiusAndAxisLengthToPhi(nominalRadius1: number, axisLength: number): number {\n const xc = axisLength;\n const expr1 = (2. / Math.sqrt(3.));\n let expr2 = (-(3. / 4.) * Math.sqrt(3.) * xc / nominalRadius1);\n if (expr2 < -1.0)\n expr2 = -1.0;\n if (expr2 > 1.0)\n expr2 = 1.0;\n const expr3 = Angle.degreesToRadians(240);\n return Math.asin(expr1 * Math.cos(Math.acos(expr2) / 3. + expr3));\n }\n public override scaleInPlace(scaleFactor: number): void {\n // apply the scale factor to all contents; all distances scale directly\n this._nominalLength1 *= scaleFactor;\n this._nominalRadius1 *= scaleFactor;\n super.scaleInPlace(scaleFactor);\n }\n /** Compute length along axis for AustralianRail spiral nominal radius and length. */\n public static radiusAndNominalLengthToAxisLength(\n nominalRadius1: number, nominalLength1: number, tolerance: number = 1.0e-5, requiredConvergenceCount: number = 2,\n ): number {\n const R = nominalRadius1;\n let idx = 0;\n let m, phi, xc2;\n let xc = .7 * nominalLength1;\n let convergenceCount = 0;\n // remark: This converges quickly\n // for L=100, R=400\n // ** full precision at 7th iteration.\n // ** classic tolerance 1.0e-5 (7 digits from L) with requiredConvergenceCount = 1 gives 11 digits after 3 iterations\n // ** each iteration adds about 2 digits. This is quite good for a successive replacement without derivative\n // ** Unanswerable question: If this is only done once and reused over all evaluations, do you want:\n // * run the 7 iterations to get full precision\n // * stop with the classic tolerance to get compatibility?\n for (idx = 0; idx < 100; ++idx) {\n phi = this.radiusAndAxisLengthToPhi(R, xc);\n xc2 = xc * xc;\n m = Math.tan(phi) / (3.0 * xc2);\n const m2x4 = m * m * xc2 * xc2;\n const correction = xc * m2x4 * ((9. / 10) + m2x4 * (-(9. / 8.) + m2x4 * (+(729. / 208.) + m2x4 * -(32805. / 2176.))));\n const correctedLength = xc + correction;\n xc = (nominalLength1 / correctedLength) * xc;\n if (Math.abs(nominalLength1 - correctedLength) < tolerance) {\n convergenceCount++;\n if (convergenceCount >= requiredConvergenceCount)\n break;\n } else {\n convergenceCount = 0;\n }\n }\n return xc;\n }\n public isAlmostEqual(other: any): boolean {\n if (other instanceof AustralianRailCorpXYEvaluator) {\n return Geometry.isAlmostEqualNumber(this._cubicM, other._cubicM)\n && Geometry.isAlmostEqualNumber(this._axisLength, other._axisLength)\n && Geometry.isAlmostEqualNumber(this._nominalLength1, other._nominalLength1)\n && Geometry.isAlmostEqualNumber(this._nominalRadius1, other._nominalRadius1);\n }\n return false;\n }\n /**\n * Return a (quite good approximation) of fraction along x axis for given distance along spiral.\n * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to\n * an x coordinate.\n * * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used for\n * this.fractionToX(fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.\n * * The x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\n * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the\n * more accurate CurvePrimitive measurements.\n * * Round tripping distance through (a) distanceAlongSpiralToAustralianApproximateX, (b) xToFraction, and\n * (c) curveLengthBetweenFractions has 10 digit accuracy for L/R = 4, 12 digit accuracy for L/R = 10.\n * @param s distance along the axis.\n */\n public distanceAlongSpiralToAustralianApproximateX(s: number): number {\n const a1 = 0.9000;\n const a2 = 5.1750;\n const a3 = 43.1948;\n const a4 = 426.0564;\n const m = this._cubicM;\n const m2s4 = m * m * s * s * s * s;\n const x = s * (1.0 - m2s4 * (a1 - m2s4 * (a2 - m2s4 * (a3 - m2s4 * a4))));\n return x;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClothoidSeries.js","sourceRoot":"","sources":["../../../../src/curve/spiral/ClothoidSeries.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,OA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AAO,CAAC,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAClG,CAAC;IACM,WAAW,CAAC,CAAS;QAC1B,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,MAAM,SAAS,GAAG,YAAY,CAAC,WAAW,CAAC,SAAS,EAClD,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EACxC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,OAAO,SAAS,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\r\nimport { SimpleNewton } from \"../../numerics/Newton\";\r\n\r\n/**\r\n * Methods to evaluate caller-specified number of terms of the x and y Taylor series for a clothoid.\r\n * Each instance has:\r\n * * number of x and y terms to use.\r\n * * constant for theta = cxx.\r\n * * This value is c = 1/2RL for curve length L measured from inflection to point with radius R.\r\n * @internal\r\n */\r\nexport class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {\r\n /** Number of terms to use in x Taylor series. */\r\n public numXTerms: number;\r\n /** Number of terms to use in y Taylor series. */\r\n public numYTerms: number;\r\n /** Constant c = 1/2RL in theta = cxx. */\r\n public constantDiv2LR: number;\r\n /** The nominal curve length. */\r\n public nominalLength1: number;\r\n public constructor(nominalLength1: number, constantDiv2LR: number, numXTerms: number = 4, numYTerms: number = 4) {\r\n super();\r\n this.nominalLength1 = nominalLength1;\r\n this.constantDiv2LR = constantDiv2LR;\r\n this.numXTerms = numXTerms;\r\n this.numYTerms = numYTerms;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): ClothoidSeriesRLEvaluator {\r\n return new ClothoidSeriesRLEvaluator(this.nominalLength1, this.constantDiv2LR, this.numXTerms, this.numYTerms);\r\n }\r\n public scaleInPlace(scaleFactor: number): void {\r\n this.nominalLength1 *= scaleFactor;\r\n this.constantDiv2LR /= (scaleFactor * scaleFactor);\r\n }\r\n /** Member by member matchup. */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof ClothoidSeriesRLEvaluator) {\r\n return this.numXTerms === other.numXTerms\r\n && this.numYTerms === other.numYTerms\r\n && Geometry.isAlmostEqualNumber(this.constantDiv2LR, other.constantDiv2LR)\r\n && Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Evaluate the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToX(fraction: number): number {\r\n return this.fractionToXGo(fraction, this.numXTerms);\r\n }\r\n /**\r\n * Evaluate the Y series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToY(fraction: number): number {\r\n return this.fractionToYGo(fraction, this.numYTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDX(fraction: number): number {\r\n return this.fractionToDXGo(fraction, this.numXTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDY(fraction: number): number {\r\n return this.fractionToDYGo(fraction, this.numYTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDDX(fraction: number): number {\r\n return this.fractionToDDXGo(fraction, this.numXTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDDY(fraction: number): number {\r\n return this.fractionToDDYGo(fraction, this.numYTerms);\r\n }\r\n /**\r\n * Evaluate the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n * @param numTerms number of terms to use.\r\n */\r\n public fractionToXGo(fraction: number, numTerms: number): number {\r\n // write the Taylor series for cos(theta):\r\n // 1 - theta^2 / 2! + theta^4 / 4! - theta^6 / 6! + ...\r\n // replace theta by s*s*c:\r\n // 1 - s^4c^2 / 2! + s^8c^4 / 4! - s^12c^6 / 6! + ...\r\n // integrate wrt s:\r\n // x = s - s^5 c^2 / 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...\r\n // x = s(1 - (s^4 c^2/2) ( 1/5 - (s^4 c^2 / 3*4) (1/9 - ...) ) )\r\n const s = fraction * this.nominalLength1;\r\n let result = s;\r\n if (numTerms < 2)\r\n return result;\r\n const q1 = s * s * this.constantDiv2LR;\r\n const beta = - q1 * q1;\r\n let alpha = s;\r\n let m = 1;\r\n let n = 5;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha / n;\r\n m += 2;\r\n n += 4;\r\n }\r\n return result;\r\n }\r\n public fractionToYGo(fraction: number, numTerms: number): number {\r\n // write the Taylor series for sin(theta):\r\n // theta - theta^3 / 3! + theta^5 / 5! - theta^7 / 7! + ...\r\n // replace theta by s*s*c:\r\n // s^2 c - s^6 c^3 / 3! + s^10 c^5 / 5! - s^14 c^7 / 7! + ...\r\n // integrate wrt s:\r\n // y = s^3 c / 3 - s^7 c^3 / 7*3! + s^11 c^5 / 11*5! - s^15 c^7 / 15*7! + ...\r\n // y = s^3 c ( 1/3 - s^4 c^2/ 3! ( (1/7) - (s^4 c^2 / 4*5) (1/11 - ...) ) )\r\n const s = fraction * this.nominalLength1;\r\n const q1 = s * s * this.constantDiv2LR;\r\n let result = q1 * s / 3;\r\n if (numTerms < 2)\r\n return result;\r\n const beta = - q1 * q1;\r\n let alpha = q1 * s;\r\n let m = 2;\r\n let n = 7;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha / n;\r\n m += 2;\r\n n += 4;\r\n }\r\n return result;\r\n }\r\n public fractionToDXGo(fraction: number, numTerms: number): number {\r\n // yes -- this does happen during derivatives of cosines with more than 0 terms\r\n if (numTerms <= 0)\r\n return 0;\r\n // dX = 1 - s^4c^2/2 + s^8 c^4 / 4! -\r\n // new Term = old Term * beta / (m(m+1))\r\n const s = fraction * this.nominalLength1;\r\n let result = 1;\r\n if (numTerms < 2) {\r\n return result * this.nominalLength1;\r\n }\r\n const q1 = s * s * this.constantDiv2LR;\r\n const beta = - q1 * q1;\r\n let alpha = 1.0;\r\n let m = 1;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha;\r\n m += 2;\r\n }\r\n return result * this.nominalLength1;\r\n }\r\n public fractionToDYGo(fraction: number, numTerms: number): number {\r\n if (numTerms <= 0)\r\n return 0;\r\n // dY = q - q^3/3!\r\n // q = s^2 c\r\n // dY = s^2 c - s^6 c^3/3! + s^10 c^5/ 5!\r\n // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))\r\n const s = fraction * this.nominalLength1;\r\n const q1 = s * s * this.constantDiv2LR;\r\n let result = q1;\r\n if (numTerms < 2)\r\n return result * this.nominalLength1;\r\n const beta = - q1 * q1;\r\n let alpha = q1;\r\n let m = 2;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha;\r\n m += 2;\r\n }\r\n return result * this.nominalLength1;\r\n }\r\n public fractionToDDXGo(fraction: number, numTerms: number): number {\r\n // DX is \"cosine\"\r\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2 * this.constantDiv2LR * s;\r\n const sine = this.fractionToDYGo(fraction, numTerms - 1);\r\n const resultA = (- dTheta * sine * this.nominalLength1);\r\n return resultA;\r\n }\r\n public fractionToDDYGo(fraction: number, numTerms: number): number {\r\n // DY is \"sine\"\r\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n // BUT .... derivative of the cosine series leading term is zero ... use one less term\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2 * this.constantDiv2LR * s;\r\n const cosine = this.fractionToDXGo(fraction, numTerms);\r\n return cosine * dTheta * this.nominalLength1;\r\n }\r\n public fractionToD3X(fraction: number): number {\r\n if (this.numXTerms <= 1)\r\n return 0.0;\r\n // DX is \"cosine\"\r\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2.0 * this.constantDiv2LR * s;\r\n const d2Theta = 2.0 * this.constantDiv2LR;\r\n const sine = this.fractionToDYGo(fraction, this.numXTerms - 1);\r\n const cosine = this.fractionToDXGo(fraction, this.numXTerms - 1);\r\n return (- cosine * dTheta * dTheta - sine * d2Theta) * this.nominalLength1 * this.nominalLength1;\r\n }\r\n public fractionToD3Y(fraction: number): number {\r\n // DY is \"sine\"\r\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2.0 * this.constantDiv2LR * s;\r\n const d2Theta = 2.0 * this.constantDiv2LR;\r\n // dY is sine series with numYTerms.\r\n // ddY is cosine series. Leading term of sine series is non-constant, so numYTerms here also\r\n // d3Y is sine series. Derivative of preceding cosine killed first term.\r\n const cosine = this.fractionToDXGo(fraction, this.numYTerms);\r\n const sine = this.fractionToDYGo(fraction, this.numYTerms - 1);\r\n return (-sine * dTheta * dTheta + cosine * d2Theta) * this.nominalLength1 * this.nominalLength1;\r\n }\r\n public xToFraction(x: number): number | undefined {\r\n const fraction0 = x / this.nominalLength1;\r\n const fraction1 = SimpleNewton.runNewton1D(fraction0,\r\n (f: number) => (this.fractionToX(f) - x),\r\n (f: number) => this.fractionToDX(f));\r\n if (fraction1 === undefined)\r\n return undefined;\r\n return fraction1;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ClothoidSeries.js","sourceRoot":"","sources":["../../../../src/curve/spiral/ClothoidSeries.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,OAAO,yBAA0B,SAAQ,gBAAgB;IAC7D,iDAAiD;IAC1C,SAAS,CAAS;IACzB,iDAAiD;IAC1C,SAAS,CAAS;IACzB,yCAAyC;IAClC,cAAc,CAAS;IAC9B,gCAAgC;IACzB,cAAc,CAAS;IAC9B,YAAmB,cAAsB,EAAE,cAAsB,EAAE,YAAoB,CAAC,EAAE,YAAoB,CAAC;QAC7G,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IACD,2BAA2B;IACpB,KAAK;QACV,OAAO,IAAI,yBAAyB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACjH,CAAC;IACM,YAAY,CAAC,WAAmB;QACrC,IAAI,CAAC,cAAc,IAAI,WAAW,CAAC;QACnC,IAAI,CAAC,cAAc,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC;IACrD,CA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AG,IAAI,CAAC,cAAc,CAAC;QACzC,MAAM,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,oCAAoC;QACpC,6FAA6F;QAC7F,wEAAwE;QACxE,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;QAC/D,OAAO,CAAC,CAAC,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAClG,CAAC;IACM,WAAW,CAAC,CAAS;QAC1B,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,MAAM,SAAS,GAAG,YAAY,CAAC,WAAW,CAAC,SAAS,EAClD,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EACxC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,OAAO,SAAS,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { Geometry } from \"../../Geometry\";\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\nimport { SimpleNewton } from \"../../numerics/Newton\";\n\n/**\n * Methods to evaluate caller-specified number of terms of the x and y Taylor series for a clothoid.\n * Each instance has:\n * * number of x and y terms to use.\n * * constant for theta = cxx.\n * * This value is c = 1/2RL for curve length L measured from inflection to point with radius R.\n * @internal\n */\nexport class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {\n /** Number of terms to use in x Taylor series. */\n public numXTerms: number;\n /** Number of terms to use in y Taylor series. */\n public numYTerms: number;\n /** Constant c = 1/2RL in theta = cxx. */\n public constantDiv2LR: number;\n /** The nominal curve length. */\n public nominalLength1: number;\n public constructor(nominalLength1: number, constantDiv2LR: number, numXTerms: number = 4, numYTerms: number = 4) {\n super();\n this.nominalLength1 = nominalLength1;\n this.constantDiv2LR = constantDiv2LR;\n this.numXTerms = numXTerms;\n this.numYTerms = numYTerms;\n }\n /** Return a deep clone. */\n public clone(): ClothoidSeriesRLEvaluator {\n return new ClothoidSeriesRLEvaluator(this.nominalLength1, this.constantDiv2LR, this.numXTerms, this.numYTerms);\n }\n public scaleInPlace(scaleFactor: number): void {\n this.nominalLength1 *= scaleFactor;\n this.constantDiv2LR /= (scaleFactor * scaleFactor);\n }\n /** Member by member matchup. */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof ClothoidSeriesRLEvaluator) {\n return this.numXTerms === other.numXTerms\n && this.numYTerms === other.numYTerms\n && Geometry.isAlmostEqualNumber(this.constantDiv2LR, other.constantDiv2LR)\n && Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1);\n }\n return false;\n }\n /**\n * Evaluate the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToX(fraction: number): number {\n return this.fractionToXGo(fraction, this.numXTerms);\n }\n /**\n * Evaluate the Y series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToY(fraction: number): number {\n return this.fractionToYGo(fraction, this.numYTerms);\n }\n /**\n * Evaluate the derivative of the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDX(fraction: number): number {\n return this.fractionToDXGo(fraction, this.numXTerms);\n }\n /**\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDY(fraction: number): number {\n return this.fractionToDYGo(fraction, this.numYTerms);\n }\n /**\n * Evaluate the derivative of the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDDX(fraction: number): number {\n return this.fractionToDDXGo(fraction, this.numXTerms);\n }\n /**\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n */\n public fractionToDDY(fraction: number): number {\n return this.fractionToDDYGo(fraction, this.numYTerms);\n }\n /**\n * Evaluate the X series at a nominal distance along the curve.\n * @param fraction fractional position along the curve.\n * @param numTerms number of terms to use.\n */\n public fractionToXGo(fraction: number, numTerms: number): number {\n // write the Taylor series for cos(theta):\n // 1 - theta^2 / 2! + theta^4 / 4! - theta^6 / 6! + ...\n // replace theta by s*s*c:\n // 1 - s^4c^2 / 2! + s^8c^4 / 4! - s^12c^6 / 6! + ...\n // integrate wrt s:\n // x = s - s^5 c^2 / 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...\n // x = s(1 - (s^4 c^2/2) ( 1/5 - (s^4 c^2 / 3*4) (1/9 - ...) ) )\n const s = fraction * this.nominalLength1;\n let result = s;\n if (numTerms < 2)\n return result;\n const q1 = s * s * this.constantDiv2LR;\n const beta = - q1 * q1;\n let alpha = s;\n let m = 1;\n let n = 5;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha / n;\n m += 2;\n n += 4;\n }\n return result;\n }\n public fractionToYGo(fraction: number, numTerms: number): number {\n // write the Taylor series for sin(theta):\n // theta - theta^3 / 3! + theta^5 / 5! - theta^7 / 7! + ...\n // replace theta by s*s*c:\n // s^2 c - s^6 c^3 / 3! + s^10 c^5 / 5! - s^14 c^7 / 7! + ...\n // integrate wrt s:\n // y = s^3 c / 3 - s^7 c^3 / 7*3! + s^11 c^5 / 11*5! - s^15 c^7 / 15*7! + ...\n // y = s^3 c ( 1/3 - s^4 c^2/ 3! ( (1/7) - (s^4 c^2 / 4*5) (1/11 - ...) ) )\n const s = fraction * this.nominalLength1;\n const q1 = s * s * this.constantDiv2LR;\n let result = q1 * s / 3;\n if (numTerms < 2)\n return result;\n const beta = - q1 * q1;\n let alpha = q1 * s;\n let m = 2;\n let n = 7;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha / n;\n m += 2;\n n += 4;\n }\n return result;\n }\n public fractionToDXGo(fraction: number, numTerms: number): number {\n // yes -- this does happen during derivatives of cosines with more than 0 terms\n if (numTerms <= 0)\n return 0;\n // dX = 1 - s^4c^2/2 + s^8 c^4 / 4! -\n // new Term = old Term * beta / (m(m+1))\n const s = fraction * this.nominalLength1;\n let result = 1;\n if (numTerms < 2) {\n return result * this.nominalLength1;\n }\n const q1 = s * s * this.constantDiv2LR;\n const beta = - q1 * q1;\n let alpha = 1.0;\n let m = 1;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha;\n m += 2;\n }\n return result * this.nominalLength1;\n }\n public fractionToDYGo(fraction: number, numTerms: number): number {\n if (numTerms <= 0)\n return 0;\n // dY = q - q^3/3!\n // q = s^2 c\n // dY = s^2 c - s^6 c^3/3! + s^10 c^5/ 5!\n // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))\n const s = fraction * this.nominalLength1;\n const q1 = s * s * this.constantDiv2LR;\n let result = q1;\n if (numTerms < 2)\n return result * this.nominalLength1;\n const beta = - q1 * q1;\n let alpha = q1;\n let m = 2;\n for (let i = 1; i < numTerms; i++) {\n alpha *= beta / (m * (m + 1));\n result += alpha;\n m += 2;\n }\n return result * this.nominalLength1;\n }\n public fractionToDDXGo(fraction: number, numTerms: number): number {\n // DX is \"cosine\"\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n const s = fraction * this.nominalLength1;\n const dTheta = 2 * this.constantDiv2LR * s;\n const sine = this.fractionToDYGo(fraction, numTerms - 1);\n const resultA = (- dTheta * sine * this.nominalLength1);\n return resultA;\n }\n public fractionToDDYGo(fraction: number, numTerms: number): number {\n // DY is \"sine\"\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n // BUT .... derivative of the cosine series leading term is zero ... use one less term\n const s = fraction * this.nominalLength1;\n const dTheta = 2 * this.constantDiv2LR * s;\n const cosine = this.fractionToDXGo(fraction, numTerms);\n return cosine * dTheta * this.nominalLength1;\n }\n public fractionToD3X(fraction: number): number {\n if (this.numXTerms <= 1)\n return 0.0;\n // DX is \"cosine\"\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n const s = fraction * this.nominalLength1;\n const dTheta = 2.0 * this.constantDiv2LR * s;\n const d2Theta = 2.0 * this.constantDiv2LR;\n const sine = this.fractionToDYGo(fraction, this.numXTerms - 1);\n const cosine = this.fractionToDXGo(fraction, this.numXTerms - 1);\n return (- cosine * dTheta * dTheta - sine * d2Theta) * this.nominalLength1 * this.nominalLength1;\n }\n public fractionToD3Y(fraction: number): number {\n // DY is \"sine\"\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\n const s = fraction * this.nominalLength1;\n const dTheta = 2.0 * this.constantDiv2LR * s;\n const d2Theta = 2.0 * this.constantDiv2LR;\n // dY is sine series with numYTerms.\n // ddY is cosine series. Leading term of sine series is non-constant, so numYTerms here also\n // d3Y is sine series. Derivative of preceding cosine killed first term.\n const cosine = this.fractionToDXGo(fraction, this.numYTerms);\n const sine = this.fractionToDYGo(fraction, this.numYTerms - 1);\n return (-sine * dTheta * dTheta + cosine * d2Theta) * this.nominalLength1 * this.nominalLength1;\n }\n public xToFraction(x: number): number | undefined {\n const fraction0 = x / this.nominalLength1;\n const fraction1 = SimpleNewton.runNewton1D(fraction0,\n (f: number) => (this.fractionToX(f) - x),\n (f: number) => this.fractionToDX(f));\n if (fraction1 === undefined)\n return undefined;\n return fraction1;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CubicEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/CubicEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,OAAgB,cAAe,SAAQ,gBAAgB;IACjD,OAAO,CAAS;IAChB,WAAW,CAAS;IAC9B,YAAsB,UAAkB,EAAE,MAAc;QACtD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IACD,6BAA6B;IACtB,YAAY,CAAC,UAAkB,EAAE,MAAc;QACpD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IACD,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IACD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACD;;;OAGG;IACI,YAAY,CAAC,WAAmB;QACrC,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC;QAChC,oGAAoG;QACpG,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC;IAC9C,CAAC;IACD,8BAA8B;IACvB,WAAW,CAAC,QAAgB;QACjC,OAAO,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC;IACrC,CAAC;IACD,yDAAyD;IAClD,YAAY,CAAC,SAAiB;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IACD,gEAAgE;IACzD,aAAa,CAAC,SAAiB;QACpC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,+DAA+D;IACxD,aAAa,CAAC,SAAiB;QACpC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,8BAA8B;IACvB,WAAW,CAAC,QAAgB;QACjC,MAAM,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC;QACtC,OAAO,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IACD,yDAAyD;IAClD,YAAY,CAAC,QAAgB;QAClC,MAAM,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC;QACtC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;IACvD,CAAC;IACD,gEAAgE;IACzD,aAAa,CAAC,QAAgB;QACnC,MAAM,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC;QACtC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACtE,CAAC;IACD,+DAA+D;IACxD,aAAa,CAAC,SAAiB;QACpC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACrF,CAAC;IACD,8BAA8B;IACvB,WAAW,CAAC,CAAS;QAC1B,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;IAC9B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"CubicEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/CubicEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,OAAgB,cAAe,SAAQ,gBAAgB;IACjD,OAAO,CAAS;IAChB,WAAW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tC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;IACvD,CAAC;IACD,gEAAgE;IACzD,aAAa,CAAC,QAAgB;QACnC,MAAM,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC;QACtC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACtE,CAAC;IACD,+DAA+D;IACxD,aAAa,CAAC,SAAiB;QACpC,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACrF,CAAC;IACD,8BAA8B;IACvB,WAAW,CAAC,CAAS;QAC1B,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;IAC9B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\n\n/**\n * Intermediate class for evaluation of bare cubic spirals `y = m*x^3` with x axis from [0..xLength]\n * * This implements all the computations among fraction, x, and y.\n * * Derived classes implement specialized logic such as (a) precomputing `m` and (b) domain-specific fraction-to-distance\n * approximations.\n * @internal\n */\nexport abstract class CubicEvaluator extends XYCurveEvaluator {\n protected _cubicM: number;\n protected _axisLength: number;\n protected constructor(axisLength: number, cubicM: number) {\n super();\n this._cubicM = cubicM;\n this._axisLength = axisLength;\n }\n /** Update both constants. */\n public setConstants(axisLength: number, cubicM: number) {\n this._axisLength = axisLength;\n this._cubicM = cubicM;\n }\n public get axisLength() {\n return this._axisLength;\n }\n public get cubicM() {\n return this._cubicM;\n }\n /**\n * Apply `scaleFactor` to the xLength and cubicM.\n * * Derived classes commonly call this as `super.scaleInPlace()`, and additionally apply the scale to their members.\n */\n public scaleInPlace(scaleFactor: number) {\n this._axisLength *= scaleFactor;\n // \"x\" arriving at \"m * x^3\" will be scaled. \"m\" has to be divided by the scale to cancel 2 of the 3\n this._cubicM /= (scaleFactor * scaleFactor);\n }\n /** Evaluate X at fraction. */\n public fractionToX(fraction: number): number {\n return fraction * this._axisLength;\n }\n /** Evaluate derivative of X with respect to fraction. */\n public fractionToDX(_fraction: number): number {\n return this._axisLength;\n }\n /** Evaluate second derivative of X with respect to fraction. */\n public fractionToDDX(_fraction: number): number {\n return 0.0;\n }\n /** Evaluate third derivative of X with respect to fraction. */\n public fractionToD3X(_fraction: number): number {\n return 0.0;\n }\n /** Evaluate Y at fraction. */\n public fractionToY(fraction: number): number {\n const x = fraction * this._axisLength;\n return this._cubicM * x * x * x;\n }\n /** Evaluate derivative of Y with respect to fraction. */\n public fractionToDY(fraction: number): number {\n const x = fraction * this._axisLength;\n return 3.0 * this._cubicM * x * x * this._axisLength;\n }\n /** Evaluate second derivative of Y with respect to fraction. */\n public fractionToDDY(fraction: number): number {\n const x = fraction * this._axisLength;\n return 6.0 * this._cubicM * x * this._axisLength * this._axisLength;\n }\n /** Evaluate third derivative of Y with respect to fraction. */\n public fractionToD3Y(_fraction: number): number {\n return 6.0 * this._cubicM * this._axisLength * this._axisLength * this._axisLength;\n }\n /** Evaluate fraction at x. */\n public xToFraction(x: number): number {\n return x / this._axisLength;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CzechSpiralEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/CzechSpiralEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,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,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;;;;OAMG;IACI,6BAA6B,CAAC,CAAS;QAC5C,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;IACD;;;;OAIG;IACI,6BAA6B,CAAC,CAAS;QAC5C,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { CubicEvaluator } from \"./CubicEvaluator\";\r\nimport { SimpleNewton } from \"../../numerics/Newton\";\r\n\r\n/**\r\n * Czech cubic.\r\n * This is y = m*x^3 with\r\n * * x any point on the x axis.\r\n * * `fraction` along the spiral goes to `x = fraction * L`.\r\n * * m is gamma/(6RL).\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.\r\n * @internal\r\n */\r\nexport class CzechSpiralEvaluator extends CubicEvaluator {\r\n public nominalLength1: number;\r\n public nominalRadius1: number;\r\n /** Constructor is private. Caller responsible for cubicM validity. */\r\n private constructor(length1: number, radius1: number, cubicM: number) {\r\n super(length1, cubicM);\r\n this.nominalLength1 = length1;\r\n this.nominalRadius1 = radius1;\r\n }\r\n /**\r\n * Return the scale factor between simple x^3 / (6RL) cubic and the czech correction.\r\n * * For typical case with l1/R1 smallish, this is just less than 1.0:\r\n * (0.25==>0.99215), (0.15==>0.997184), (0.10==>0.998749), (0.05==>999687)\r\n */\r\n public static gammaConstant(length1: number, radius1: number): number | undefined {\r\n return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);\r\n }\r\n /** Compute the Czech cubic constant. */\r\n public static computeCubicM(length1: number, radius1: number): number | undefined {\r\n const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);\r\n // in the private update method, the LR values should have been vetted\r\n if (gamma === undefined)\r\n return undefined;\r\n // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator\r\n return gamma / Math.abs((6.0 * radius1 * length1));\r\n }\r\n public static create(length1: number, radius1: number): CzechSpiralEvaluator | undefined {\r\n const m = this.computeCubicM(length1, radius1);\r\n if (m === undefined)\r\n return undefined;\r\n return new CzechSpiralEvaluator(length1, radius1, m);\r\n }\r\n public override scaleInPlace(scaleFactor: number) {\r\n this.nominalLength1 *= scaleFactor;\r\n this.nominalRadius1 *= scaleFactor;\r\n super.scaleInPlace(scaleFactor);\r\n }\r\n /** Return a deep copy of the evaluator. */\r\n public clone(): CzechSpiralEvaluator {\r\n return new CzechSpiralEvaluator(this.nominalLength1, this.nominalRadius1, this.cubicM);\r\n }\r\n /** Member by member matchup. */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof CzechSpiralEvaluator) {\r\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\r\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\r\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\r\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate\r\n * CurvePrimitive measurements.\r\n * @param x distance along the x axis.\r\n */\r\n public xToCzechApproximateDistance(x: number): number {\r\n return CzechSpiralEvaluator.forwardL2R2Map(x, 1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n /**\r\n * Return the inverse of the `forwardL2R2Map` function.\r\n * * The undefined result can only occur for distances outside the usual spirals.\r\n * @param d (approximate) distance along the spiral.\r\n */\r\n public czechApproximateDistanceToX(d: number): number | undefined {\r\n return CzechSpiralEvaluator.inverseL2R2Map(d, 1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n /**\r\n * Evaluate a series expansion that is used with varying signs (plus or minus 1) in czech and italian spirals.\r\n * @param x distance along the x axis.\r\n */\r\n public static forwardL2R2Map(x: number, sign: number, length: number, radius: number): number {\r\n const l2 = length * length;\r\n const r2 = radius * radius;\r\n const Q = 4.0 * r2 - l2;\r\n const xx = x * x;\r\n return x * (1.0 + sign * xx * xx / (10.0 * Q * l2));\r\n }\r\n /**\r\n * Return the inverse of the `forwardL2R2Map` function.\r\n * * The undefined result can only occur for distances outside the usual spirals.\r\n * @param d (approximate) distance along the spiral.\r\n */\r\n public static inverseL2R2Map(d: number, sign: number, length: number, radius: number): number | undefined {\r\n const l2 = length * length;\r\n const r2 = radius * radius;\r\n const Q = 4.0 * r2 - l2;\r\n const a = sign / (10.0 * Q * l2);\r\n return SimpleNewton.runNewton1D(\r\n d,\r\n (x: number) => {\r\n const xx = x * x;\r\n return x * (1.0 + xx * xx * a) - d;\r\n },\r\n (x: number) => {\r\n const xx = x * x;\r\n return 1.0 + 5 * xx * xx * a;\r\n },\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Italian cubic.\r\n * This is y = m*x^3 with\r\n * * x any point on the x axis.\r\n * * `fraction` along the spiral goes to `x = fraction * L`.\r\n * * m is gamma/(6RL).\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.\r\n * @internal\r\n */\r\nexport class ItalianSpiralEvaluator extends CubicEvaluator {\r\n public nominalLength1: number;\r\n public nominalRadius1: number;\r\n /** Compute the Italian cubic constant. */\r\n private static computeCubicM(lengthXByForward: number, radius1: number): number | undefined {\r\n return CzechSpiralEvaluator.computeCubicM(lengthXByForward, radius1);\r\n }\r\n /** Constructor is private. Caller responsible for cubicM validity. */\r\n private constructor(length1: number, radius1: number, lengthX: number, cubicM: number) {\r\n super(lengthX, cubicM);\r\n this.nominalLength1 = length1;\r\n this.nominalRadius1 = radius1;\r\n }\r\n public static create(length1: number, radius1: number): ItalianSpiralEvaluator | undefined {\r\n // this seems goofy; lengthX from forward, then invert for another but that's what the native code does too\r\n const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);\r\n const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);\r\n if (lengthX1 === undefined)\r\n return undefined;\r\n const m = ItalianSpiralEvaluator.computeCubicM(lengthX, radius1);\r\n if (m === undefined)\r\n return undefined;\r\n return new ItalianSpiralEvaluator(length1, radius1, lengthX1, m);\r\n }\r\n public override scaleInPlace(scaleFactor: number) {\r\n this.nominalLength1 *= scaleFactor;\r\n this.nominalRadius1 *= scaleFactor;\r\n super.scaleInPlace(scaleFactor);\r\n }\r\n /** Return a deep copy of the evaluator. */\r\n public clone(): ItalianSpiralEvaluator {\r\n return new ItalianSpiralEvaluator(this.nominalLength1, this.nominalRadius1, super.axisLength, this.cubicM);\r\n }\r\n /** Member by member matchup. */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof ItalianSpiralEvaluator) {\r\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\r\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\r\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\r\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate\r\n * CurvePrimitive measurements.\r\n * @param x distance along the x axis.\r\n */\r\n public distanceToItalianApproximateX(x: number): number {\r\n return CzechSpiralEvaluator.forwardL2R2Map(x, -1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n /**\r\n * Return the inverse of the `forwardL2R2Map` function.\r\n * * The undefined result can only occur for distances outside the usual spirals.\r\n * @param d (approximate) distance along the spiral.\r\n */\r\n public xToItalianApproximateDistance(d: number): number | undefined {\r\n return CzechSpiralEvaluator.inverseL2R2Map(d, -1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"CzechSpiralEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/CzechSpiralEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;;;;;;;;GASG;AACH,MAAM,OAAO,oBAAqB,SAAQ,cAAc;IAC/C,cAAc,CAAS;IACvB,cAAc,CAAS;IAC9B,sEAAsE;IACtE,YAAoB,OAAe,EAAE,OAAe,EAAE,MAAc;QAClE,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;IAChC,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,aAAa,CAAC,OAAe,EAAE,OAAe;QAC1D,OAAO,GAAG,GAAG,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;IAChF,CAAC;IACD,wCAAwC;IACjC,MAAM,CAAC,aAAa,CAAC,OAAe,EAAE,OAAe;QAC1D,MAAM,KAAK,GAAG,oBAAoB,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,sEAAsE;QACtE,IAAI,KAAK,KAAK,SAAS;YACrB,OAAO,SAAS,CAAC;QACnB,iHAA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CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IACD,2CAA2C;IACpC,KAAK;QACV,OAAO,IAAI,sBAAsB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7G,CAAC;IACD,gCAAgC;IACzB,aAAa,CAAC,KAAU;QAC7B,IAAI,KAAK,YAAY,sBAAsB,EAAE,CAAC;YAC5C,OAAO,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC;mBACtE,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;;;;OAMG;IACI,6BAA6B,CAAC,CAAS;QAC5C,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;IACD;;;;OAIG;IACI,6BAA6B,CAAC,CAAS;QAC5C,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { Geometry } from \"../../Geometry\";\nimport { CubicEvaluator } from \"./CubicEvaluator\";\nimport { SimpleNewton } from \"../../numerics/Newton\";\n\n/**\n * Czech cubic.\n * This is y = m*x^3 with\n * * x any point on the x axis.\n * * `fraction` along the spiral goes to `x = fraction * L`.\n * * m is gamma/(6RL).\n * * 1/(6RL) is the leading term of the sine series.\n * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.\n * @internal\n */\nexport class CzechSpiralEvaluator extends CubicEvaluator {\n public nominalLength1: number;\n public nominalRadius1: number;\n /** Constructor is private. Caller responsible for cubicM validity. */\n private constructor(length1: number, radius1: number, cubicM: number) {\n super(length1, cubicM);\n this.nominalLength1 = length1;\n this.nominalRadius1 = radius1;\n }\n /**\n * Return the scale factor between simple x^3 / (6RL) cubic and the czech correction.\n * * For typical case with l1/R1 smallish, this is just less than 1.0:\n * (0.25==>0.99215), (0.15==>0.997184), (0.10==>0.998749), (0.05==>999687)\n */\n public static gammaConstant(length1: number, radius1: number): number | undefined {\n return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);\n }\n /** Compute the Czech cubic constant. */\n public static computeCubicM(length1: number, radius1: number): number | undefined {\n const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);\n // in the private update method, the LR values should have been vetted\n if (gamma === undefined)\n return undefined;\n // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator\n return gamma / Math.abs((6.0 * radius1 * length1));\n }\n public static create(length1: number, radius1: number): CzechSpiralEvaluator | undefined {\n const m = this.computeCubicM(length1, radius1);\n if (m === undefined)\n return undefined;\n return new CzechSpiralEvaluator(length1, radius1, m);\n }\n public override scaleInPlace(scaleFactor: number) {\n this.nominalLength1 *= scaleFactor;\n this.nominalRadius1 *= scaleFactor;\n super.scaleInPlace(scaleFactor);\n }\n /** Return a deep copy of the evaluator. */\n public clone(): CzechSpiralEvaluator {\n return new CzechSpiralEvaluator(this.nominalLength1, this.nominalRadius1, this.cubicM);\n }\n /** Member by member matchup. */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof CzechSpiralEvaluator) {\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\n }\n return false;\n }\n /**\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate\n * CurvePrimitive measurements.\n * @param x distance along the x axis.\n */\n public xToCzechApproximateDistance(x: number): number {\n return CzechSpiralEvaluator.forwardL2R2Map(x, 1.0, this.nominalLength1, this.nominalRadius1);\n }\n /**\n * Return the inverse of the `forwardL2R2Map` function.\n * * The undefined result can only occur for distances outside the usual spirals.\n * @param d (approximate) distance along the spiral.\n */\n public czechApproximateDistanceToX(d: number): number | undefined {\n return CzechSpiralEvaluator.inverseL2R2Map(d, 1.0, this.nominalLength1, this.nominalRadius1);\n }\n /**\n * Evaluate a series expansion that is used with varying signs (plus or minus 1) in czech and italian spirals.\n * @param x distance along the x axis.\n */\n public static forwardL2R2Map(x: number, sign: number, length: number, radius: number): number {\n const l2 = length * length;\n const r2 = radius * radius;\n const Q = 4.0 * r2 - l2;\n const xx = x * x;\n return x * (1.0 + sign * xx * xx / (10.0 * Q * l2));\n }\n /**\n * Return the inverse of the `forwardL2R2Map` function.\n * * The undefined result can only occur for distances outside the usual spirals.\n * @param d (approximate) distance along the spiral.\n */\n public static inverseL2R2Map(d: number, sign: number, length: number, radius: number): number | undefined {\n const l2 = length * length;\n const r2 = radius * radius;\n const Q = 4.0 * r2 - l2;\n const a = sign / (10.0 * Q * l2);\n return SimpleNewton.runNewton1D(\n d,\n (x: number) => {\n const xx = x * x;\n return x * (1.0 + xx * xx * a) - d;\n },\n (x: number) => {\n const xx = x * x;\n return 1.0 + 5 * xx * xx * a;\n },\n );\n }\n}\n\n/**\n * Italian cubic.\n * This is y = m*x^3 with\n * * x any point on the x axis.\n * * `fraction` along the spiral goes to `x = fraction * L`.\n * * m is gamma/(6RL).\n * * 1/(6RL) is the leading term of the sine series.\n * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.\n * @internal\n */\nexport class ItalianSpiralEvaluator extends CubicEvaluator {\n public nominalLength1: number;\n public nominalRadius1: number;\n /** Compute the Italian cubic constant. */\n private static computeCubicM(lengthXByForward: number, radius1: number): number | undefined {\n return CzechSpiralEvaluator.computeCubicM(lengthXByForward, radius1);\n }\n /** Constructor is private. Caller responsible for cubicM validity. */\n private constructor(length1: number, radius1: number, lengthX: number, cubicM: number) {\n super(lengthX, cubicM);\n this.nominalLength1 = length1;\n this.nominalRadius1 = radius1;\n }\n public static create(length1: number, radius1: number): ItalianSpiralEvaluator | undefined {\n // this seems goofy; lengthX from forward, then invert for another but that's what the native code does too\n const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);\n const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);\n if (lengthX1 === undefined)\n return undefined;\n const m = ItalianSpiralEvaluator.computeCubicM(lengthX, radius1);\n if (m === undefined)\n return undefined;\n return new ItalianSpiralEvaluator(length1, radius1, lengthX1, m);\n }\n public override scaleInPlace(scaleFactor: number) {\n this.nominalLength1 *= scaleFactor;\n this.nominalRadius1 *= scaleFactor;\n super.scaleInPlace(scaleFactor);\n }\n /** Return a deep copy of the evaluator. */\n public clone(): ItalianSpiralEvaluator {\n return new ItalianSpiralEvaluator(this.nominalLength1, this.nominalRadius1, super.axisLength, this.cubicM);\n }\n /** Member by member matchup. */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof ItalianSpiralEvaluator) {\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\n }\n return false;\n }\n /**\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate\n * CurvePrimitive measurements.\n * @param x distance along the x axis.\n */\n public distanceToItalianApproximateX(x: number): number {\n return CzechSpiralEvaluator.forwardL2R2Map(x, -1.0, this.nominalLength1, this.nominalRadius1);\n }\n /**\n * Return the inverse of the `forwardL2R2Map` function.\n * * The undefined result can only occur for distances outside the usual spirals.\n * @param d (approximate) distance along the spiral.\n */\n public xToItalianApproximateDistance(d: number): number | undefined {\n return CzechSpiralEvaluator.inverseL2R2Map(d, -1.0, this.nominalLength1, this.nominalRadius1);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DirectHalfCosineSpiralEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/DirectHalfCosineSpiralEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,gBAAgB;IAC5D,cAAc,CAAS;IACvB,cAAc,CAAS;IACtB,EAAE,CAAS;IACX,GAAG,CAAS;IACZ,GAAG,CAAS;IACpB,YAAmB,OAAe,EAAE,OAAe;QACjD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,sBAAsB;QACrC,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IACO,eAAe;QACrB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,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C,cAAc,CAAC;QAC1C,MAAM,SAAS,GAAG,YAAY,CAAC,WAAW,CACxC,SAAS,EACT,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EACxC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CACpC,CAAC;QACF,IAAI,SAAS,KAAK,SAAS;YACzB,OAAO,SAAS,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"DirectHalfCosineSpiralEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/DirectHalfCosineSpiralEvaluator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,gBAAgB;IAC5D,cAAc,CAAS;IACvB,cAAc,CAAS;IACtB,EAAE,CAAS;IACX,GAAG,CAAS;IACZ,GAAG,CAAS;IACpB,YAAmB,OAAe,EAAE,OAAe;QACjD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,sBAAsB;QACrC,IAAI,CAAC,eAAe,E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,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzF,CAAC;IACD,mDAAmD;IAC5C,WAAW,CAAC,CAAS;QAC1B,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,MAAM,SAAS,GAAG,YAAY,CAAC,WAAW,CACxC,SAAS,EACT,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EACxC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CACpC,CAAC;QACF,IAAI,SAAS,KAAK,SAAS;YACzB,OAAO,SAAS,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { Geometry } from \"../../Geometry\";\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\nimport { SimpleNewton } from \"../../numerics/Newton\";\n\n/**\n * @internal\n */\nexport class DirectHalfCosineSpiralEvaluator extends XYCurveEvaluator {\n public nominalLength1: number;\n public nominalRadius1: number;\n private _c: number;\n private _c1: number;\n private _c2: number;\n public constructor(length1: number, radius1: number) {\n super();\n this.nominalLength1 = length1;\n this.nominalRadius1 = radius1;\n const pi = Math.PI;\n this._c1 = 1.0 / (2.0 * pi * pi);\n this._c2 = 0.25;\n this._c = 0.0; // TO BE UPDATED BELOW\n this.updateConstants();\n }\n private updateConstants() {\n this._c = this.nominalLength1 * this.nominalLength1 / this.nominalRadius1;\n }\n public scaleInPlace(scaleFactor: number) {\n this.nominalLength1 *= scaleFactor;\n this.nominalRadius1 *= scaleFactor;\n this.updateConstants();\n }\n /** Return a deep copy of the evaluator. */\n public clone(): DirectHalfCosineSpiralEvaluator {\n return new DirectHalfCosineSpiralEvaluator(this.nominalLength1, this.nominalRadius1);\n }\n /** Member by member matchup. */\n public isAlmostEqual(other: any): boolean {\n if (other instanceof DirectHalfCosineSpiralEvaluator) {\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\n // remark: c,c1,c2 are computed, need not be tested.\n }\n return false;\n }\n /** Evaluate X at fractional position. */\n public fractionToX(fraction: number): number {\n return fraction * this.nominalLength1;\n }\n /** Evaluate Y at fractional position. */\n public fractionToY(fraction: number): number {\n const theta = fraction * Math.PI;\n return this._c * (this._c2 * fraction * fraction - this._c1 * (1.0 - Math.cos(theta)));\n }\n /** Evaluate derivative of X with respect to fraction at fractional position. */\n public fractionToDX(_fraction: number): number {\n return this.nominalLength1;\n }\n /** Evaluate derivative of Y with respect to fraction at fractional position. */\n public fractionToDY(fraction: number): number {\n const pi = Math.PI;\n const theta = fraction * pi;\n return this._c * (2.0 * this._c2 * fraction - this._c1 * pi * Math.sin(theta));\n }\n /** Evaluate second derivative of X with respect to fraction at fractional position. */\n public fractionToDDX(_fraction: number): number {\n return 0.0;\n }\n /** Evaluate third derivative of Y with respect to fraction at fractional position. */\n public fractionToDDY(fraction: number): number {\n const pi = Math.PI;\n const theta = fraction * pi;\n return this._c * (2.0 * this._c2 - this._c1 * pi * pi * Math.cos(theta));\n }\n /** Evaluate second derivative of X with respect to fraction at fractional position. */\n public fractionToD3X(_fraction: number): number {\n return 0.0;\n }\n /** Evaluate third derivative of Y with respect to fraction at fractional position. */\n public fractionToD3Y(fraction: number): number {\n const pi = Math.PI;\n const theta = fraction * pi;\n return this._c * this._c1 * pi * pi * pi * Math.sin(theta);\n }\n /** Return the magnitude of the first vector at fractional coordinate. */\n public override fractionToTangentMagnitude(fraction: number): number {\n return Geometry.hypotenuseXY(this.fractionToDX(fraction), this.fractionToDY(fraction));\n }\n /** Invert the fractionToX function for given X. */\n public xToFraction(x: number): number | undefined {\n const fraction0 = x / this.nominalLength1;\n const fraction1 = SimpleNewton.runNewton1D(\n fraction0,\n (f: number) => (this.fractionToX(f) - x),\n (f: number) => this.fractionToDX(f),\n );\n if (fraction1 === undefined)\n return undefined;\n return fraction1;\n }\n}\n"]}
|