@itwin/core-geometry 3.5.0-dev.35 → 3.5.0-dev.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Geometry.d.ts +13 -0
- package/lib/cjs/Geometry.d.ts.map +1 -1
- package/lib/cjs/Geometry.js.map +1 -1
- package/lib/cjs/bspline/BSplineCurve.d.ts +1 -1
- package/lib/cjs/bspline/BSplineCurve.js +1 -1
- package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
- package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
- package/lib/cjs/bspline/KnotVector.js +3 -0
- package/lib/cjs/bspline/KnotVector.js.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +7 -5
- package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js +37 -29
- package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/cjs/curve/CurveCollection.d.ts +4 -2
- package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
- package/lib/cjs/curve/CurveCollection.js +14 -2
- package/lib/cjs/curve/CurveCollection.js.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.d.ts +13 -17
- package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/cjs/curve/CurvePrimitive.js +51 -340
- package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
- package/lib/cjs/curve/LineString3d.d.ts +11 -1
- package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
- package/lib/cjs/curve/LineString3d.js +30 -23
- package/lib/cjs/curve/LineString3d.js.map +1 -1
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +143 -0
- package/lib/cjs/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +146 -0
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts +33 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js +91 -0
- package/lib/cjs/curve/internalContexts/CurveLengthContext.js.map +1 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js +34 -0
- package/lib/cjs/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
- package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +2 -2
- package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js +15 -8
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/geometry3d/Angle.d.ts +20 -10
- package/lib/cjs/geometry3d/Angle.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Angle.js +30 -15
- package/lib/cjs/geometry3d/Angle.js.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.d.ts +25 -8
- package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Matrix3d.js +67 -15
- package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts +23 -8
- package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point2dVector2d.js +40 -13
- package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts +90 -55
- package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Point3dVector3d.js +254 -123
- package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/cjs/geometry3d/Range.d.ts +0 -1
- package/lib/cjs/geometry3d/Range.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Range.js +0 -1
- package/lib/cjs/geometry3d/Range.js.map +1 -1
- package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
- package/lib/cjs/geometry3d/Transform.js.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/cjs/serialization/IModelJsonSchema.js +4 -3
- package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/cjs/solid/Sphere.d.ts +1 -1
- package/lib/cjs/solid/Sphere.js +3 -3
- package/lib/cjs/solid/Sphere.js.map +1 -1
- package/lib/cjs/solid/TorusPipe.d.ts +17 -13
- package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
- package/lib/cjs/solid/TorusPipe.js +67 -38
- package/lib/cjs/solid/TorusPipe.js.map +1 -1
- package/lib/cjs/topology/Graph.d.ts +1 -1
- package/lib/cjs/topology/Graph.js +1 -1
- package/lib/cjs/topology/Graph.js.map +1 -1
- package/lib/cjs/topology/Triangulation.d.ts +1 -1
- package/lib/cjs/topology/Triangulation.js +1 -1
- package/lib/cjs/topology/Triangulation.js.map +1 -1
- package/lib/esm/Geometry.d.ts +13 -0
- package/lib/esm/Geometry.d.ts.map +1 -1
- package/lib/esm/Geometry.js.map +1 -1
- package/lib/esm/bspline/BSplineCurve.d.ts +1 -1
- package/lib/esm/bspline/BSplineCurve.js +1 -1
- package/lib/esm/bspline/BSplineCurve.js.map +1 -1
- package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
- package/lib/esm/bspline/KnotVector.js +3 -0
- package/lib/esm/bspline/KnotVector.js.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +7 -5
- package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
- package/lib/esm/curve/CurveChainWithDistanceIndex.js +37 -29
- package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
- package/lib/esm/curve/CurveCollection.d.ts +4 -2
- package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
- package/lib/esm/curve/CurveCollection.js +14 -2
- package/lib/esm/curve/CurveCollection.js.map +1 -1
- package/lib/esm/curve/CurvePrimitive.d.ts +13 -17
- package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
- package/lib/esm/curve/CurvePrimitive.js +46 -335
- package/lib/esm/curve/CurvePrimitive.js.map +1 -1
- package/lib/esm/curve/LineString3d.d.ts +11 -1
- package/lib/esm/curve/LineString3d.d.ts.map +1 -1
- package/lib/esm/curve/LineString3d.js +30 -23
- package/lib/esm/curve/LineString3d.js.map +1 -1
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts +55 -0
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js +139 -0
- package/lib/esm/curve/internalContexts/AppendPlaneIntersectionStrokeHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +43 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +142 -0
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts +33 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.js +87 -0
- package/lib/esm/curve/internalContexts/CurveLengthContext.js.map +1 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts +21 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.d.ts.map +1 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js +30 -0
- package/lib/esm/curve/internalContexts/NewtonRtoRStrokeHandler.js.map +1 -0
- package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +2 -2
- package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js +15 -8
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/geometry3d/Angle.d.ts +20 -10
- package/lib/esm/geometry3d/Angle.d.ts.map +1 -1
- package/lib/esm/geometry3d/Angle.js +30 -15
- package/lib/esm/geometry3d/Angle.js.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.d.ts +25 -8
- package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Matrix3d.js +67 -15
- package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.d.ts +23 -8
- package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point2dVector2d.js +40 -13
- package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.d.ts +90 -55
- package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
- package/lib/esm/geometry3d/Point3dVector3d.js +254 -123
- package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
- package/lib/esm/geometry3d/Range.d.ts +0 -1
- package/lib/esm/geometry3d/Range.d.ts.map +1 -1
- package/lib/esm/geometry3d/Range.js +0 -1
- package/lib/esm/geometry3d/Range.js.map +1 -1
- package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
- package/lib/esm/geometry3d/Transform.js.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
- package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts +1 -1
- package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
- package/lib/esm/serialization/IModelJsonSchema.js +4 -3
- package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
- package/lib/esm/solid/Sphere.d.ts +1 -1
- package/lib/esm/solid/Sphere.js +3 -3
- package/lib/esm/solid/Sphere.js.map +1 -1
- package/lib/esm/solid/TorusPipe.d.ts +17 -13
- package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
- package/lib/esm/solid/TorusPipe.js +67 -38
- package/lib/esm/solid/TorusPipe.js.map +1 -1
- package/lib/esm/topology/Graph.d.ts +1 -1
- package/lib/esm/topology/Graph.js +1 -1
- package/lib/esm/topology/Graph.js.map +1 -1
- package/lib/esm/topology/Triangulation.d.ts +1 -1
- package/lib/esm/topology/Triangulation.js +1 -1
- package/lib/esm/topology/Triangulation.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurvePrimitive.js","sourceRoot":"","sources":["../../../src/curve/CurvePrimitive.ts"],"names":[],"mappings":";;;AASA,kEAA+D;AAC/D,0CAA0E;AAQ1E,qDAAkD;AAGlD,mEAAkE;AAClE,+CAA4C;AAC5C,uDAAoD;AACpD,qEAA6D;AAC7D,+CAAiG;AACjG,uDAAqD;AAErD,uDAAoF;AACpF,+DAAkG;AAClG,mDAAgD;AAKhD,+CAA8C;AAkC9C;;;;;;;;;;;;;GAaG;AACH,MAAsB,cAAe,SAAQ,6BAAa;IAMxD;QAA0B,KAAK,EAAE,CAAC;QALlC,wCAAwC;QACxB,qBAAgB,GAAG,gBAAgB,CAAC;IAIjB,CAAC;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QAAQ,EAAE,IAAI,CAAC,CAAC;QAC/B,IAAI,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC;YAAE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACpC,CAAC;IACM,oBAAoB,CAAC,KAAc,EAAE,QAAgB,EAAE,OAAiB;QAC7E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAClC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport type { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport { Clipper } from \"../clipping/ClipUtils\";\r\nimport { StrokeCountMap } from \"../curve/Query/StrokeCountMap\";\r\nimport { AxisOrder, Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport type { AkimaCurve3d } from \"../bspline/AkimaCurve3d\";\r\nimport type { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport type { BezierCurve3d } from \"../bspline/BezierCurve3d\";\r\nimport type { CurveChainWithDistanceIndex } from \"./CurveChainWithDistanceIndex\";\r\nimport type { DirectSpiral3d } from \"./spiral/DirectSpiral3d\";\r\nimport type { IntegratedSpiral3d } from \"./spiral/IntegratedSpiral3d\";\r\nimport { IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d, Vector3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { Order2Bezier } from \"../numerics/BezierPolynomials\";\r\nimport { Newton1dUnboundedApproximateDerivative, NewtonEvaluatorRtoR } from \"../numerics/Newton\";\r\nimport { GaussMapper } from \"../numerics/Quadrature\";\r\nimport type { Arc3d } from \"./Arc3d\";\r\nimport { CurveExtendOptions, VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveIntervalRole, CurveLocationDetail, CurveSearchStatus } from \"./CurveLocationDetail\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport type { LineSegment3d } from \"./LineSegment3d\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\nimport type { OffsetOptions } from \"./internalContexts/PolygonOffsetContext\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\n\r\n/** Describes the concrete type of a [[CurvePrimitive]]. Each type name maps to a specific subclass and can be used for type-switching in conditional statements.\r\n * - \"arc\" => [[Arc3d]]\r\n * - \"lineSegment\" => [[LineSegment3d]]\r\n * - \"lineString\" => [[LineString3d]]\r\n * - \"bsplineCurve\" => [[BSplineCurve3dBase]] which is an intermediate class implemented by [[BSplineCurve3d]] and [[BSplineCurve3dH]]\r\n * - \"bezierCurve\" => [[BezierCurveBase]] which is an intermediate class implemented by [[BezierCurve3d]] and [[BezierCurve3dH]]\r\n * - \"transitionSpiral\" => [[TransitionSpiral3d]]\r\n * - \"curveChainWithDistanceIndex\" => [[CurveChainWithDistanceIndex]]\r\n * @see [[AnyCurvePrimitive]] for a union type that supports compile-time type narrowing.\r\n * @public\r\n */\r\nexport type CurvePrimitiveType = \"arc\" | \"lineSegment\" | \"lineString\" | \"bsplineCurve\" | \"bezierCurve\" | \"transitionSpiral\" | \"curveChainWithDistanceIndex\" | \"interpolationCurve\" | \"akimaCurve\";\r\n\r\n/** Union type for subclasses of [[CurvePrimitive]]. Specific subclasses can be discriminated at compile- or run-time using [[CurvePrimitive.curvePrimitiveType]].\r\n * @public\r\n */\r\nexport type AnyCurvePrimitive = Arc3d | LineSegment3d | LineString3d | BSplineCurve3d | BezierCurve3d | DirectSpiral3d | IntegratedSpiral3d | CurveChainWithDistanceIndex | InterpolationCurve3d | AkimaCurve3d;\r\n\r\n/** function signature for callback which announces a pair of numbers, such as a fractional interval, along with a containing CurvePrimitive.\r\n * @public\r\n */\r\nexport type AnnounceNumberNumberCurvePrimitive = (a0: number, a1: number, cp: CurvePrimitive) => void;\r\n/** Function signature for a callback which announces a pair of numbers\r\n * @public\r\n */\r\n\r\nexport type AnnounceNumberNumber = (a0: number, a1: number) => void;\r\n/** Function signature for a callback which announces a curve primitive\r\n * @public\r\n */\r\nexport type AnnounceCurvePrimitive = (cp: CurvePrimitive) => void;\r\n\r\n/**\r\n * A curve primitive is bounded\r\n * A curve primitive maps fractions in 0..1 to points in space.\r\n * As the fraction proceeds from 0 towards 1, the point moves \"forward\" along the curve.\r\n * True distance along the curve is not always strictly proportional to fraction.\r\n * * LineSegment3d always has proportional fraction and distance\r\n * * an Arc3d which is true circular has proportional fraction and distance\r\n * * A LineString3d is not proportional (except for special case of all segments of equal length)\r\n * * A Spiral3d is proportional\r\n * * A BsplineCurve3d is only proportional for special cases.\r\n *\r\n * For fractions outside 0..1, the curve primitive class may either (a) return the near endpoint or (b) evaluate an extended curve.\r\n * @public\r\n */\r\nexport abstract class CurvePrimitive extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curvePrimitive\";\r\n /** String name for schema properties */\r\n public abstract readonly curvePrimitiveType: CurvePrimitiveType;\r\n\r\n protected constructor() { super(); }\r\n /**\r\n * data attached during stroking for facets.\r\n */\r\n public strokeData?: StrokeCountMap;\r\n /**\r\n * data attached in curve cutting.\r\n * @internal\r\n */\r\n public startCut?: CurveLocationDetail;\r\n /**\r\n * data attached in curve cutting.\r\n * @internal\r\n */\r\n public endCut?: CurveLocationDetail;\r\n /**\r\n * data attached by various algorithms (e.g. Region booleans)\r\n */\r\n public parent?: any;\r\n\r\n /** Return the point (x,y,z) on the curve at fractional position.\r\n * @param fraction fractional position along the geometry.\r\n * @returns Returns a point on the curve.\r\n */\r\n public abstract fractionToPoint(fraction: number, result?: Point3d): Point3d;\r\n /** Return the point (x,y,z) and derivative on the curve at fractional position.\r\n *\r\n * * Note that this derivative is \"derivative of xyz with respect to fraction.\"\r\n * * this derivative shows the speed of the \"fractional point\" moving along the curve.\r\n * * this is not generally a unit vector. use fractionToPointAndUnitTangent for a unit vector.\r\n * @param fraction fractional position along the geometry.\r\n * @returns Returns a ray whose origin is the curve point and direction is the derivative with respect to the fraction.\r\n */\r\n public abstract fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d;\r\n /**\r\n * Returns a ray whose origin is the curve point and direction is the unit tangent.\r\n * @param fraction fractional position on the curve\r\n * @param result optional preallocated ray.\r\n */\r\n public fractionToPointAndUnitTangent(fraction: number, result?: Ray3d): Ray3d {\r\n const ray = this.fractionToPointAndDerivative(fraction, result);\r\n ray.trySetDirectionMagnitudeInPlace(1.0);\r\n return ray;\r\n }\r\n /**\r\n * Returns the (absolute) curvature magnitude.\r\n * * Base implementation in CurvePrimitive computes curvature from the first and second derivative vectors.\r\n * @param fraction fractional position on the curve\r\n */\r\n public fractionToCurvature(fraction: number): number | undefined {\r\n const data = this.fractionToPointAnd2Derivatives(fraction)!;\r\n const cross = data.vectorU.crossProduct(data.vectorV);\r\n const a = cross.magnitude();\r\n const b = data.vectorU.magnitude();\r\n return Geometry.conditionalDivideFraction(a, b * b * b);\r\n }\r\n\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n public abstract fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined;\r\n\r\n /** Construct a frenet frame:\r\n * * origin at the point on the curve\r\n * * x axis is unit vector along the curve (tangent)\r\n * * y axis is perpendicular and in the plane of the osculating circle.\r\n * * z axis perpendicular to those.\r\n */\r\n public fractionToFrenetFrame(fraction: number, result?: Transform): Transform | undefined {\r\n const plane = this.fractionToPointAnd2Derivatives(fraction);\r\n if (!plane) return undefined;\r\n let axes = Matrix3d.createRigidFromColumns(plane.vectorU, plane.vectorV, AxisOrder.XYZ);\r\n if (axes)\r\n return Transform.createRefs(plane.origin, axes, result);\r\n // 2nd derivative not distinct -- do arbitrary headsUP ...\r\n const perpVector = Matrix3d.createPerpendicularVectorFavorXYPlane(plane.vectorU, plane.vectorV);\r\n axes = Matrix3d.createRigidFromColumns(plane.vectorU, perpVector, AxisOrder.XYZ);\r\n if (axes)\r\n return Transform.createRefs(plane.origin, axes, result);\r\n return undefined;\r\n }\r\n\r\n /** Construct signed distance from a point on the curve to its center of curvature (in xy only).\r\n * * Positive is to the left of the xy tangent.\r\n * * negative is to the right of the xy tangent.\r\n * * linear curve is 0.\r\n */\r\n public fractionToSignedXYRadiusOfCurvature(fraction: number): number {\r\n const plane = this.fractionToPointAnd2Derivatives(fraction);\r\n if (!plane)\r\n return 0.0;\r\n const cross = plane.vectorU.crossProductXY(plane.vectorV);\r\n const b = plane.vectorU.magnitude();\r\n if (b === 0.0)\r\n return 0.0;\r\n const r = Geometry.conditionalDivideCoordinate(b * b * b, cross);\r\n if (r !== undefined)\r\n return r;\r\n return 0.0;\r\n }\r\n /**\r\n * Construct a point extrapolated along tangent at fraction.\r\n * @param fraction fractional position on the primitive\r\n * @param distance (signed) distance to move on the tangent.\r\n */\r\n public fractionAndDistanceToPointOnTangent(fraction: number, distance: number): Point3d {\r\n const ray = this.fractionToPointAndUnitTangent(fraction);\r\n return ray.fractionToPoint(distance);\r\n }\r\n\r\n /**\r\n * return the length of the curve.\r\n * * Curve length is always positive.\r\n */\r\n public curveLength(): number {\r\n const context = new CurveLengthContext();\r\n this.emitStrokableParts(context);\r\n return context.getSum();\r\n }\r\n /**\r\n * Returns a (high accuracy) length of the curve between fractional positions\r\n * * Curve length is always positive.\r\n * * Default implementation applies a generic gaussian integration.\r\n * * Most curve classes (certainly LineSegment, LineString, Arc) are expected to provide efficient implementations.\r\n */\r\n public curveLengthBetweenFractions(fraction0: number, fraction1: number): number {\r\n if (fraction0 === fraction1)\r\n return 0.0;\r\n const scale = this.getFractionToDistanceScale();\r\n if (scale !== undefined) {\r\n // We are in luck! simple proportions determine it all !!!\r\n // (for example, a LineSegment3d or a circular arc)\r\n const totalLength = this.curveLength();\r\n return Math.abs((fraction1 - fraction0) * totalLength);\r\n }\r\n const context = new CurveLengthContext(fraction0, fraction1);\r\n this.emitStrokableParts(context);\r\n return Math.abs(context.getSum());\r\n }\r\n\r\n /**\r\n * Returns a (high accuracy) range of the curve between fractional positions\r\n * * Default implementation returns teh range of the curve from clonePartialCurve\r\n */\r\n public rangeBetweenFractions(fraction0: number, fraction1: number, transform?: Transform): Range3d {\r\n return this.rangeBetweenFractionsByClone (fraction0, fraction1, transform);\r\n }\r\n\r\n /**\r\n * Returns a (high accuracy) range of the curve between fractional positions\r\n * * Default implementation returns teh range of the curve from clonePartialCurve\r\n */\r\n public rangeBetweenFractionsByClone(fraction0: number, fraction1: number, transform?: Transform): Range3d {\r\n if (fraction0 === fraction1)\r\n return Range3d.create (this.fractionToPoint (fraction0));\r\n const fragment = this.clonePartialCurve (fraction0, fraction1);\r\n if (fragment)\r\n return fragment.range (transform);\r\n return Range3d.createNull ();\r\n }\r\n\r\n /**\r\n * Returns an approximate range based on a fixed number of evaluations\r\n * * Default implementation returns a range determined by evaluating a specified number of points on the curve.\r\n * * Optional evaluate again at interval midpoints and extrapolate any increase\r\n * * For a smooth curve, Richardson extrapolation suggests each subdivision moves 3/4 of the way to final. So extrapolationFactor\r\n * of 1/3 gets speculatively moves closer to the tight range, and larger multipliers increase confidence in being safely larger.\r\n * @param fraction0 start fraction for evaluation\r\n * @param fraction1 end fraction for evaluation\r\n * @param count number of points to evaluate\r\n * @param extrapolationFactor if positive, evaluate again at interval midpoints and apply this fraction multiplier to any increase in size.\r\n */\r\n public rangeBetweenFractionsByCount(fraction0: number, fraction1: number, count: number, transform?: Transform,\r\n extrapolationFactor: number = 0.0): Range3d {\r\n const range = Range3d.createNull ();\r\n const workPoint = Point3d.create ();\r\n range.extendPoint (this.startPoint (workPoint));\r\n range.extendPoint (this.endPoint (workPoint));\r\n // Evaluate at count fractions (fraction0 + i * fractionStep)\r\n const evaluateSteps = (fractionA: number, fractionStep: number, countA: number) => {\r\n let f = fractionA;\r\n for (let i = 0; i < countA; i++, f += fractionStep){\r\n this.fractionToPoint (f, workPoint);\r\n if (transform)\r\n range.extendTransformedPoint (transform, workPoint);\r\n else\r\n range.extendPoint (workPoint);\r\n }\r\n };\r\n const interiorCount = count - 2;\r\n if (interiorCount > 0){\r\n const localFraction0 = 1.0 / (interiorCount + 1);\r\n const globalFractionStep = localFraction0 * (fraction1 - fraction0);\r\n evaluateSteps (fraction0 + globalFractionStep, globalFractionStep, interiorCount);\r\n }\r\n if (extrapolationFactor > 0.0){\r\n // Evaluate at midpoints. Where this makes the range larger, apply extrapolationFactor to move it to safer excess value.\r\n // same interior step, but shift to interval midpoints:.\r\n const baseRange = range.clone ();\r\n const interiorCount1 = interiorCount + 1;\r\n const localFraction0 = 0.5 / interiorCount1; // we only evaluate at new midpoints.\r\n const globalFractionStep = 2 * localFraction0 * (fraction1 - fraction0); // same as above, but avoids special logic for interiorCount = 0\r\n evaluateSteps (fraction0 + globalFractionStep * 0.5, globalFractionStep, interiorCount1);\r\n range.extendWhenLarger (baseRange, extrapolationFactor);\r\n }\r\n return range;\r\n }\r\n\r\n /**\r\n *\r\n * * Run an integration (with a default gaussian quadrature) with a fixed fractional step\r\n * * This is typically called by specific curve type implementations of curveLengthBetweenFractions.\r\n * * For example, in Arc3d implementation of curveLengthBetweenFractions:\r\n * * If the Arc3d is true circular, it the arc is true circular, use the direct `arcLength = radius * sweepRadians`\r\n * * If the Arc3d is not true circular, call this method with an interval count appropriate to eccentricity and sweepRadians.\r\n * @returns Returns an integral estimated by numerical quadrature between the fractional positions.\r\n * @param fraction0 start fraction for integration\r\n * @param fraction1 end fraction for integration\r\n * @param numInterval number of quadrature intervals\r\n */\r\n public curveLengthWithFixedIntervalCountQuadrature(fraction0: number, fraction1: number, numInterval: number, numGauss: number = 5): number {\r\n if (fraction0 > fraction1) {\r\n const fSave = fraction0;\r\n fraction0 = fraction1;\r\n fraction1 = fSave;\r\n }\r\n const context = new CurveLengthContext(fraction0, fraction1, numGauss);\r\n context.announceIntervalForUniformStepStrokes(this, numInterval, fraction0, fraction1);\r\n return Math.abs(context.getSum());\r\n }\r\n\r\n /**\r\n *\r\n * * (Attempt to) find a position on the curve at a signed distance from start fraction.\r\n * * Return the position as a CurveLocationDetail.\r\n * * In the `CurveLocationDetail`, record:\r\n * * `fractional` position\r\n * * `fraction` = coordinates of the point\r\n * * `search\r\n * * `a` = (signed!) distance moved. If `allowExtension` is false and the move reached the start or end of the curve, this distance is smaller than the requested signedDistance.\r\n * * `curveSearchStatus` indicates one of:\r\n * * `error` (unusual) computation failed not supported for this curve.\r\n * * `success` full movement completed\r\n * * `stoppedAtBoundary` partial movement completed. This can be due to either\r\n * * `allowExtension` parameter sent as `false`\r\n * * the curve type (e.g. bspline) does not support extended range.\r\n * * if `allowExtension` is true, movement may still end at the startPoint or end point for curves that do not support extended geometry (specifically bsplines)\r\n * * if the curve returns a value (i.e. not `undefined`) for `curve.getFractionToDistanceScale()`, the base class carries out the computation\r\n * and returns a final location.\r\n * * LineSegment3d relies on this.\r\n * * If the curve does not implement the computation or the curve has zero length, the returned `CurveLocationDetail` has\r\n * * `fraction` = the value of `startFraction`\r\n * * `point` = result of `curve.fractionToPoint(startFraction)`\r\n * * `a` = 0\r\n * * `curveStartState` = `CurveSearchStatus.error`\r\n * @param startFraction fractional position where the move starts\r\n * @param signedDistance distance to move. Negative distance is backwards in the fraction space\r\n * @param allowExtension if true, all the move to go beyond the startPoint or endpoint of the curve. If false, do not allow movement beyond the startPoint or endpoint\r\n * @param result optional result.\r\n * @returns A CurveLocationDetail annotated as above. Note that if the curve does not support the calculation, there is still a result which contains the point at the input startFraction, with failure indicated in the `curveStartState` member\r\n */\r\n public moveSignedDistanceFromFraction(startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail): CurveLocationDetail {\r\n const scale = this.getFractionToDistanceScale();\r\n if (scale !== undefined) {\r\n // We are in luck! simple proportions determine it all !!!\r\n // (for example, a LineSegment3d or a circular arc)\r\n const totalLength = this.curveLength();\r\n const signedFractionMove = Geometry.conditionalDivideFraction(signedDistance, totalLength);\r\n if (signedFractionMove === undefined) {\r\n return CurveLocationDetail.createCurveFractionPointDistanceCurveSearchStatus(\r\n this, startFraction, this.fractionToPoint(startFraction), 0.0, CurveSearchStatus.error);\r\n }\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(\r\n allowExtension,\r\n this,\r\n startFraction,\r\n startFraction + signedFractionMove,\r\n signedDistance,\r\n result);\r\n }\r\n return this.moveSignedDistanceFromFractionGeneric(startFraction, signedDistance, allowExtension, result);\r\n }\r\n /**\r\n * Generic algorithm to search for point at signed distance from a fractional startPoint.\r\n * * This will work for well for smooth curves.\r\n * * Curves with tangent or other low-order-derivative discontinuities may need to implement specialized algorithms.\r\n * * We need to find an endFraction which is the end-of-interval (usually upper) limit of integration of the tangent magnitude from startFraction to endFraction\r\n * * That integral is a function of endFraction.\r\n * * The derivative of that integral with respect to end fraction is the tangent magnitude at end fraction.\r\n * * Use that function and (easily evaluated!) derivative for a Newton iteration\r\n * * TO ALL WHO HAVE FUZZY MEMORIES OF CALCULUS CLASS: \"The derivative of the integral wrt upper limit is the value of the integrand there\" is the\r\n * fundamental theorem of integral calculus !!! The fundamental theorem is not just an abstraction !!! It is being used\r\n * here in its barest possible form !!!\r\n * * See https://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus\r\n * @param startFraction\r\n * @param signedDistance\r\n * @param _allowExtension\r\n * @param result\r\n */\r\n protected moveSignedDistanceFromFractionGeneric(startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail): CurveLocationDetail {\r\n const limitFraction = signedDistance > 0.0 ? 1.0 : 0.0;\r\n const absDistance = Math.abs(signedDistance);\r\n const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;\r\n const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction); // that is always positive\r\n if (availableLength < absDistance && !allowExtension)\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, limitFraction, signedDistance, result);\r\n const fractionStep = absDistance / availableLength;\r\n let fractionB = Geometry.interpolate(startFraction, fractionStep, limitFraction);\r\n let fractionA = startFraction;\r\n let distanceA = 0.0;\r\n const tol = 1.0e-12 * availableLength;\r\n let numConverged = 0;\r\n const tangent = Ray3d.createXAxis();\r\n // on each loop entry:\r\n // fractionA is the most recent endOfInterval. (It may have been reached by a mixture of forward and backward step.)\r\n // distanceA is the distance to (the point at) fractionA\r\n // fractionB is the next end fraction\r\n for (let iterations = 0; iterations < 10; iterations++) {\r\n const distanceAB = this.curveLengthBetweenFractions(fractionA, fractionB);\r\n const directionAB = fractionB > fractionA ? directionFactor : -directionFactor;\r\n const distance0B = distanceA + directionAB * distanceAB;\r\n const distanceError = absDistance - distance0B;\r\n if (Math.abs(distanceError) < tol) {\r\n numConverged++;\r\n if (numConverged > 1)\r\n break;\r\n } else {\r\n numConverged = 0;\r\n }\r\n this.fractionToPointAndDerivative(fractionB, tangent);\r\n const tangentMagnitude = tangent.direction.magnitude();\r\n fractionA = fractionB;\r\n fractionB = fractionA + directionFactor * distanceError / tangentMagnitude;\r\n if (fractionA === fractionB) { // YES -- that is an exact equality test. When it happens, there's no need for confirming with another iteration.\r\n numConverged = 100;\r\n break;\r\n }\r\n distanceA = distance0B;\r\n }\r\n if (numConverged > 1)\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(false, this, startFraction, fractionB, signedDistance, result);\r\n\r\n result = CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);\r\n result.a = 0.0;\r\n result.curveSearchStatus = CurveSearchStatus.error;\r\n return result;\r\n }\r\n\r\n /**\r\n * * Returns true if the curve's fraction queries extend beyond 0..1.\r\n * * Base class default implementation returns false.\r\n * * These class (and perhaps others in the future) will return true:\r\n * * LineSegment3d\r\n * * LineString3d\r\n * * Arc3d\r\n */\r\n public get isExtensibleFractionSpace(): boolean { return false; }\r\n /**\r\n * Compute a length which may be an fast approximation to the true length.\r\n * This is expected to be either (a) exact or (b) larger than the actual length, but by no more than\r\n * a small multiple, perhaps up to PI/2, but commonly much closer to 1.\r\n *\r\n * * An example use of this is for setting a tolerance which is a small multiple of the curve length.\r\n * * Simple line, circular arc, and transition spiral may return exact length\r\n * * Ellipse may return circumference of some circle or polygon that encloses the ellipse.\r\n * * bspline curve may return control polygon length\r\n * *\r\n */\r\n public abstract quickLength(): number;\r\n /** Search for the curve point that is closest to the spacePoint.\r\n *\r\n * * If the space point is exactly on the curve, this is the reverse of fractionToPoint.\r\n * * Since CurvePrimitive should always have start and end available as candidate points, this method should always succeed\r\n * @param spacePoint point in space\r\n * @param extend true to extend the curve (if possible), false for no extend, single CurveExtendOptions (for both directions), or array of distinct CurveExtendOptions for start and end.\r\n * @returns Returns a CurveLocationDetail structure that holds the details of the close point.\r\n */\r\n public closestPoint(spacePoint: Point3d, extend: VariantCurveExtendParameter): CurveLocationDetail | undefined {\r\n const strokeHandler = new ClosestPointStrokeHandler(spacePoint, extend);\r\n this.emitStrokableParts(strokeHandler);\r\n return strokeHandler.claimResult();\r\n }\r\n /**\r\n * Find intervals of this curvePrimitive that are interior to a clipper\r\n * @param clipper clip structure (e.g. clip planes)\r\n * @param announce (optional) function to be called announcing fractional intervals\" ` announce(fraction0, fraction1, curvePrimitive)`\r\n * @returns true if any \"in\" segments are announced.\r\n */\r\n public announceClipIntervals(_clipper: Clipper, _announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n // DEFAULT IMPLEMENTATION -- no interior parts\r\n return false;\r\n }\r\n\r\n /** Return a deep clone. */\r\n public abstract override clone(): CurvePrimitive;\r\n\r\n /** Return a transformed deep clone. */\r\n public abstract override cloneTransformed(transform: Transform): CurvePrimitive | undefined;\r\n\r\n /** Return (if possible) a curve primitive which is a portion of this curve.\r\n * @param _fractionA [in] start fraction\r\n * @param _fractionB [in] end fraction\r\n */\r\n public clonePartialCurve(_fractionA: number, _fractionB: number): CurvePrimitive | undefined {\r\n return undefined;\r\n }\r\n /**\r\n * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return true\r\n * * If distance-along-the-curve is not proportional, return undefined.\r\n * * When defined, the scale factor is always the length of the curve.\r\n * * This scale factor is typically available for these curve types:\r\n * * * All `LineSegment3d`\r\n * * * Arc3d which is a true circular arc (axes perpendicular and of equal length).\r\n * * * CurveChainWithDistanceIndex\r\n * * This scale factor is undefined for these curve types:\r\n * * * Arc3d which is a true ellipse, i.e. unequal lengths of defining vectors or non-perpendicular defining vectors.\r\n * * * bspline and bezier curves\r\n * @returns scale factor or undefined\r\n */\r\n public getFractionToDistanceScale(): number | undefined { return undefined; }\r\n\r\n /** Reverse the curve's data so that its fractional stroking moves in the opposite direction. */\r\n public abstract reverseInPlace(): void;\r\n /**\r\n * Compute intersections with a plane.\r\n * * The intersections are appended to the result array.\r\n * * The base class implementation emits strokes to an AppendPlaneIntersectionStrokeHandler object, which uses a Newton iteration to get\r\n * high-accuracy intersection points within strokes.\r\n * * Derived classes should override this default implementation if there are easy analytic solutions.\r\n * * Derived classes are free to implement extended intersections (e.g. arc!!!)\r\n * @param plane The plane to be intersected.\r\n * @param result Array to receive intersections\r\n * @returns Return the number of CurveLocationDetail's added to the result array.\r\n */\r\n public appendPlaneIntersectionPoints(plane: PlaneAltitudeEvaluator, result: CurveLocationDetail[]): number {\r\n const strokeHandler = new AppendPlaneIntersectionStrokeHandler(plane, result);\r\n const n0 = result.length;\r\n this.emitStrokableParts(strokeHandler);\r\n return result.length - n0;\r\n }\r\n /**\r\n * Examine contents of an array of CurveLocationDetail.\r\n * Filter the intersections according to the parameters.\r\n * @param allowExtend if false, remove points on the extension.\r\n * @param applySnappedCoordinates if true, change the stored fractions and coordinates to exact end values. Otherwise\r\n * use the exact values only for purpose of updating the curveIntervalRole.\r\n * @param startEndFractionTolerance if nonzero, adjust fraction to 0 or 1 with this tolerance.\r\n * @param startEndXYZTolerance if nonzero, adjust to endpoint with this tolerance.\r\n * @internal\r\n */\r\n public static snapAndRestrictDetails(\r\n details: CurveLocationDetail[],\r\n allowExtend: boolean = true,\r\n applySnappedCoordinates: boolean = false,\r\n startEndFractionTolerance = Geometry.smallAngleRadians,\r\n startEndXYZTolerance = Geometry.smallMetricDistance) {\r\n const n0 = details.length;\r\n let acceptIndex = 0;\r\n const point0 = Point3d.create();\r\n const point1 = Point3d.create();\r\n let snappedCoordinates: Point3d | undefined;\r\n for (let candidateIndex = 0; candidateIndex < n0; candidateIndex++) {\r\n snappedCoordinates = undefined;\r\n const detail = details[candidateIndex];\r\n let fraction = detail.fraction;\r\n let accept = allowExtend || Geometry.isIn01(fraction);\r\n if (detail.curve) {\r\n detail.curve.startPoint(point0);\r\n detail.curve.endPoint(point1);\r\n }\r\n\r\n if (startEndFractionTolerance > 0) {\r\n if (Math.abs(fraction) < startEndFractionTolerance) {\r\n fraction = 0.0;\r\n accept = true;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point0;\r\n }\r\n if (Math.abs(fraction - 1.0) < startEndFractionTolerance) {\r\n fraction = 1.0;\r\n accept = true;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point1;\r\n if (detail.curve)\r\n snappedCoordinates = detail.curve.startPoint(point1);\r\n }\r\n }\r\n if (startEndXYZTolerance > 0 && detail.curve !== undefined) {\r\n // REMARK: always test both endpoints. If there is a cyclic fraction space, an intersection marked as \"after\" the end might have wrapped all the way to the beginning.\r\n if (detail.point.distance(point0) <= startEndXYZTolerance) {\r\n fraction = 0.0;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point0;\r\n } else if (detail.point.distance(point1) <= startEndXYZTolerance) {\r\n fraction = 1.0;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point1;\r\n }\r\n }\r\n if (accept) {\r\n if (applySnappedCoordinates) {\r\n detail.fraction = fraction;\r\n if (snappedCoordinates !== undefined)\r\n detail.point.setFrom(snappedCoordinates);\r\n }\r\n if (acceptIndex < candidateIndex)\r\n details[acceptIndex] = detail;\r\n acceptIndex++;\r\n }\r\n\r\n }\r\n if (acceptIndex < n0)\r\n details.length = acceptIndex;\r\n\r\n }\r\n\r\n /** Ask if the curve is within tolerance of a plane.\r\n * @returns Returns true if the curve is completely within tolerance of the plane.\r\n */\r\n public abstract isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean;\r\n /** return the startPoint of the primitive. The default implementation returns fractionToPoint (0.0) */\r\n public startPoint(result?: Point3d): Point3d { return this.fractionToPoint(0.0, result); }\r\n /** return the end point of the primitive. The default implementation returns fractionToPoint(1.0) */\r\n public endPoint(result?: Point3d): Point3d { return this.fractionToPoint(1.0, result); }\r\n /** Add strokes to caller-supplied linestring */\r\n public abstract emitStrokes(dest: LineString3d, options?: StrokeOptions): void;\r\n /** Ask the curve to announce points and simple subcurve fragments for stroking.\r\n * See IStrokeHandler for description of the sequence of the method calls.\r\n */\r\n public abstract emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void;\r\n /**\r\n * return the stroke count required for given options.\r\n * * This returns a single number\r\n * * See computeComponentStrokeCountForOptions to get structured per-component counts and fraction mappings.\r\n * @param options StrokeOptions that determine count\r\n */\r\n public abstract computeStrokeCountForOptions(options?: StrokeOptions): number;\r\n\r\n /**\r\n * attach StrokeCountMap structure to this primitive (and recursively to any children)\r\n * * Base class implementation (here) gets the simple count from computeStrokeCountForOptions and attaches it.\r\n * * LineString3d, arc3d, BezierCurve3d, BezierCurve3dH accept that default.\r\n * * Subdivided primitives (linestring, bspline curve) implement themselves and attach a StrokeCountMap containing the\r\n * total count, and also containing an array of StrokeCountMap per component.\r\n * * For CurvePrimitiveWithDistanceIndex, the top level gets (only) a total count, and each child gets\r\n * its own StrokeCountMap with appropriate structure.\r\n * @param options StrokeOptions that determine count\r\n * @param parentStrokeMap optional map from parent. Its count, curveLength, and a1 values are increased with count and distance from this primitive.\r\n * @return sum of `a0+this.curveLength()`, for use as `a0` of successor in chain.\r\n */\r\n public computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentMap?: StrokeCountMap) {\r\n const n = this.computeStrokeCountForOptions(options);\r\n const a = this.curveLength();\r\n CurvePrimitive.installStrokeCountMap(\r\n this,\r\n StrokeCountMap.createWithCurvePrimitive(this, n, a, 0, a),\r\n parentMap);\r\n }\r\n\r\n /**\r\n * * evaluate strokes at fractions indicated in a StrokeCountMap.\r\n * * Base class implementation (here) gets the simple count from computeStrokeCountForOptions and strokes at uniform fractions.\r\n * * LineString3d, arc3d, BezierCurve3d, BezierCurve3dH accept that default.\r\n * * Subdivided primitives (linestring, bspline curve) implement themselves and evaluate within components.\r\n * * CurvePrimitiveWithDistanceIndex recurses to its children.\r\n * * if packedFraction and packedDerivative arrays are present in the LineString3d, fill them.\r\n * @param map = stroke count data.\r\n * @param linestring = receiver linestring.\r\n * @return number of strokes added. 0 if any errors matching the map to the curve primitive.\r\n */\r\n public addMappedStrokesToLineString3D(map: StrokeCountMap, linestring: LineString3d): number {\r\n const numPoint0 = linestring.numPoints();\r\n if (map.primitive && map.primitive === this && map.numStroke > 0) {\r\n for (let i = 0; i <= map.numStroke; i++) {\r\n const fraction = i / map.numStroke;\r\n linestring.appendFractionToPoint(this, fraction);\r\n }\r\n }\r\n return linestring.numPoints() - numPoint0;\r\n }\r\n\r\n /**\r\n * final install step to save curveMap in curve. If parentMap is given, update its length, count, and a1 fields\r\n * @param curve curve to receive the annotation\r\n * @param map\r\n * @param parentMap\r\n */\r\n public static installStrokeCountMap(curve: CurvePrimitive, curveMap: StrokeCountMap, parentMap?: StrokeCountMap) {\r\n if (parentMap)\r\n parentMap.addToCountAndLength(curveMap.numStroke, curveMap.curveLength);\r\n curve.strokeData = curveMap;\r\n }\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * * This DEFAULT simply pushes `this` to the collectorArray.\r\n * * CurvePrimitiveWithDistanceIndex optionally collects its members.\r\n * @param collectorArray array to receive primitives (pushed -- the array is not cleared)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true, it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitivesGo(collectorArray: CurvePrimitive[], _smallestPossiblePrimitives: boolean, _explodeLinestrings: boolean = false) {\r\n collectorArray.push(this);\r\n }\r\n\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * * This DEFAULT captures the default result construction and calls collectCurvePrimitivesGo\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without clearing the array.)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true, it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false,\r\n explodeLinestrings: boolean = false): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n return results;\r\n }\r\n\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public abstract constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined;\r\n}\r\n\r\n/** Intermediate class for managing the parentCurve announcements from an IStrokeHandler */\r\nabstract class NewtonRotRStrokeHandler extends NewtonEvaluatorRtoR {\r\n protected _parentCurvePrimitive: CurvePrimitive | undefined;\r\n constructor() {\r\n super();\r\n this._parentCurvePrimitive = undefined;\r\n }\r\n /** retain the parentCurvePrimitive.\r\n * * Calling this method tells the handler that the parent curve is to be used for detail searches.\r\n * * Example: Transition spiral search is based on linestring first, then the exact spiral.\r\n * * Example: CurveChainWithDistanceIndex does NOT do this announcement -- the constituents act independently.\r\n */\r\n public startParentCurvePrimitive(curve: CurvePrimitive | undefined) { this._parentCurvePrimitive = curve; }\r\n /** Forget the parentCurvePrimitive */\r\n public endParentCurvePrimitive(_curve: CurvePrimitive | undefined) { this._parentCurvePrimitive = undefined; }\r\n}\r\n\r\nclass AppendPlaneIntersectionStrokeHandler extends NewtonRotRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _plane: PlaneAltitudeEvaluator;\r\n private _intersections: CurveLocationDetail[];\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n // private derivativeA: number; <---- Not currently used\r\n private _functionB: number = 0;\r\n private _fractionB: number = 0;\r\n private _derivativeB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars for use within methods.\r\n private _ray: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n\r\n // Return the first defined curve among: this.parentCurvePrimitive, this.curve;\r\n public effectiveCurve(): CurvePrimitive | undefined {\r\n if (this._parentCurvePrimitive)\r\n return this._parentCurvePrimitive;\r\n return this._curve;\r\n }\r\n public get getDerivativeB() { return this._derivativeB; } // <--- DerivativeB is not currently used anywhere. Provided getter to suppress lint error\r\n\r\n public constructor(plane: PlaneAltitudeEvaluator, intersections: CurveLocationDetail[]) {\r\n super();\r\n this._plane = plane;\r\n this._intersections = intersections;\r\n this.startCurvePrimitive(undefined);\r\n this._ray = Ray3d.createZero();\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n // this.derivativeA = 0.0;\r\n }\r\n public endCurvePrimitive() { }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n this.startCurvePrimitive(cp);\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._ray);\r\n this.announcePointTangent(this._ray.origin, fraction, this._ray.direction);\r\n }\r\n }\r\n public announceSegmentInterval(\r\n _cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n _numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n const h0 = this._plane.altitude(point0);\r\n const h1 = this._plane.altitude(point1);\r\n if (h0 * h1 > 0.0)\r\n return;\r\n const fraction01 = Order2Bezier.solveCoffs(h0, h1);\r\n // let numIntersection = 0;\r\n if (fraction01 !== undefined) {\r\n // numIntersection++;\r\n const fraction = Geometry.interpolate(fraction0, fraction01, fraction1);\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations()) {\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n // this.intersections.push(CurveLocationDetail.createCurveFractionPoint(cp, fraction, cp.fractionToPoint(fraction)));\r\n }\r\n }\r\n private announceSolutionFraction(fraction: number) {\r\n const curve = this.effectiveCurve();\r\n if (curve) {\r\n this._ray = curve.fractionToPointAndDerivative(fraction, this._ray);\r\n this._intersections.push(CurveLocationDetail.createCurveFractionPoint(curve, fraction, this._ray.origin));\r\n }\r\n }\r\n public evaluate(fraction: number): boolean {\r\n const curve = this.effectiveCurve();\r\n if (!curve)\r\n return false;\r\n this.currentF = this._plane.altitude(curve.fractionToPoint(fraction));\r\n return true;\r\n }\r\n /**\r\n * * ASSUME both the \"A\" and \"B\" evaluations (fraction, function, and derivative) are known.\r\n * * If function value changed sign between, interpolate an approximate root and improve it with\r\n * the newton solver.\r\n */\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0) return;\r\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n /** Evaluate and save _functionB, _derivativeB, and _fractionB. */\r\n private evaluateB(xyz: Point3d, fraction: number, tangent: Vector3d) {\r\n this._functionB = this._plane.altitude(xyz);\r\n this._derivativeB = this._plane.velocity(tangent);\r\n this._fractionB = fraction;\r\n }\r\n /**\r\n * Announce point and tangent for evaluations.\r\n * * The function evaluation is saved as the \"B\" function point.\r\n * * The function point count is incremented\r\n * * If function point count is greater than 1, the current interval is searched.\r\n * * The just-evaluated point (\"B\") is saved as the \"old\" (\"A\") evaluation point.\r\n * @param xyz\r\n * @param fraction\r\n * @param tangent\r\n */\r\n public announcePointTangent(xyz: Point3d, fraction: number, tangent: Vector3d): void {\r\n this.evaluateB(xyz, fraction, tangent);\r\n if (this._numThisCurve++ > 0) this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n}\r\n\r\nclass CurveLengthContext implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _summedLength: number;\r\n private _ray: Ray3d;\r\n private _fraction0: number;\r\n private _fraction1: number;\r\n private _gaussMapper: GaussMapper;\r\n\r\n private tangentMagnitude(fraction: number): number {\r\n this._ray = (this._curve as CurvePrimitive).fractionToPointAndDerivative(fraction, this._ray);\r\n return this._ray.direction.magnitude();\r\n }\r\n public getSum() { return this._summedLength; }\r\n\r\n public constructor(fraction0: number = 0.0, fraction1: number = 1.0, numGaussPoints: number = 5) {\r\n this.startCurvePrimitive(undefined);\r\n this._summedLength = 0.0;\r\n this._ray = Ray3d.createZero();\r\n if (fraction0 < fraction1) {\r\n this._fraction0 = fraction0;\r\n this._fraction1 = fraction1;\r\n } else {\r\n this._fraction0 = fraction1;\r\n this._fraction1 = fraction0;\r\n }\r\n this._gaussMapper = new GaussMapper(numGaussPoints);\r\n }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n }\r\n public startParentCurvePrimitive(_curve: CurvePrimitive) { }\r\n public endParentCurvePrimitive(_curve: CurvePrimitive) { }\r\n\r\n public endCurvePrimitive() { }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n if (fraction0 < this._fraction0) fraction0 = this._fraction0;\r\n if (fraction1 > this._fraction1) fraction1 = this._fraction1;\r\n if (fraction1 > fraction0) {\r\n this.startCurvePrimitive(cp);\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 1; i <= numStrokes; i++) {\r\n const fractionA = Geometry.interpolate(fraction0, (i - 1) * df, fraction1);\r\n const fractionB = i === numStrokes ? fraction1 : Geometry.interpolate(fraction0, (i) * df, fraction1);\r\n const numGauss = this._gaussMapper.mapXAndW(fractionA, fractionB);\r\n for (let k = 0; k < numGauss; k++) {\r\n this._summedLength += this._gaussMapper.gaussW[k] * this.tangentMagnitude(this._gaussMapper.gaussX[k]);\r\n }\r\n }\r\n }\r\n }\r\n public announceSegmentInterval(\r\n _cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n _numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n const segmentLength = point0.distance(point1);\r\n if (this._fraction0 <= fraction0 && fraction1 <= this._fraction1)\r\n this._summedLength += segmentLength;\r\n else {\r\n let g0 = fraction0;\r\n let g1 = fraction1;\r\n if (g0 < this._fraction0) g0 = this._fraction0;\r\n if (g1 > this._fraction1) g1 = this._fraction1;\r\n if (g1 > g0) {\r\n this._summedLength += segmentLength * (g1 - g0) / (fraction1 - fraction0);\r\n }\r\n }\r\n }\r\n public announcePointTangent(_xyz: Point3d, _fraction: number, _tangent: Vector3d): void {\r\n // uh oh -- need to retain point for next interval\r\n }\r\n}\r\n// context for searching for closest point .. .\r\nclass ClosestPointStrokeHandler extends NewtonRotRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _closestPoint: CurveLocationDetail | undefined;\r\n private _spacePoint: Point3d;\r\n private _extend: VariantCurveExtendParameter;\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n private _functionB: number = 0;\r\n private _fractionB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars for use within methods.\r\n private _workPoint: Point3d;\r\n private _workRay: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n\r\n public constructor(spacePoint: Point3d, extend: VariantCurveExtendParameter) {\r\n super();\r\n this._spacePoint = spacePoint;\r\n this._workPoint = Point3d.create();\r\n this._workRay = Ray3d.createZero();\r\n this._closestPoint = undefined;\r\n this._extend = extend;\r\n this.startCurvePrimitive(undefined);\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n\r\n public claimResult(): CurveLocationDetail | undefined {\r\n if (this._closestPoint) {\r\n this._newtonSolver.setX(this._closestPoint.fraction);\r\n this._curve = this._closestPoint.curve;\r\n if (this._newtonSolver.runIterations()) {\r\n let fraction = this._newtonSolver.getX();\r\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\r\n this.announceSolutionFraction(fraction);\r\n }\r\n }\r\n return this._closestPoint;\r\n }\r\n public needPrimaryGeometryForStrokes() { return true; }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n }\r\n public endCurvePrimitive() { }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive,\r\n numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n this.startCurvePrimitive(cp);\r\n this.announceSolutionFraction(0.0); // test start point as closest\r\n this.announceSolutionFraction(1.0); // test end point as closest\r\n if (numStrokes < 1) numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n }\r\n\r\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\r\n const distance = this._spacePoint.distance(point);\r\n if (this._closestPoint && distance > this._closestPoint.a)\r\n return;\r\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\r\n this._closestPoint.a = distance;\r\n if (this._parentCurvePrimitive !== undefined)\r\n this._closestPoint.curve = this._parentCurvePrimitive;\r\n }\r\n public announceSegmentInterval(\r\n cp: CurvePrimitive,\r\n point0: Point3d,\r\n point1: Point3d,\r\n _numStrokes: number,\r\n fraction0: number,\r\n fraction1: number): void {\r\n let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\r\n // only consider extending the segment if the immediate caller says we are at endpoints ...\r\n if (!this._extend)\r\n localFraction = Geometry.clampToStartEnd(localFraction, 0.0, 1.0);\r\n else {\r\n if (fraction0 !== 0.0)\r\n localFraction = Math.max(localFraction, 0.0);\r\n if (fraction1 !== 1.0)\r\n localFraction = Math.min(localFraction, 1.0);\r\n }\r\n this._workPoint = point0.interpolate(localFraction, point1);\r\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\r\n this.announceCandidate(cp, globalFraction, this._workPoint);\r\n }\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0) return;\r\n if (this._functionA === 0) this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0) this.announceSolutionFraction(this._fractionB);\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n private evaluateB(fractionB: number, dataB: Ray3d) {\r\n this._functionB = dataB.dotProductToPoint(this._spacePoint);\r\n this._fractionB = fractionB;\r\n }\r\n private announceSolutionFraction(fraction: number) {\r\n if (this._curve)\r\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\r\n }\r\n public evaluate(fraction: number): boolean {\r\n let curve = this._curve;\r\n if (this._parentCurvePrimitive)\r\n curve = this._parentCurvePrimitive;\r\n if (curve) {\r\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.currentF = this._workRay.dotProductToPoint(this._spacePoint);\r\n return true;\r\n }\r\n return false;\r\n }\r\n public announceRay(fraction: number, data: Ray3d): void {\r\n this.evaluateB(fraction, data);\r\n if (this._numThisCurve++ > 0) this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\r\n this._workRay.set(point, tangent);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"CurvePrimitive.js","sourceRoot":"","sources":["../../../src/curve/CurvePrimitive.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/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,UAAU,GAAG,QAAQ,CAAC;IAC9B,CAAC;IACD;;;;;;OAMG;IACI,wBAAwB,CAAC,cAAgC,EAAE,2BAAoC,EAAE,sBAA+B,KAAK;QAC1I,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACI,sBAAsB,CAAC,cAAiC,EAAE,6BAAsC,KAAK,EAC1G,qBAA8B,KAAK;QACnC,MAAM,OAAO,GAAqB,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC;QACrF,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;QACvF,OAAO,OAAO,CAAC;IACjB,CAAC;CASF;AAlpBD,wCAkpBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Clipper } from \"../clipping/ClipUtils\";\r\nimport { StrokeCountMap } from \"../curve/Query/StrokeCountMap\";\r\nimport { AxisOrder, Geometry, PlaneAltitudeEvaluator } from \"../Geometry\";\r\nimport { IStrokeHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../geometry3d/Matrix3d\";\r\nimport { Plane3dByOriginAndUnitNormal } from \"../geometry3d/Plane3dByOriginAndUnitNormal\";\r\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { Range3d } from \"../geometry3d/Range\";\r\nimport { Ray3d } from \"../geometry3d/Ray3d\";\r\nimport { Transform } from \"../geometry3d/Transform\";\r\nimport { VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveIntervalRole, CurveLocationDetail, CurveSearchStatus } from \"./CurveLocationDetail\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { AppendPlaneIntersectionStrokeHandler } from \"./internalContexts/AppendPlaneIntersectionStrokeHandler\";\r\nimport { ClosestPointStrokeHandler } from \"./internalContexts/ClosestPointStrokeHandler\";\r\nimport { CurveLengthContext } from \"./internalContexts/CurveLengthContext\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\nimport type { InterpolationCurve3d } from \"../bspline/InterpolationCurve3d\";\r\nimport type { AkimaCurve3d } from \"../bspline/AkimaCurve3d\";\r\nimport type { BSplineCurve3d } from \"../bspline/BSplineCurve\";\r\nimport type { BezierCurve3d } from \"../bspline/BezierCurve3d\";\r\nimport type { CurveChainWithDistanceIndex } from \"./CurveChainWithDistanceIndex\";\r\nimport type { DirectSpiral3d } from \"./spiral/DirectSpiral3d\";\r\nimport type { IntegratedSpiral3d } from \"./spiral/IntegratedSpiral3d\";\r\nimport type { Arc3d } from \"./Arc3d\";\r\nimport type { LineSegment3d } from \"./LineSegment3d\";\r\nimport type { OffsetOptions } from \"./internalContexts/PolygonOffsetContext\";\r\n\r\n/** Describes the concrete type of a [[CurvePrimitive]]. Each type name maps to a specific subclass and can be used for type-switching in conditional statements.\r\n * - \"arc\" => [[Arc3d]]\r\n * - \"lineSegment\" => [[LineSegment3d]]\r\n * - \"lineString\" => [[LineString3d]]\r\n * - \"bsplineCurve\" => [[BSplineCurve3dBase]] which is an intermediate class implemented by [[BSplineCurve3d]] and [[BSplineCurve3dH]]\r\n * - \"bezierCurve\" => [[BezierCurveBase]] which is an intermediate class implemented by [[BezierCurve3d]] and [[BezierCurve3dH]]\r\n * - \"transitionSpiral\" => [[TransitionSpiral3d]]\r\n * - \"curveChainWithDistanceIndex\" => [[CurveChainWithDistanceIndex]]\r\n * @see [[AnyCurvePrimitive]] for a union type that supports compile-time type narrowing.\r\n * @public\r\n */\r\nexport type CurvePrimitiveType = \"arc\" | \"lineSegment\" | \"lineString\" | \"bsplineCurve\" | \"bezierCurve\" | \"transitionSpiral\" | \"curveChainWithDistanceIndex\" | \"interpolationCurve\" | \"akimaCurve\";\r\n\r\n/** Union type for subclasses of [[CurvePrimitive]]. Specific subclasses can be discriminated at compile- or run-time using [[CurvePrimitive.curvePrimitiveType]].\r\n * @public\r\n */\r\nexport type AnyCurvePrimitive = Arc3d | LineSegment3d | LineString3d | BSplineCurve3d | BezierCurve3d | DirectSpiral3d | IntegratedSpiral3d | CurveChainWithDistanceIndex | InterpolationCurve3d | AkimaCurve3d;\r\n\r\n/** function signature for callback which announces a pair of numbers, such as a fractional interval, along with a containing CurvePrimitive.\r\n * @public\r\n */\r\nexport type AnnounceNumberNumberCurvePrimitive = (a0: number, a1: number, cp: CurvePrimitive) => void;\r\n/** Function signature for a callback which announces a pair of numbers\r\n * @public\r\n */\r\n\r\nexport type AnnounceNumberNumber = (a0: number, a1: number) => void;\r\n/** Function signature for a callback which announces a curve primitive\r\n * @public\r\n */\r\nexport type AnnounceCurvePrimitive = (cp: CurvePrimitive) => void;\r\n\r\n/**\r\n * A curve primitive is bounded\r\n * A curve primitive maps fractions in 0..1 to points in space.\r\n * As the fraction proceeds from 0 towards 1, the point moves \"forward\" along the curve.\r\n * True distance along the curve is not always strictly proportional to fraction.\r\n * * LineSegment3d always has proportional fraction and distance\r\n * * an Arc3d which is true circular has proportional fraction and distance\r\n * * A LineString3d is not proportional (except for special case of all segments of equal length)\r\n * * A Spiral3d is proportional\r\n * * A BsplineCurve3d is only proportional for special cases.\r\n *\r\n * For fractions outside 0..1, the curve primitive class may either (a) return the near endpoint or (b) evaluate an extended curve.\r\n * @public\r\n */\r\nexport abstract class CurvePrimitive extends GeometryQuery {\r\n /** String name for schema properties */\r\n public readonly geometryCategory = \"curvePrimitive\";\r\n /** String name for schema properties */\r\n public abstract readonly curvePrimitiveType: CurvePrimitiveType;\r\n\r\n protected constructor() { super(); }\r\n /**\r\n * data attached during stroking for facets.\r\n */\r\n public strokeData?: StrokeCountMap;\r\n /**\r\n * data attached in curve cutting.\r\n * @internal\r\n */\r\n public startCut?: CurveLocationDetail;\r\n /**\r\n * data attached in curve cutting.\r\n * @internal\r\n */\r\n public endCut?: CurveLocationDetail;\r\n /**\r\n * data attached by various algorithms (e.g. Region booleans)\r\n */\r\n public parent?: any;\r\n\r\n /** Return the point (x,y,z) on the curve at fractional position.\r\n * @param fraction fractional position along the geometry.\r\n * @returns Returns a point on the curve.\r\n */\r\n public abstract fractionToPoint(fraction: number, result?: Point3d): Point3d;\r\n /** Return the point (x,y,z) and derivative on the curve at fractional position.\r\n *\r\n * * Note that this derivative is \"derivative of xyz with respect to fraction.\"\r\n * * this derivative shows the speed of the \"fractional point\" moving along the curve.\r\n * * this is not generally a unit vector. use fractionToPointAndUnitTangent for a unit vector.\r\n * @param fraction fractional position along the geometry.\r\n * @returns Returns a ray whose origin is the curve point and direction is the derivative with respect to the fraction.\r\n */\r\n public abstract fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d;\r\n /**\r\n * Returns a ray whose origin is the curve point and direction is the unit tangent.\r\n * @param fraction fractional position on the curve\r\n * @param result optional preallocated ray.\r\n */\r\n public fractionToPointAndUnitTangent(fraction: number, result?: Ray3d): Ray3d {\r\n const ray = this.fractionToPointAndDerivative(fraction, result);\r\n ray.trySetDirectionMagnitudeInPlace(1.0);\r\n return ray;\r\n }\r\n /**\r\n * Returns the (absolute) curvature magnitude.\r\n * * Base implementation in CurvePrimitive computes curvature from the first and second derivative vectors.\r\n * @param fraction fractional position on the curve\r\n */\r\n public fractionToCurvature(fraction: number): number | undefined {\r\n const data = this.fractionToPointAnd2Derivatives(fraction)!;\r\n const cross = data.vectorU.crossProduct(data.vectorV);\r\n const a = cross.magnitude();\r\n const b = data.vectorU.magnitude();\r\n return Geometry.conditionalDivideFraction(a, b * b * b);\r\n }\r\n\r\n /** Return a plane with\r\n *\r\n * * origin at fractional position along the curve\r\n * * vectorU is the first derivative, i.e. tangent vector with length equal to the rate of change with respect to the fraction.\r\n * * vectorV is the second derivative, i.e.derivative of vectorU.\r\n */\r\n public abstract fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors | undefined;\r\n\r\n /** Construct a frenet frame:\r\n * * origin at the point on the curve\r\n * * x axis is unit vector along the curve (tangent)\r\n * * y axis is perpendicular and in the plane of the osculating circle.\r\n * * z axis perpendicular to those.\r\n */\r\n public fractionToFrenetFrame(fraction: number, result?: Transform): Transform | undefined {\r\n const plane = this.fractionToPointAnd2Derivatives(fraction);\r\n if (!plane) return undefined;\r\n let axes = Matrix3d.createRigidFromColumns(plane.vectorU, plane.vectorV, AxisOrder.XYZ);\r\n if (axes)\r\n return Transform.createRefs(plane.origin, axes, result);\r\n // 2nd derivative not distinct -- do arbitrary headsUP ...\r\n const perpVector = Matrix3d.createPerpendicularVectorFavorXYPlane(plane.vectorU, plane.vectorV);\r\n axes = Matrix3d.createRigidFromColumns(plane.vectorU, perpVector, AxisOrder.XYZ);\r\n if (axes)\r\n return Transform.createRefs(plane.origin, axes, result);\r\n return undefined;\r\n }\r\n\r\n /** Construct signed distance from a point on the curve to its center of curvature (in xy only).\r\n * * Positive is to the left of the xy tangent.\r\n * * negative is to the right of the xy tangent.\r\n * * linear curve is 0.\r\n */\r\n public fractionToSignedXYRadiusOfCurvature(fraction: number): number {\r\n const plane = this.fractionToPointAnd2Derivatives(fraction);\r\n if (!plane)\r\n return 0.0;\r\n const cross = plane.vectorU.crossProductXY(plane.vectorV);\r\n const b = plane.vectorU.magnitude();\r\n if (b === 0.0)\r\n return 0.0;\r\n const r = Geometry.conditionalDivideCoordinate(b * b * b, cross);\r\n if (r !== undefined)\r\n return r;\r\n return 0.0;\r\n }\r\n /**\r\n * Construct a point extrapolated along tangent at fraction.\r\n * @param fraction fractional position on the primitive\r\n * @param distance (signed) distance to move on the tangent.\r\n */\r\n public fractionAndDistanceToPointOnTangent(fraction: number, distance: number): Point3d {\r\n const ray = this.fractionToPointAndUnitTangent(fraction);\r\n return ray.fractionToPoint(distance);\r\n }\r\n\r\n /**\r\n * return the length of the curve.\r\n * * Curve length is always positive.\r\n */\r\n public curveLength(): number {\r\n const context = new CurveLengthContext();\r\n this.emitStrokableParts(context);\r\n return context.getSum();\r\n }\r\n /**\r\n * Returns a (high accuracy) length of the curve between fractional positions\r\n * * Curve length is always positive.\r\n * * Default implementation applies a generic gaussian integration.\r\n * * Most curve classes (certainly LineSegment, LineString, Arc) are expected to provide efficient implementations.\r\n */\r\n public curveLengthBetweenFractions(fraction0: number, fraction1: number): number {\r\n if (fraction0 === fraction1)\r\n return 0.0;\r\n const scale = this.getFractionToDistanceScale();\r\n if (scale !== undefined) {\r\n // We are in luck! simple proportions determine it all !!!\r\n // (for example, a LineSegment3d or a circular arc)\r\n const totalLength = this.curveLength();\r\n return Math.abs((fraction1 - fraction0) * totalLength);\r\n }\r\n const context = new CurveLengthContext(fraction0, fraction1);\r\n this.emitStrokableParts(context);\r\n return Math.abs(context.getSum());\r\n }\r\n\r\n /**\r\n * Returns a (high accuracy) range of the curve between fractional positions\r\n * * Default implementation returns teh range of the curve from clonePartialCurve\r\n */\r\n public rangeBetweenFractions(fraction0: number, fraction1: number, transform?: Transform): Range3d {\r\n return this.rangeBetweenFractionsByClone (fraction0, fraction1, transform);\r\n }\r\n\r\n /**\r\n * Returns a (high accuracy) range of the curve between fractional positions\r\n * * Default implementation returns teh range of the curve from clonePartialCurve\r\n */\r\n public rangeBetweenFractionsByClone(fraction0: number, fraction1: number, transform?: Transform): Range3d {\r\n if (fraction0 === fraction1)\r\n return Range3d.create (this.fractionToPoint (fraction0));\r\n const fragment = this.clonePartialCurve (fraction0, fraction1);\r\n if (fragment)\r\n return fragment.range (transform);\r\n return Range3d.createNull ();\r\n }\r\n\r\n /**\r\n * Returns an approximate range based on a fixed number of evaluations\r\n * * Default implementation returns a range determined by evaluating a specified number of points on the curve.\r\n * * Optional evaluate again at interval midpoints and extrapolate any increase\r\n * * For a smooth curve, Richardson extrapolation suggests each subdivision moves 3/4 of the way to final. So extrapolationFactor\r\n * of 1/3 gets speculatively moves closer to the tight range, and larger multipliers increase confidence in being safely larger.\r\n * @param fraction0 start fraction for evaluation\r\n * @param fraction1 end fraction for evaluation\r\n * @param count number of points to evaluate\r\n * @param extrapolationFactor if positive, evaluate again at interval midpoints and apply this fraction multiplier to any increase in size.\r\n */\r\n public rangeBetweenFractionsByCount(fraction0: number, fraction1: number, count: number, transform?: Transform,\r\n extrapolationFactor: number = 0.0): Range3d {\r\n const range = Range3d.createNull ();\r\n const workPoint = Point3d.create ();\r\n range.extendPoint (this.startPoint (workPoint));\r\n range.extendPoint (this.endPoint (workPoint));\r\n // Evaluate at count fractions (fraction0 + i * fractionStep)\r\n const evaluateSteps = (fractionA: number, fractionStep: number, countA: number) => {\r\n let f = fractionA;\r\n for (let i = 0; i < countA; i++, f += fractionStep){\r\n this.fractionToPoint (f, workPoint);\r\n if (transform)\r\n range.extendTransformedPoint (transform, workPoint);\r\n else\r\n range.extendPoint (workPoint);\r\n }\r\n };\r\n const interiorCount = count - 2;\r\n if (interiorCount > 0){\r\n const localFraction0 = 1.0 / (interiorCount + 1);\r\n const globalFractionStep = localFraction0 * (fraction1 - fraction0);\r\n evaluateSteps (fraction0 + globalFractionStep, globalFractionStep, interiorCount);\r\n }\r\n if (extrapolationFactor > 0.0){\r\n // Evaluate at midpoints. Where this makes the range larger, apply extrapolationFactor to move it to safer excess value.\r\n // same interior step, but shift to interval midpoints:.\r\n const baseRange = range.clone ();\r\n const interiorCount1 = interiorCount + 1;\r\n const localFraction0 = 0.5 / interiorCount1; // we only evaluate at new midpoints.\r\n const globalFractionStep = 2 * localFraction0 * (fraction1 - fraction0); // same as above, but avoids special logic for interiorCount = 0\r\n evaluateSteps (fraction0 + globalFractionStep * 0.5, globalFractionStep, interiorCount1);\r\n range.extendWhenLarger (baseRange, extrapolationFactor);\r\n }\r\n return range;\r\n }\r\n\r\n /**\r\n *\r\n * * Run an integration (with a default gaussian quadrature) with a fixed fractional step\r\n * * This is typically called by specific curve type implementations of curveLengthBetweenFractions.\r\n * * For example, in Arc3d implementation of curveLengthBetweenFractions:\r\n * * If the Arc3d is true circular, it the arc is true circular, use the direct `arcLength = radius * sweepRadians`\r\n * * If the Arc3d is not true circular, call this method with an interval count appropriate to eccentricity and sweepRadians.\r\n * @returns Returns an integral estimated by numerical quadrature between the fractional positions.\r\n * @param fraction0 start fraction for integration\r\n * @param fraction1 end fraction for integration\r\n * @param numInterval number of quadrature intervals\r\n */\r\n public curveLengthWithFixedIntervalCountQuadrature(fraction0: number, fraction1: number, numInterval: number, numGauss: number = 5): number {\r\n if (fraction0 > fraction1) {\r\n const fSave = fraction0;\r\n fraction0 = fraction1;\r\n fraction1 = fSave;\r\n }\r\n const context = new CurveLengthContext(fraction0, fraction1, numGauss);\r\n context.announceIntervalForUniformStepStrokes(this, numInterval, fraction0, fraction1);\r\n return Math.abs(context.getSum());\r\n }\r\n\r\n /**\r\n *\r\n * * (Attempt to) find a position on the curve at a signed distance from start fraction.\r\n * * Return the position as a CurveLocationDetail.\r\n * * In the `CurveLocationDetail`, record:\r\n * * `fraction` = fractional position\r\n * * `point` = coordinates of the point\r\n * * `a` = (signed!) distance moved. If `allowExtension` is false and the move reached the start or end of the curve, this distance is smaller than the requested signedDistance.\r\n * * `curveSearchStatus` indicates one of:\r\n * * `error` (unusual) computation failed not supported for this curve.\r\n * * `success` full movement completed\r\n * * `stoppedAtBoundary` partial movement completed. This can be due to either\r\n * * `allowExtension` parameter sent as `false`\r\n * * the curve type (e.g. bspline) does not support extended range.\r\n * * if `allowExtension` is true, movement may still end at the startPoint or end point for curves that do not support extended geometry (specifically bsplines)\r\n * * if the curve returns a value (i.e. not `undefined`) for `curve.getFractionToDistanceScale()`, the base class carries out the computation\r\n * and returns a final location.\r\n * * LineSegment3d relies on this.\r\n * * If the curve does not implement the computation or the curve has zero length, the returned `CurveLocationDetail` has\r\n * * `fraction` = the value of `startFraction`\r\n * * `point` = result of `curve.fractionToPoint(startFraction)`\r\n * * `a` = 0\r\n * * `curveStartState` = `CurveSearchStatus.error`\r\n * @param startFraction fractional position where the move starts\r\n * @param signedDistance distance to move. Negative distance is backwards in the fraction space\r\n * @param allowExtension if true, all the move to go beyond the startPoint or endpoint of the curve. If false, do not allow movement beyond the startPoint or endpoint\r\n * @param result optional result.\r\n * @returns A CurveLocationDetail annotated as above. Note that if the curve does not support the calculation, there is still a result which contains the point at the input startFraction, with failure indicated in the `curveStartState` member\r\n */\r\n public moveSignedDistanceFromFraction(startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail): CurveLocationDetail {\r\n const scale = this.getFractionToDistanceScale();\r\n if (scale !== undefined) {\r\n // We are in luck! simple proportions determine it all !!!\r\n // (for example, a LineSegment3d or a circular arc)\r\n const totalLength = this.curveLength();\r\n const signedFractionMove = Geometry.conditionalDivideFraction(signedDistance, totalLength);\r\n if (signedFractionMove === undefined) {\r\n return CurveLocationDetail.createCurveFractionPointDistanceCurveSearchStatus(\r\n this, startFraction, this.fractionToPoint(startFraction), 0.0, CurveSearchStatus.error);\r\n }\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(\r\n allowExtension,\r\n this,\r\n startFraction,\r\n startFraction + signedFractionMove,\r\n signedDistance,\r\n result);\r\n }\r\n return this.moveSignedDistanceFromFractionGeneric(startFraction, signedDistance, allowExtension, result);\r\n }\r\n /**\r\n * Generic algorithm to search for point at signed distance from a fractional startPoint.\r\n * * This will work for well for smooth curves.\r\n * * Curves with tangent or other low-order-derivative discontinuities may need to implement specialized algorithms.\r\n * * We need to find an endFraction which is the end-of-interval (usually upper) limit of integration of the tangent magnitude from startFraction to endFraction\r\n * * That integral is a function of endFraction.\r\n * * The derivative of that integral with respect to end fraction is the tangent magnitude at end fraction.\r\n * * Use that function and (easily evaluated!) derivative for a Newton iteration\r\n * * TO ALL WHO HAVE FUZZY MEMORIES OF CALCULUS CLASS: \"The derivative of the integral wrt upper limit is the value of the integrand there\" is the\r\n * fundamental theorem of integral calculus !!! The fundamental theorem is not just an abstraction !!! It is being used\r\n * here in its barest possible form !!!\r\n * * See https://en.wikipedia.org/wiki/Fundamental_theorem_of_calculus\r\n * @param startFraction\r\n * @param signedDistance\r\n * @param _allowExtension\r\n * @param result\r\n */\r\n protected moveSignedDistanceFromFractionGeneric(startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail): CurveLocationDetail {\r\n let limitFraction: number;\r\n const slackFraction = 0.1; // slack to use when integration would otherwise have no room to work\r\n if (signedDistance === 0.0)\r\n return CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result); // no movement, just evaluate at startFraction\r\n if (signedDistance > 0.0) {\r\n limitFraction = 1.0;\r\n if (startFraction >= 1.0) {\r\n const newStartFraction = 1.0 - slackFraction;\r\n signedDistance += this.curveLengthBetweenFractions(newStartFraction, startFraction);\r\n startFraction = newStartFraction;\r\n }\r\n } else { // signedDistance < 0.0\r\n limitFraction = 0.0;\r\n if (startFraction <= 0.0) {\r\n const newStartFraction = 0.0 + slackFraction;\r\n signedDistance -= this.curveLengthBetweenFractions(startFraction, newStartFraction);\r\n startFraction = newStartFraction;\r\n }\r\n }\r\n\r\n const availableLength = this.curveLengthBetweenFractions(startFraction, limitFraction);\r\n assert(availableLength > 0.0);\r\n const absDistance = Math.abs(signedDistance);\r\n if (availableLength < absDistance && !allowExtension)\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, limitFraction, signedDistance, result);\r\n\r\n const fractionStep = Geometry.conditionalDivideCoordinate(absDistance, availableLength);\r\n if (undefined === fractionStep) {\r\n // no available length!\r\n result = CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);\r\n result.curveSearchStatus = CurveSearchStatus.error;\r\n return result;\r\n }\r\n\r\n const directionFactor = signedDistance < 0.0 ? -1.0 : 1.0;\r\n let fractionB = Geometry.interpolate(startFraction, fractionStep, limitFraction);\r\n let fractionA = startFraction;\r\n let distanceA = 0.0;\r\n const tol = 1.0e-12 * availableLength;\r\n let numConverged = 0;\r\n const tangent = Ray3d.createXAxis();\r\n // on each loop entry:\r\n // fractionA is the most recent endOfInterval. (It may have been reached by a mixture of forward and backward step.)\r\n // distanceA is the distance to (the point at) fractionA\r\n // fractionB is the next end fraction\r\n for (let iterations = 0; iterations < 10; iterations++) {\r\n const distanceAB = this.curveLengthBetweenFractions(fractionA, fractionB);\r\n const directionAB = fractionB > fractionA ? directionFactor : -directionFactor;\r\n const distance0B = distanceA + directionAB * distanceAB;\r\n const distanceError = absDistance - distance0B;\r\n if (Math.abs(distanceError) < tol) {\r\n numConverged++;\r\n if (numConverged > 1)\r\n break;\r\n } else {\r\n numConverged = 0;\r\n }\r\n this.fractionToPointAndDerivative(fractionB, tangent);\r\n const tangentMagnitude = tangent.direction.magnitude();\r\n fractionA = fractionB;\r\n fractionB = fractionA + directionFactor * distanceError / tangentMagnitude;\r\n if (fractionA === fractionB) { // YES -- that is an exact equality test. When it happens, there's no need for confirming with another iteration.\r\n numConverged = 100;\r\n break;\r\n }\r\n distanceA = distance0B;\r\n }\r\n if (numConverged > 1)\r\n return CurveLocationDetail.createConditionalMoveSignedDistance(allowExtension, this, startFraction, fractionB, signedDistance, result);\r\n\r\n result = CurveLocationDetail.createCurveEvaluatedFraction(this, startFraction, result);\r\n result.curveSearchStatus = CurveSearchStatus.error;\r\n return result;\r\n }\r\n\r\n /**\r\n * * Returns true if the curve's fraction queries extend beyond 0..1.\r\n * * Base class default implementation returns false.\r\n * * These class (and perhaps others in the future) will return true:\r\n * * LineSegment3d\r\n * * LineString3d\r\n * * Arc3d\r\n */\r\n public get isExtensibleFractionSpace(): boolean { return false; }\r\n /**\r\n * Compute a length which may be an fast approximation to the true length.\r\n * This is expected to be either (a) exact or (b) larger than the actual length, but by no more than\r\n * a small multiple, perhaps up to PI/2, but commonly much closer to 1.\r\n *\r\n * * An example use of this is for setting a tolerance which is a small multiple of the curve length.\r\n * * Simple line, circular arc, and transition spiral may return exact length\r\n * * Ellipse may return circumference of some circle or polygon that encloses the ellipse.\r\n * * bspline curve may return control polygon length\r\n * *\r\n */\r\n public abstract quickLength(): number;\r\n /** Search for the curve point that is closest to the spacePoint.\r\n *\r\n * * If the space point is exactly on the curve, this is the reverse of fractionToPoint.\r\n * * Since CurvePrimitive should always have start and end available as candidate points, this method should always succeed\r\n * @param spacePoint point in space\r\n * @param extend true to extend the curve (if possible), false for no extend, single CurveExtendOptions (for both directions), or array of distinct CurveExtendOptions for start and end.\r\n * @returns Returns a CurveLocationDetail structure that holds the details of the close point.\r\n */\r\n public closestPoint(spacePoint: Point3d, extend: VariantCurveExtendParameter): CurveLocationDetail | undefined {\r\n const strokeHandler = new ClosestPointStrokeHandler(spacePoint, extend);\r\n this.emitStrokableParts(strokeHandler);\r\n return strokeHandler.claimResult();\r\n }\r\n /**\r\n * Find intervals of this curvePrimitive that are interior to a clipper\r\n * @param clipper clip structure (e.g. clip planes)\r\n * @param announce (optional) function to be called announcing fractional intervals\" ` announce(fraction0, fraction1, curvePrimitive)`\r\n * @returns true if any \"in\" segments are announced.\r\n */\r\n public announceClipIntervals(_clipper: Clipper, _announce?: AnnounceNumberNumberCurvePrimitive): boolean {\r\n // DEFAULT IMPLEMENTATION -- no interior parts\r\n return false;\r\n }\r\n\r\n /** Return a deep clone. */\r\n public abstract override clone(): CurvePrimitive;\r\n\r\n /** Return a transformed deep clone. */\r\n public abstract override cloneTransformed(transform: Transform): CurvePrimitive | undefined;\r\n\r\n /** Return (if possible) a curve primitive which is a portion of this curve.\r\n * @param _fractionA [in] start fraction\r\n * @param _fractionB [in] end fraction\r\n */\r\n public clonePartialCurve(_fractionA: number, _fractionB: number): CurvePrimitive | undefined {\r\n return undefined;\r\n }\r\n /**\r\n * * If the curve primitive has distance-along-curve strictly proportional to curve fraction, return the scale factor.\r\n * * If distance-along-the-curve is not proportional, return undefined.\r\n * * When defined, the scale factor is always the length of the curve.\r\n * * This scale factor is typically available for these curve types:\r\n * * * All `LineSegment3d`\r\n * * * Arc3d which is a true circular arc (axes perpendicular and of equal length).\r\n * * * CurveChainWithDistanceIndex\r\n * * This scale factor is undefined for these curve types:\r\n * * * Arc3d which is a true ellipse, i.e. unequal lengths of defining vectors or non-perpendicular defining vectors.\r\n * * * bspline and bezier curves\r\n * @returns scale factor or undefined\r\n */\r\n public getFractionToDistanceScale(): number | undefined { return undefined; }\r\n\r\n /** Reverse the curve's data so that its fractional stroking moves in the opposite direction. */\r\n public abstract reverseInPlace(): void;\r\n /**\r\n * Compute intersections with a plane.\r\n * * The intersections are appended to the result array.\r\n * * The base class implementation emits strokes to an AppendPlaneIntersectionStrokeHandler object, which uses a Newton iteration to get\r\n * high-accuracy intersection points within strokes.\r\n * * Derived classes should override this default implementation if there are easy analytic solutions.\r\n * * Derived classes are free to implement extended intersections (e.g. arc!!!)\r\n * @param plane The plane to be intersected.\r\n * @param result Array to receive intersections\r\n * @returns Return the number of CurveLocationDetail's added to the result array.\r\n */\r\n public appendPlaneIntersectionPoints(plane: PlaneAltitudeEvaluator, result: CurveLocationDetail[]): number {\r\n const strokeHandler = new AppendPlaneIntersectionStrokeHandler(plane, result);\r\n const n0 = result.length;\r\n this.emitStrokableParts(strokeHandler);\r\n return result.length - n0;\r\n }\r\n /**\r\n * Examine contents of an array of CurveLocationDetail.\r\n * Filter the intersections according to the parameters.\r\n * @param allowExtend if false, remove points on the extension.\r\n * @param applySnappedCoordinates if true, change the stored fractions and coordinates to exact end values. Otherwise\r\n * use the exact values only for purpose of updating the curveIntervalRole.\r\n * @param startEndFractionTolerance if nonzero, adjust fraction to 0 or 1 with this tolerance.\r\n * @param startEndXYZTolerance if nonzero, adjust to endpoint with this tolerance.\r\n * @internal\r\n */\r\n public static snapAndRestrictDetails(\r\n details: CurveLocationDetail[],\r\n allowExtend: boolean = true,\r\n applySnappedCoordinates: boolean = false,\r\n startEndFractionTolerance = Geometry.smallAngleRadians,\r\n startEndXYZTolerance = Geometry.smallMetricDistance) {\r\n const n0 = details.length;\r\n let acceptIndex = 0;\r\n const point0 = Point3d.create();\r\n const point1 = Point3d.create();\r\n let snappedCoordinates: Point3d | undefined;\r\n for (let candidateIndex = 0; candidateIndex < n0; candidateIndex++) {\r\n snappedCoordinates = undefined;\r\n const detail = details[candidateIndex];\r\n let fraction = detail.fraction;\r\n let accept = allowExtend || Geometry.isIn01(fraction);\r\n if (detail.curve) {\r\n detail.curve.startPoint(point0);\r\n detail.curve.endPoint(point1);\r\n }\r\n\r\n if (startEndFractionTolerance > 0) {\r\n if (Math.abs(fraction) < startEndFractionTolerance) {\r\n fraction = 0.0;\r\n accept = true;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point0;\r\n }\r\n if (Math.abs(fraction - 1.0) < startEndFractionTolerance) {\r\n fraction = 1.0;\r\n accept = true;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point1;\r\n if (detail.curve)\r\n snappedCoordinates = detail.curve.startPoint(point1);\r\n }\r\n }\r\n if (startEndXYZTolerance > 0 && detail.curve !== undefined) {\r\n // REMARK: always test both endpoints. If there is a cyclic fraction space, an intersection marked as \"after\" the end might have wrapped all the way to the beginning.\r\n if (detail.point.distance(point0) <= startEndXYZTolerance) {\r\n fraction = 0.0;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point0;\r\n } else if (detail.point.distance(point1) <= startEndXYZTolerance) {\r\n fraction = 1.0;\r\n detail.intervalRole = CurveIntervalRole.isolatedAtVertex;\r\n snappedCoordinates = point1;\r\n }\r\n }\r\n if (accept) {\r\n if (applySnappedCoordinates) {\r\n detail.fraction = fraction;\r\n if (snappedCoordinates !== undefined)\r\n detail.point.setFrom(snappedCoordinates);\r\n }\r\n if (acceptIndex < candidateIndex)\r\n details[acceptIndex] = detail;\r\n acceptIndex++;\r\n }\r\n\r\n }\r\n if (acceptIndex < n0)\r\n details.length = acceptIndex;\r\n\r\n }\r\n\r\n /** Ask if the curve is within tolerance of a plane.\r\n * @returns Returns true if the curve is completely within tolerance of the plane.\r\n */\r\n public abstract isInPlane(plane: Plane3dByOriginAndUnitNormal): boolean;\r\n /** return the startPoint of the primitive. The default implementation returns fractionToPoint (0.0) */\r\n public startPoint(result?: Point3d): Point3d { return this.fractionToPoint(0.0, result); }\r\n /** return the end point of the primitive. The default implementation returns fractionToPoint(1.0) */\r\n public endPoint(result?: Point3d): Point3d { return this.fractionToPoint(1.0, result); }\r\n /** Add strokes to caller-supplied linestring */\r\n public abstract emitStrokes(dest: LineString3d, options?: StrokeOptions): void;\r\n /** Ask the curve to announce points and simple subcurve fragments for stroking.\r\n * See IStrokeHandler for description of the sequence of the method calls.\r\n */\r\n public abstract emitStrokableParts(dest: IStrokeHandler, options?: StrokeOptions): void;\r\n /**\r\n * return the stroke count required for given options.\r\n * * This returns a single number\r\n * * See computeComponentStrokeCountForOptions to get structured per-component counts and fraction mappings.\r\n * @param options StrokeOptions that determine count\r\n */\r\n public abstract computeStrokeCountForOptions(options?: StrokeOptions): number;\r\n\r\n /**\r\n * attach StrokeCountMap structure to this primitive (and recursively to any children)\r\n * * Base class implementation (here) gets the simple count from computeStrokeCountForOptions and attaches it.\r\n * * LineString3d, arc3d, BezierCurve3d, BezierCurve3dH accept that default.\r\n * * Subdivided primitives (linestring, bspline curve) implement themselves and attach a StrokeCountMap containing the\r\n * total count, and also containing an array of StrokeCountMap per component.\r\n * * For CurvePrimitiveWithDistanceIndex, the top level gets (only) a total count, and each child gets\r\n * its own StrokeCountMap with appropriate structure.\r\n * @param options StrokeOptions that determine count\r\n * @param parentStrokeMap optional map from parent. Its count, curveLength, and a1 values are increased with count and distance from this primitive.\r\n * @return sum of `a0+this.curveLength()`, for use as `a0` of successor in chain.\r\n */\r\n public computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentMap?: StrokeCountMap) {\r\n const n = this.computeStrokeCountForOptions(options);\r\n const a = this.curveLength();\r\n CurvePrimitive.installStrokeCountMap(\r\n this,\r\n StrokeCountMap.createWithCurvePrimitive(this, n, a, 0, a),\r\n parentMap);\r\n }\r\n\r\n /**\r\n * * evaluate strokes at fractions indicated in a StrokeCountMap.\r\n * * Base class implementation (here) gets the simple count from computeStrokeCountForOptions and strokes at uniform fractions.\r\n * * LineString3d, arc3d, BezierCurve3d, BezierCurve3dH accept that default.\r\n * * Subdivided primitives (linestring, bspline curve) implement themselves and evaluate within components.\r\n * * CurvePrimitiveWithDistanceIndex recurses to its children.\r\n * * if packedFraction and packedDerivative arrays are present in the LineString3d, fill them.\r\n * @param map = stroke count data.\r\n * @param linestring = receiver linestring.\r\n * @return number of strokes added. 0 if any errors matching the map to the curve primitive.\r\n */\r\n public addMappedStrokesToLineString3D(map: StrokeCountMap, linestring: LineString3d): number {\r\n const numPoint0 = linestring.numPoints();\r\n if (map.primitive && map.primitive === this && map.numStroke > 0) {\r\n for (let i = 0; i <= map.numStroke; i++) {\r\n const fraction = i / map.numStroke;\r\n linestring.appendFractionToPoint(this, fraction);\r\n }\r\n }\r\n return linestring.numPoints() - numPoint0;\r\n }\r\n\r\n /**\r\n * final install step to save curveMap in curve. If parentMap is given, update its length, count, and a1 fields\r\n * @param curve curve to receive the annotation\r\n * @param map\r\n * @param parentMap\r\n */\r\n public static installStrokeCountMap(curve: CurvePrimitive, curveMap: StrokeCountMap, parentMap?: StrokeCountMap) {\r\n if (parentMap)\r\n parentMap.addToCountAndLength(curveMap.numStroke, curveMap.curveLength);\r\n curve.strokeData = curveMap;\r\n }\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * * This DEFAULT simply pushes `this` to the collectorArray.\r\n * * CurvePrimitiveWithDistanceIndex optionally collects its members.\r\n * @param collectorArray array to receive primitives (pushed -- the array is not cleared)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true, it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitivesGo(collectorArray: CurvePrimitive[], _smallestPossiblePrimitives: boolean, _explodeLinestrings: boolean = false) {\r\n collectorArray.push(this);\r\n }\r\n\r\n /**\r\n * Return an array containing only the curve primitives.\r\n * * This DEFAULT captures the default result construction and calls collectCurvePrimitivesGo\r\n * @param collectorArray optional array to receive primitives. If present, new primitives are ADDED (without clearing the array.)\r\n * @param smallestPossiblePrimitives if false, CurvePrimitiveWithDistanceIndex returns only itself. If true, it recurses to its (otherwise hidden) children.\r\n */\r\n public collectCurvePrimitives(collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false,\r\n explodeLinestrings: boolean = false): CurvePrimitive[] {\r\n const results: CurvePrimitive[] = collectorArray === undefined ? [] : collectorArray;\r\n this.collectCurvePrimitivesGo(results, smallestPossiblePrimitives, explodeLinestrings);\r\n return results;\r\n }\r\n\r\n /**\r\n * Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).\r\n * * No attempt is made to join the offsets of smaller constituent primitives. To construct a fully joined offset\r\n * for an aggregate instance (e.g., LineString3d, CurveChainWithDistanceIndex), use RegionOps.constructCurveXYOffset() instead.\r\n * @param offsetDistanceOrOptions offset distance (positive to left of the instance curve), or options object\r\n */\r\n public abstract constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): CurvePrimitive | CurvePrimitive[] | undefined;\r\n}\r\n"]}
|
|
@@ -229,9 +229,18 @@ export declare class LineString3d extends CurvePrimitive implements BeJSONFuncti
|
|
|
229
229
|
/**
|
|
230
230
|
* Convert a segment index and local fraction to a global fraction.
|
|
231
231
|
* @param index index of segment being evaluated
|
|
232
|
-
* @param localFraction local fraction within
|
|
232
|
+
* @param localFraction local fraction in [0,1] within the segment
|
|
233
|
+
* @return global fraction f in [0,1] such that the segment is parameterized by index/N <= f <= (index+1)/N.
|
|
233
234
|
*/
|
|
234
235
|
segmentIndexAndLocalFractionToGlobalFraction(index: number, localFraction: number): number;
|
|
236
|
+
/**
|
|
237
|
+
* Convert a global fraction to a segment index and local fraction.
|
|
238
|
+
* @param globalFraction a fraction f in [0,1] in the linestring parameterization, where the i_th segment (0 <= i < N) is parameterized by i/N <= f <= (i+1)/N.
|
|
239
|
+
*/
|
|
240
|
+
globalFractionToSegmentIndexAndLocalFraction(globalFraction: number): {
|
|
241
|
+
index: number;
|
|
242
|
+
fraction: number;
|
|
243
|
+
};
|
|
235
244
|
/** Return a frenet frame, using nearby points to estimate a plane. */
|
|
236
245
|
fractionToFrenetFrame(fraction: number, result?: Transform): Transform;
|
|
237
246
|
/** evaluate the start point of the linestring. */
|
|
@@ -370,6 +379,7 @@ export declare class LineString3d extends CurvePrimitive implements BeJSONFuncti
|
|
|
370
379
|
*/
|
|
371
380
|
announceClipIntervals(clipper: Clipper, announce?: AnnounceNumberNumberCurvePrimitive): boolean;
|
|
372
381
|
private static _indexPoint;
|
|
382
|
+
/** @param fraction used to interpolate between points at index and index + 1 */
|
|
373
383
|
private addResolvedPoint;
|
|
374
384
|
/** Return a LineString which is a portion of this curve.
|
|
375
385
|
* * Fractions outside [0,1] extend the relevant end segment.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineString3d.d.ts","sourceRoot":"","sources":["../../../src/curve/LineString3d.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAa,eAAe,EAAY,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE3F,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,M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uGAAuG;IAChG,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IACnC,8DAA8D;IACvD,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAClC,8DAA8D;IACvD,OAAO,CAAC,EAAE,gBAAgB,CAAC;CACnC"}
|
|
@@ -522,7 +522,8 @@ class LineString3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
522
522
|
/**
|
|
523
523
|
* Convert a segment index and local fraction to a global fraction.
|
|
524
524
|
* @param index index of segment being evaluated
|
|
525
|
-
* @param localFraction local fraction within
|
|
525
|
+
* @param localFraction local fraction in [0,1] within the segment
|
|
526
|
+
* @return global fraction f in [0,1] such that the segment is parameterized by index/N <= f <= (index+1)/N.
|
|
526
527
|
*/
|
|
527
528
|
segmentIndexAndLocalFractionToGlobalFraction(index, localFraction) {
|
|
528
529
|
const numSegment = this._points.length - 1;
|
|
@@ -530,6 +531,25 @@ class LineString3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
530
531
|
return 0.0;
|
|
531
532
|
return (index + localFraction) / numSegment;
|
|
532
533
|
}
|
|
534
|
+
/**
|
|
535
|
+
* Convert a global fraction to a segment index and local fraction.
|
|
536
|
+
* @param globalFraction a fraction f in [0,1] in the linestring parameterization, where the i_th segment (0 <= i < N) is parameterized by i/N <= f <= (i+1)/N.
|
|
537
|
+
*/
|
|
538
|
+
globalFractionToSegmentIndexAndLocalFraction(globalFraction) {
|
|
539
|
+
const numSegment = this._points.length - 1;
|
|
540
|
+
if (numSegment < 1)
|
|
541
|
+
return { index: 0, fraction: 0.0 };
|
|
542
|
+
const scaledGlobalFraction = globalFraction * numSegment;
|
|
543
|
+
let segmentIndex;
|
|
544
|
+
if (globalFraction < 0)
|
|
545
|
+
segmentIndex = 0;
|
|
546
|
+
else if (globalFraction > 1)
|
|
547
|
+
segmentIndex = numSegment - 1;
|
|
548
|
+
else // globalFraction in [0,1]
|
|
549
|
+
segmentIndex = Math.floor(scaledGlobalFraction);
|
|
550
|
+
const localFraction = scaledGlobalFraction - segmentIndex;
|
|
551
|
+
return { index: segmentIndex, fraction: localFraction };
|
|
552
|
+
}
|
|
533
553
|
/** Return a frenet frame, using nearby points to estimate a plane. */
|
|
534
554
|
fractionToFrenetFrame(fraction, result) {
|
|
535
555
|
const n = this._points.length;
|
|
@@ -763,7 +783,6 @@ class LineString3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
763
783
|
if (numPoints > 1) {
|
|
764
784
|
let segmentFraction = 0;
|
|
765
785
|
let d = 0;
|
|
766
|
-
const df = 1.0 / lastIndex;
|
|
767
786
|
for (let i = 1; i < numPoints; i++) {
|
|
768
787
|
segmentFraction = spacePoint.fractionOfProjectionToLine(this._points.getPoint3dAtUncheckedPointIndex(i - 1), this._points.getPoint3dAtUncheckedPointIndex(i));
|
|
769
788
|
if (segmentFraction < 0) {
|
|
@@ -777,7 +796,7 @@ class LineString3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
777
796
|
this._points.getPoint3dAtUncheckedPointIndex(i - 1).interpolate(segmentFraction, this._points.getPoint3dAtUncheckedPointIndex(i), result.pointQ);
|
|
778
797
|
d = result.pointQ.distance(spacePoint);
|
|
779
798
|
if (d < result.a) {
|
|
780
|
-
result.setFP((i - 1
|
|
799
|
+
result.setFP(this.segmentIndexAndLocalFractionToGlobalFraction(i - 1, segmentFraction), result.pointQ, undefined, d);
|
|
781
800
|
}
|
|
782
801
|
}
|
|
783
802
|
}
|
|
@@ -1110,6 +1129,7 @@ class LineString3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
1110
1129
|
}
|
|
1111
1130
|
return status;
|
|
1112
1131
|
}
|
|
1132
|
+
/** @param fraction used to interpolate between points at index and index + 1 */
|
|
1113
1133
|
addResolvedPoint(index, fraction, dest) {
|
|
1114
1134
|
const n = this._points.length;
|
|
1115
1135
|
if (n === 0)
|
|
@@ -1150,49 +1170,36 @@ class LineString3d extends CurvePrimitive_1.CurvePrimitive {
|
|
|
1150
1170
|
if (fractionB > 1)
|
|
1151
1171
|
fractionB = 1;
|
|
1152
1172
|
}
|
|
1153
|
-
const numEdge = n - 1;
|
|
1154
|
-
let indexA; // left index of first extended/partial segment of clone
|
|
1155
|
-
let indexB; // left index of last extended/partial segment of clone
|
|
1156
1173
|
let index0, index1; // range of original vertices to copy into clone
|
|
1157
|
-
|
|
1158
|
-
|
|
1174
|
+
const localA = this.globalFractionToSegmentIndexAndLocalFraction(fractionA);
|
|
1175
|
+
const localB = this.globalFractionToSegmentIndexAndLocalFraction(fractionB);
|
|
1159
1176
|
if (fractionA < 0) {
|
|
1160
|
-
indexA = 0;
|
|
1161
1177
|
index0 = 1; // first original vertex is not in clone
|
|
1162
1178
|
}
|
|
1163
1179
|
else if (0 <= fractionA && fractionA <= 1) {
|
|
1164
|
-
|
|
1165
|
-
indexA = Math.floor(gA);
|
|
1166
|
-
localFractionA = gA - indexA;
|
|
1167
|
-
index0 = Geometry_1.Geometry.isSmallRelative(1 - localFractionA) ? indexA + 2 : indexA + 1;
|
|
1180
|
+
index0 = Geometry_1.Geometry.isSmallRelative(1 - localA.fraction) ? localA.index + 2 : localA.index + 1;
|
|
1168
1181
|
}
|
|
1169
1182
|
else { // 1 < fractionA
|
|
1170
|
-
indexA = n - 2;
|
|
1171
1183
|
index0 = n; // no original vertices in clone
|
|
1172
1184
|
}
|
|
1173
1185
|
if (fractionB < 0) {
|
|
1174
|
-
indexB = 0;
|
|
1175
1186
|
index1 = -1; // no original vertices in clone
|
|
1176
1187
|
}
|
|
1177
1188
|
else if (0 <= fractionB && fractionB <= 1) {
|
|
1178
|
-
|
|
1179
|
-
indexB = Math.floor(gB);
|
|
1180
|
-
localFractionB = gB - indexB;
|
|
1181
|
-
index1 = Geometry_1.Geometry.isSmallRelative(localFractionB) ? indexB - 1 : indexB;
|
|
1189
|
+
index1 = Geometry_1.Geometry.isSmallRelative(localB.fraction) ? localB.index - 1 : localB.index;
|
|
1182
1190
|
}
|
|
1183
1191
|
else { // 1 < fractionB
|
|
1184
|
-
indexB = n - 2;
|
|
1185
1192
|
index1 = n - 2; // last original vertex is not in clone
|
|
1186
1193
|
}
|
|
1187
1194
|
const result = LineString3d.create();
|
|
1188
|
-
this.addResolvedPoint(
|
|
1195
|
+
this.addResolvedPoint(localA.index, localA.fraction, result._points);
|
|
1189
1196
|
for (let index = index0; index <= index1; index++) {
|
|
1190
1197
|
if (this._points.isIndexValid(index)) {
|
|
1191
1198
|
this._points.getPoint3dAtUncheckedPointIndex(index, LineString3d._workPointA);
|
|
1192
1199
|
result._points.push(LineString3d._workPointA);
|
|
1193
1200
|
}
|
|
1194
1201
|
}
|
|
1195
|
-
this.addResolvedPoint(
|
|
1202
|
+
this.addResolvedPoint(localB.index, localB.fraction, result._points);
|
|
1196
1203
|
return result;
|
|
1197
1204
|
}
|
|
1198
1205
|
/** Return (if possible) a specific segment of the linestring */
|
|
@@ -1304,7 +1311,7 @@ LineString3d._workPointA = Point3dVector3d_1.Point3d.create();
|
|
|
1304
1311
|
LineString3d._workPointB = Point3dVector3d_1.Point3d.create();
|
|
1305
1312
|
LineString3d._workPointC = Point3dVector3d_1.Point3d.create();
|
|
1306
1313
|
LineString3d._workRay = Ray3d_1.Ray3d.createXAxis();
|
|
1307
|
-
LineString3d._indexPoint = Point3dVector3d_1.Point3d.create(); // private point for
|
|
1314
|
+
LineString3d._indexPoint = Point3dVector3d_1.Point3d.create(); // private point for addResolvedPoint
|
|
1308
1315
|
/** An AnnotatedLineString3d is a linestring with additional surface-related data attached to each point
|
|
1309
1316
|
* * This is useful in facet construction.
|
|
1310
1317
|
* @internal
|