@itwin/core-geometry 5.9.0-dev.15 → 5.9.0-dev.17
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/curve/Loop.d.ts.map +1 -1
- package/lib/cjs/curve/Loop.js +3 -1
- package/lib/cjs/curve/Loop.js.map +1 -1
- package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +21 -27
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +97 -152
- package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +15 -14
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +144 -163
- package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/cjs/geometry3d/PointHelpers.js +6 -7
- package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
- package/lib/cjs/numerics/Newton.d.ts +10 -2
- package/lib/cjs/numerics/Newton.d.ts.map +1 -1
- package/lib/cjs/numerics/Newton.js.map +1 -1
- package/lib/esm/curve/Loop.d.ts.map +1 -1
- package/lib/esm/curve/Loop.js +3 -1
- package/lib/esm/curve/Loop.js.map +1 -1
- package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +21 -27
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +98 -153
- package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +15 -14
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +144 -163
- package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
- package/lib/esm/geometry3d/PointHelpers.js +6 -7
- package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
- package/lib/esm/numerics/Newton.d.ts +10 -2
- package/lib/esm/numerics/Newton.d.ts.map +1 -1
- package/lib/esm/numerics/Newton.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Newton.js","sourceRoot":"","sources":["../../../src/numerics/Newton.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,0CAAuC;AACvC,uFAAoF;AACpF,mEAAkE;AAElE,+CAA4C;AAC5C,+CAA4C;AAE5C,+BAA+B;AAE/B,0FAA0F;AAC1F,sDAAsD;AACtD,2GAA2G;AAC3G,kCAAkC;AAClC,sHAAsH;AACtH,iFAAiF;AAEjF;;;;GAIG;AACH,MAAsB,sBAAsB;IAa1C;;;;;;;;;;;OAWG;IACH,YACE,oBAA4B,mBAAQ,CAAC,eAAe,EACpD,8BAAsC,CAAC,EACvC,gBAAwB,EAAE;QAE1B,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;QAC5C,IAAI,CAAC,4BAA4B,GAAG,2BAA2B,CAAC;QAChE,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;IACD,sEAAsE;IAC5D,YAAY,GAAW,CAAC,CAAC;IACnC,gDAAgD;IACtC,4BAA4B,CAAS;IAC/C,4FAA4F;IAClF,kBAAkB,CAAS;IACrC,8BAA8B;IACpB,cAAc,CAAS;IACjC,uDAAuD;IAChD,aAAa,GAAW,CAAC,CAAC;IACjC,kFAAkF;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,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAClC,OAAO,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,EAC/B,OAAO,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,EAC/B,GAAG,EACH,QAAQ,GAAG,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,EACzE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,EACrC,GAAG,EACH,CAAC,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,EACxC,QAAQ,GAAG,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,EACzE,GAAG,CACJ,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAjDD,4EAiDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Numerics\n */\n\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { Geometry } from \"../Geometry\";\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\nimport { Point2d, Vector2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { SmallSystem } from \"./SmallSystem\";\n\n// cspell:word currentdFdX XYRR\n\n// A note on differences between using derivatives vs. approximate derivatives for Newton:\n// * Converged values are the same under both schemes.\n// * With derivatives, Newton convergence is quadratic rather than power 1.62 with approximate derivatives.\n// * With approximate derivatives:\n// - the extra iterative cost is incidental for low iteration counts, and may even be offset by simpler computation.\n// - the step choice is not based on serious analysis, so could be problematic.\n\n/**\n * Base class for Newton iterations in various dimensions.\n * Dimension-specific classes carry all dimension-related data and answer generalized queries from this base class.\n * @internal\n */\nexport abstract class AbstractNewtonIterator {\n /** Compute a step. The current x and function values must be retained for use in later method calls. */\n public abstract computeStep(): boolean;\n /**\n * Return the current step size, scaled for use in tolerance tests.\n * * This is a single number, typically the max of various per-dimension `dx/(1+x)` for the x and dx of that dimension.\n */\n public abstract currentStepSize(): number;\n /**\n * Apply the current step (in all dimensions).\n * @param isFinalStep true if this is a final step.\n */\n public abstract applyCurrentStep(isFinalStep: boolean): void;\n /**\n * The constructor.\n * @param stepSizeTolerance tolerance to consider a single step converged.\n * This number should be \"moderately\" strict. Because 2 successive convergences are required,\n * it is expected that a first \"accept\" for (say) 10 to 14 digit step will be followed by another\n * iteration. A well behaved newton would then hypothetically double the number of digits to\n * 20 to 28. Since the IEEE double only carries 16 digits, this second-convergence step will\n * typically achieve full precision. Default [[Geometry.smallNewtonStep]].\n * @param successiveConvergenceTarget number of successive convergences required for acceptance. Default 2.\n * @param maxIterations max number of iterations. A typical newton step converges in 3 to 6 iterations.\n * Allow 15 to 20 to catch difficult cases. Default 15.\n */\n protected constructor(\n stepSizeTolerance: number = Geometry.smallNewtonStep,\n successiveConvergenceTarget: number = 2,\n maxIterations: number = 15,\n ) {\n this._stepSizeTolerance = stepSizeTolerance;\n this._successiveConvergenceTarget = successiveConvergenceTarget;\n this._maxIterations = maxIterations;\n }\n /** Number of consecutive steps which passed convergence condition. */\n protected _numAccepted: number = 0;\n /** Target number of successive convergences. */\n protected _successiveConvergenceTarget: number;\n /** Convergence target (the implementation-specific currentStepSize is compared to this). */\n protected _stepSizeTolerance: number;\n /** Max iterations allowed. */\n protected _maxIterations: number;\n /** Number of iterations (incremented at each step). */\n public numIterations: number = 0;\n /** Get the relative tolerance for comparing iterations in [[testConvergence]]. */\n public get stepSizeTolerance(): number {\n return this._stepSizeTolerance;\n }\n /** Smallest iterate size difference in later iterations. */\n private _leastDelta: number = Number.MAX_VALUE;\n /** The current late iterate has the least delta encountered. Remember it. Implement along with [[restoreCandidate]].*/\n protected cacheCandidate?(): void;\n /** Set Newton result to the cached candidate. Implement along with [[cacheCandidate]]. */\n protected restoreCandidate?(): void;\n\n /**\n * Test if a step is converged.\n * * Convergence is accepted with enough (_successiveConvergenceTarget) small steps (according to _stepSizeTolerance)\n * occur in succession.\n * @param delta step size as reported by currentStepSize.\n */\n public testConvergence(delta: number): boolean {\n if (this.cacheCandidate && delta < this._leastDelta && this.numIterations > 0.5 * this._maxIterations) {\n this._leastDelta = delta;\n this.cacheCandidate();\n }\n if (Math.abs(delta) < this._stepSizeTolerance) {\n this._numAccepted++;\n return this._numAccepted >= this._successiveConvergenceTarget;\n }\n this._numAccepted = 0;\n return false;\n }\n /**\n * Run iterations, calling various methods from base and derived classes:\n * * computeStep -- typically evaluate derivatives and solve linear system.\n * * currentStepSize -- return numeric measure of the step just computed by computeStep.\n * * testConvergence -- test if the step from currentStepSize (along with recent steps) is converged.\n * * applyCurrentStep -- apply the step to the independent variables.\n */\n public runIterations(): boolean {\n this._numAccepted = 0;\n this.numIterations = 0;\n this._leastDelta = Number.MAX_VALUE;\n while (this.numIterations++ < this._maxIterations && this.computeStep()) {\n if (this.testConvergence(this.currentStepSize())) {\n this.applyCurrentStep(true);\n return true;\n }\n this.applyCurrentStep(false);\n }\n if (this.restoreCandidate && this.numIterations >= this._maxIterations && Math.abs(this.currentStepSize()) > this._leastDelta)\n this.restoreCandidate(); // we may have ended up in a late cycle; return our best guess\n return false;\n }\n}\n/**\n * Object to evaluate a newton function. The object must retain most-recent function and derivative\n * values for immediate query.\n * @internal\n */\nexport abstract class NewtonEvaluatorRtoRD {\n /** Evaluate the function and its derivative at x. */\n public abstract evaluate(x: number): boolean;\n /** Most recent function value, i.e., f(x_n). */\n public currentF!: number;\n /** Most recent evaluated derivative, i.e., f'(x_n). */\n public currentdFdX!: number;\n}\n/**\n * Newton iterator for use when both function and derivative can be evaluated.\n * To solve `f(x) = 0`, the Newton iteration is `x_{n+1} = x_n - dx = x_n - f(x_n)/f'(x_n)`.\n * To solve `f(x) = target` which is equivalent to solving `g(x) = f(x) - target = 0`, the Newton iteration is\n * `x_{n+1} = x_n - dx = x_n - g(x_n)/g'(x_n) = x_n - (f(x_n)-target)/f'(x_n)`.\n * @internal\n */\nexport class Newton1dUnbounded extends AbstractNewtonIterator {\n private _func: NewtonEvaluatorRtoRD;\n /** Current step is dx. */\n private _currentStep!: number;\n /** Current X is x_n. */\n private _currentX!: number;\n /** The target */\n private _target!: number;\n /**\n * Constructor for 1D newton iteration with derivatives.\n * @param func function that returns both function value and derivative.\n */\n public constructor(func: NewtonEvaluatorRtoRD, maxIterations?: number) {\n super(undefined, undefined, maxIterations);\n this._func = func;\n this.setTarget(0);\n }\n /** Set the independent variable, i.e., x_n. */\n public setX(x: number) {\n this._currentX = x;\n }\n /** Get the independent variable, i.e., x_n. */\n public getX(): number {\n return this._currentX;\n }\n /** Set the target function value. */\n public setTarget(y: number): void {\n this._target = y;\n }\n /** Move the current X by the just-computed step, i.e., `x_n - dx`. */\n public applyCurrentStep(): void {\n this.setX(this._currentX - this._currentStep);\n }\n /** Compute the univariate newton step dx. */\n public computeStep(): boolean {\n if (this._func.evaluate(this._currentX)) {\n const dx = Geometry.conditionalDivideFraction(this._func.currentF - this._target, this._func.currentdFdX);\n if (dx !== undefined) {\n this._currentStep = dx;\n return true;\n }\n }\n return false;\n }\n /** Return the current step size as a relative number, i.e., `|dx / (1 + |x_n|)|`. */\n public currentStepSize(): number {\n return Math.abs(this._currentStep / (1.0 + Math.abs(this._currentX)));\n }\n}\n\n/**\n * Object to evaluate a newton function (without derivative). The object must retain most-recent function value.\n * @internal\n */\nexport abstract class NewtonEvaluatorRtoR {\n /** Evaluate function value into member currentF */\n public abstract evaluate(x: number): boolean;\n /** Most recent function evaluation, i.e., f(x_n). */\n public currentF!: number;\n}\n\n/**\n * Intermediate class for managing the parentCurve announcements from an IStrokeHandler.\n * @internal\n */\nexport abstract class NewtonRtoRStrokeHandler extends NewtonEvaluatorRtoR {\n protected _parentCurvePrimitive: CurvePrimitive | undefined;\n constructor() {\n super();\n this._parentCurvePrimitive = undefined;\n }\n /**\n * Retain the parentCurvePrimitive.\n * * Calling this method tells the handler that the parent curve is to be used for detail searches.\n * * Example: Transition spiral search is based on linestring first, then the exact spiral.\n * * Example: CurveChainWithDistanceIndex does NOT do this announcement; the constituents act independently.\n */\n public startParentCurvePrimitive(curve: CurvePrimitive | undefined): void {\n this._parentCurvePrimitive = curve;\n }\n /** Forget the parentCurvePrimitive */\n public endParentCurvePrimitive(_curve: CurvePrimitive | undefined): void {\n this._parentCurvePrimitive = undefined;\n }\n}\n\n/**\n * Newton iteration for a univariate function, using approximate derivatives.\n * To approximate the derivatives we use a small step `h`, i.e., `f'(x_n) = (f(x_n + h) - f(x_n)) / h`.\n * Therefore, to solve `f(x) = 0`, the iteration is\n * `x_{n+1} = x_n - dx = x_n - f(x_n)/f'(x_n) = x_n - f(x_n) * h / (f(x_n + h) - f(x_n))`.\n * @internal\n */\nexport class Newton1dUnboundedApproximateDerivative extends AbstractNewtonIterator {\n private _func: NewtonEvaluatorRtoR;\n /** Current step is dx. */\n private _currentStep!: number;\n /** Current X is x_n. */\n private _currentX!: number;\n /**\n * Step size for approximate derivative for the iteration.\n * * Initialized to 1e-8, which is appropriate for iteration in fraction space.\n * * Should be larger for iteration with real distance as x.\n */\n public derivativeH: number; // h\n\n /**\n * Constructor for 1D newton iteration with approximate derivatives.\n * @param func function that only returns function value (and not derivative).\n */\n public constructor(func: NewtonEvaluatorRtoR, maxIterations?: number) {\n super(undefined, undefined, maxIterations);\n this._func = func;\n this.derivativeH = 1.0e-8;\n }\n /** Set the independent variable, i.e., x_n. */\n public setX(x: number): void {\n this._currentX = x;\n }\n /** Get the independent variable, i.e., x_n. */\n public getX(): number {\n return this._currentX;\n }\n /** Move the current X by the just-computed step, i.e., `x_n - dx`. */\n public applyCurrentStep(): void {\n this.setX(this._currentX - this._currentStep);\n }\n /** Univariate newton step dx, computed with approximate derivative. */\n public computeStep(): boolean {\n if (this._func.evaluate(this._currentX)) {\n const fA = this._func.currentF; // f(x_n)\n if (this._func.evaluate(this._currentX + this.derivativeH)) {\n const fB = this._func.currentF; // f(x_n + h)\n const dx = Geometry.conditionalDivideFraction(fA, (fB - fA) / this.derivativeH);\n if (dx !== undefined) {\n this._currentStep = dx;\n return true;\n }\n }\n }\n return false;\n }\n /** Return the current step size as a relative number, i.e., `|dx / (1 + |x_n|)|`. */\n public currentStepSize(): number {\n return Math.abs(this._currentStep / (1.0 + Math.abs(this._currentX)));\n }\n}\n\n/**\n * Object to evaluate a 2-parameter newton function with derivatives.\n * @internal\n */\nexport abstract class NewtonEvaluatorRRtoRRD {\n /**\n * Iteration controller calls this to ask for evaluation of the function and its two partial derivatives.\n * * The implementation returns true, it must set the currentF object.\n */\n public abstract evaluate(x: number, y: number): boolean;\n /**\n * Most recent function evaluation as parts of the plane.\n * * See doc of [[Newton2dUnboundedWithDerivative]] class for info on 2d newton method.\n * * For `F(u,v) := (x(u,v), y(u,v))` the returned plane stores the following evaluations at current value `X := (u,v)`:\n * * `origin` = F(X) = (x(X), y(X))\n * * `vectorU` = F_u(X) = partial deriv of F wrt u at X = (x_u(X), y_u(X)) = 1st col of Jacobian matrix evaluated at X\n * * `vectorV` = F_v(X) = partial deriv of F wrt v at X = (x_v(X), y_v(X)) = 2nd col of Jacobian matrix evaluated at X\n */\n public currentF!: Plane3dByOriginAndVectors;\n /**\n * Constructor.\n * * This creates a currentF object to (repeatedly) receive function and derivatives.\n */\n public constructor() {\n this.currentF = Plane3dByOriginAndVectors.createXYPlane();\n }\n}\n\n/**\n * Implement evaluation steps for newton iteration in 2 dimensions, using caller supplied NewtonEvaluatorRRtoRRD object.\n * * Suppose we want to find the roots of `F(u,v) := (x(u,v), y(u,v))`. Writing `X := (u,v)` and `F(X)` as column vectors,\n * the 2D Newton's iteration to find a root of `F` is given by:\n * `X_{n+1} = X_n - dX = X_n - JInv(X_n)F(X_n)`, where `JInv` is the inverse of the Jacobian matrix `J`, and `J` is\n * defined by the partial derivatives of the component functions of F:\n *\n * `[dx/du dx/dv]`\n *\n * `[dy/du dy/dv]`\n * @internal\n */\nexport class Newton2dUnboundedWithDerivative extends AbstractNewtonIterator {\n private _func: NewtonEvaluatorRRtoRRD;\n /** Current step, or dX = (du, dv). */\n private _currentStep: Vector2d;\n /** Current uv parameters, or X_n = (u_n, v_n). */\n private _currentUV: Point2d;\n /**\n * Constructor for 2D newton iteration with derivatives.\n * @param func function that returns both function value and derivative.\n * @param maxIterations max number of iterations. Default 15.\n * @param stepSizeTolerance tolerance to consider a single step converged. Default [[Geometry.smallNewtonStep]].\n */\n public constructor(func: NewtonEvaluatorRRtoRRD, maxIterations?: number, stepSizeTolerance?: number) {\n super(stepSizeTolerance, undefined, maxIterations);\n this._func = func;\n this._currentStep = Vector2d.createZero();\n this._currentUV = Point2d.createZero();\n }\n /** Set the current uv parameters, i.e., `X_n = (u_n, v_n)`. */\n public setUV(u: number, v: number): void {\n this._currentUV.set(u, v);\n }\n /** Get the current u parameter of X_n, i.e., u_n. */\n public getU(): number {\n return this._currentUV.x;\n }\n /** Get the current v parameter of X_n, i.e., v_n. */\n public getV(): number {\n return this._currentUV.y;\n }\n /** Update the current uv parameter by currentStep, i.e., compute `X_{n+1} := X_n - dX = (u_n - du, v_n - dv)`. */\n public applyCurrentStep(): void {\n this.setUV(this._currentUV.x - this._currentStep.x, this._currentUV.y - this._currentStep.y);\n }\n /**\n * Evaluate the functions and derivatives at `X_n = (u_n, v_n)`, and solve the Jacobian matrix equation to\n * compute `dX = (du, dv)`.\n */\n public computeStep(): boolean {\n if (!this._func.evaluate(this._currentUV.x, this._currentUV.y))\n return false;\n const fA = this._func.currentF;\n const jCol0 = fA.vectorU;\n const jCol1 = fA.vectorV;\n const fX = fA.origin;\n // Given X_{n+1} = X_n - dX = X_n - JInv(X_n) F(X_n), we solve J(X_n) dX = F(X_n) for dX:\n if (SmallSystem.linearSystem2d(jCol0.x, jCol1.x, jCol0.y, jCol1.y, fX.x, fX.y, this._currentStep))\n return true;\n return false;\n }\n /**\n * Return the current relative step size, i.e., the larger absolute component of `dX / (1 + |X_n|)`\n */\n public currentStepSize(): number {\n return Geometry.maxAbsXY(\n this._currentStep.x / (1.0 + Math.abs(this._currentUV.x)),\n this._currentStep.y / (1.0 + Math.abs(this._currentUV.y)),\n );\n }\n /** Candidate solution cache. */\n private _cachedUV: Point2d | undefined;\n /** The current late iterate has the least delta encountered. Remember it. */\n protected override cacheCandidate(): void {\n if (this._cachedUV)\n this._cachedUV.setFrom(this._currentUV);\n else\n this._cachedUV = this._currentUV.clone();\n }\n /** Set Newton result to the cached candidate. */\n protected override restoreCandidate(): void {\n if (this._cachedUV)\n this.setUV(this._cachedUV.x, this._cachedUV.y);\n }\n}\n/**\n * SimpleNewton has static methods for newton methods with evaluated functions presented as immediate arguments\n * (not function object).\n * @internal\n */\nexport class SimpleNewton {\n /**\n * Run a one-dimensional newton iteration with separate functions for function and derivative.\n * * Completion is at 2 (TWO) successive passes at `absoluteTolerance + relTol * abs(x)`, where relTol is\n * chosen internally.\n * * `absoluteTolerance` is usually aggressively tight -- should come into play only for x near zero.\n * * The `relTol` is fluffy (for instance around 1e-11) but in properly converging cases the extra pass after\n * first success normally moves to full machine precision.\n * * This is an open-loop newton -- it just runs, and returns undefined if anything bad happens.\n */\n public static runNewton1D(\n x: number,\n func: (x: number) => number | undefined,\n derivative: (x: number) => number | undefined,\n absoluteTolerance: number = Geometry.smallFloatingPoint,\n ): number | undefined {\n let numConverged = 0;\n let tolerance: number;\n const relTol = Geometry.smallNewtonStep;\n for (let iteration = 0; iteration < 20; iteration++) {\n const f = func(x);\n const df = derivative(x);\n if (f !== undefined && df !== undefined) {\n const dx = Geometry.conditionalDivideCoordinate(f, df);\n if (dx === undefined)\n return undefined;\n x -= dx;\n // console.log(x); // print approximations for debug\n tolerance = absoluteTolerance + Math.abs(x) * relTol;\n if (Math.abs(dx) < tolerance) {\n numConverged++;\n if (dx === 0.0 || numConverged > 1) // bypass convergence count on true 0 dx\n return x;\n } else {\n numConverged = 0;\n }\n }\n }\n return undefined;\n }\n}\n\n/**\n * Class to evaluate XY intersection between 2 curve primitives using the Newton method.\n * @internal\n */\nexport class CurveCurveIntersectionXYRRToRRD extends NewtonEvaluatorRRtoRRD {\n private _curveP: CurvePrimitive;\n private _curveQ: CurvePrimitive;\n private _rayP: Ray3d;\n private _rayQ: Ray3d;\n constructor(curveP: CurvePrimitive, curveQ: CurvePrimitive) {\n super();\n this._curveP = curveP;\n this._curveQ = curveQ;\n this._rayP = Ray3d.createZero();\n this._rayQ = Ray3d.createZero();\n }\n public evaluate(fractionU: number, fractionV: number): boolean {\n /**\n * To find an intersection between xy-curves P(u) = (x_p(u), y_p(u)) and Q(v) = (x_q(v), y_q(v)) we should solve\n * F(u,v) := P(u) - Q(v) = (0,0)\n * Using the Newton method we can find the fractions u and v at the intersection via\n * [u_{n+1}] [u_n] [x_p'(u_n) -x_q'(v_n)] [x_p(u_n) - x_q(v_n)]\n * = - Inv( )\n * [v_{n+1}] [v_n] [y_p'(u_n) -y_q'(v_n)] [y_p(u_n) - y_q(v_n)]\n * Note that this is xy intersection so we can ignore z.\n */\n this._curveP.fractionToPointAndDerivative(fractionU, this._rayP);\n this._curveQ.fractionToPointAndDerivative(fractionV, this._rayQ);\n this.currentF.setOriginAndVectorsXYZ(\n this._rayP.origin.x - this._rayQ.origin.x, this._rayP.origin.y - this._rayQ.origin.y, 0.0,\n this._rayP.direction.x, this._rayP.direction.y, 0.0,\n -this._rayQ.direction.x, -this._rayQ.direction.y, 0.0,\n );\n return true;\n }\n}\n\n/**\n * Class to evaluate XY close approach between a curve primitive and a point using the Newton method.\n * @internal\n */\nexport class CurvePointCloseApproachXYRtoRD extends NewtonEvaluatorRtoRD {\n private _curveP: CurvePrimitive;\n private _pointQ: Point3d;\n private _planeP: Plane3dByOriginAndVectors;\n constructor(curveP: CurvePrimitive, pointQ: Point3d) {\n super();\n this._curveP = curveP;\n this._pointQ = pointQ;\n this._planeP = Plane3dByOriginAndVectors.createXYPlane();\n }\n public evaluate(fractionU: number): boolean {\n /**\n * To find a close approach between xy-curve P(u) and xy-point q we should solve\n * F(u) := P'(u).(P(u) - q) = 0\n * For a solution u, the segment S(u) := P(u) - q is perpendicular to the curve tangent P'(u), which means S(u) is\n * a close approach.\n * Using the Newton method we can find the fractions u at the close approach location via\n * u_{n+1} = u_n + F(u_n)/F'(u_n) = u_n + [ P'(u_n).S(u_n) ]/[ P''(u_n).S(u_n) + P'(u_n).P'(u_n) ]\n * Note that this is xy close approach so we can ignore z.\n */\n this._curveP.fractionToPointAnd2Derivatives(fractionU, this._planeP);\n const segX = this._planeP.origin.x - this._pointQ.x;\n const segY = this._planeP.origin.y - this._pointQ.y;\n const pDerivX = this._planeP.vectorU.x;\n const pDerivY = this._planeP.vectorU.y;\n const p2DerivX = this._planeP.vectorV.x;\n const p2DerivY = this._planeP.vectorV.y;\n this.currentF = pDerivX * segX + pDerivY * segY;\n this.currentdFdX = p2DerivX * segX + pDerivX * pDerivX + p2DerivY * segY + pDerivY * pDerivY;\n return true;\n }\n}\n\n/**\n * Class to evaluate XY close approach between 2 curve primitives using the Newton method.\n * @internal\n */\nexport class CurveCurveCloseApproachXYRRtoRRD extends NewtonEvaluatorRRtoRRD {\n private _curveP: CurvePrimitive;\n private _curveQ: CurvePrimitive;\n private _planeP: Plane3dByOriginAndVectors;\n private _planeQ: Plane3dByOriginAndVectors;\n constructor(curveP: CurvePrimitive, curveQ: CurvePrimitive) {\n super();\n this._curveP = curveP;\n this._curveQ = curveQ;\n this._planeP = Plane3dByOriginAndVectors.createXYPlane();\n this._planeQ = Plane3dByOriginAndVectors.createXYPlane();\n }\n public evaluate(fractionU: number, fractionV: number): boolean {\n /**\n * To find a close approach between xy-curves P(u) and Q(v) we should solve\n * F(u,v) := (P'(u).(P(u) - Q(v)), Q'(v).(P(u) - Q(v))) = (0,0)\n * For a solution (u,v), the segment S(u,v) := P(u) - Q(v) is perpendicular to the curve tangents P'(u) and Q'(v),\n * which means S(u,v) is a close approach.\n * Using the Newton method we can find the fractions u and v at the close approach location via\n * [u_{n+1}] [u_n] [P''(u_n).S(u_n,v_n) + P'(u_n).P'(u_n) -P'(u_n).Q'(v_n)] [P'(u_n).S(u_n,v_n)]\n * = - Inv( )\n * [v_{n+1}] [v_n] [Q'(v_n).P'(u_n) Q''(v_n).S(u_n,v_n) - Q'(v_n).Q'(v_n)] [Q'(v_n).S(u_n,v_n)]\n * Note that this is xy close approach so we can ignore z.\n */\n this._curveP.fractionToPointAnd2Derivatives(fractionU, this._planeP);\n this._curveQ.fractionToPointAnd2Derivatives(fractionV, this._planeQ);\n const segX = this._planeP.origin.x - this._planeQ.origin.x;\n const segY = this._planeP.origin.y - this._planeQ.origin.y;\n const pDerivX = this._planeP.vectorU.x;\n const pDerivY = this._planeP.vectorU.y;\n const qDerivX = this._planeQ.vectorU.x;\n const qDerivY = this._planeQ.vectorU.y;\n const p2DerivX = this._planeP.vectorV.x;\n const p2DerivY = this._planeP.vectorV.y;\n const q2DerivX = this._planeQ.vectorV.x;\n const q2DerivY = this._planeQ.vectorV.y;\n this.currentF.setOriginAndVectorsXYZ(\n pDerivX * segX + pDerivY * segY,\n qDerivX * segX + qDerivY * segY,\n 0.0,\n p2DerivX * segX + p2DerivY * segY + pDerivX * pDerivX + pDerivY * pDerivY,\n qDerivX * pDerivX + qDerivY * pDerivY,\n 0.0,\n -(pDerivX * qDerivX + pDerivY * qDerivY),\n q2DerivX * segX + q2DerivY * segY - qDerivX * qDerivX - qDerivY * qDerivY,\n 0.0,\n );\n return true;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Newton.js","sourceRoot":"","sources":["../../../src/numerics/Newton.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,0CAAuC;AACvC,uFAAoF;AACpF,mEAAkE;AAElE,+CAA4C;AAC5C,+CAA4C;AAE5C,+BAA+B;AAE/B,0FAA0F;AAC1F,sDAAsD;AACtD,2GAA2G;AAC3G,kCAAkC;AAClC,sHAAsH;AACtH,iFAAiF;AAEjF;;;;GAIG;AACH,MAAsB,sBAAsB;IAa1C;;;;;;;;;;;OAWG;IACH,YACE,oBAA4B,mBAAQ,CAAC,eAAe,EACpD,8BAAsC,CAAC,EACvC,gBAAwB,EAAE;QAE1B,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;QAC5C,IAAI,CAAC,4BAA4B,GAAG,2BAA2B,CAAC;QAChE,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACtC,CAAC;IACD,sEAAsE;IAC5D,YAAY,GAAW,CAAC,CAAC;IACnC,gDAAgD;IACtC,4BAA4B,CAAS;IAC/C,4FAA4F;IAClF,kBAAkB,CAAS;IACrC,8BAA8B;IACpB,cAAc,CAAS;IACjC,uDAAuD;IAChD,aAAa,GAAW,CAAC,CAAC;IACjC,kFAAkF;IAClF,IAAW,iBAAiB;QAC1B,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IACD,4DAA4D;IACpD,WAAW,GAAW,MAAM,CAAC,SAAS,CAAC;IAa/C;;;;;OAKG;IACI,eAAe,CAAC,KAAa;QAClC,IAAI,IAAI,CAAC,cAAc,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YACtG,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YACzB,IAAI,CAAC,cAAc,EAAE,CAAC;QAC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O,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,EAC/B,GAAG,EACH,QAAQ,GAAG,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,EACzE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,EACrC,GAAG,EACH,CAAC,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,EACxC,QAAQ,GAAG,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,EACzE,GAAG,CACJ,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAjDD,4EAiDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Numerics\n */\n\nimport { CurvePrimitive } from \"../curve/CurvePrimitive\";\nimport { Geometry } from \"../Geometry\";\nimport { Plane3dByOriginAndVectors } from \"../geometry3d/Plane3dByOriginAndVectors\";\nimport { Point2d, Vector2d } from \"../geometry3d/Point2dVector2d\";\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../geometry3d/Ray3d\";\nimport { SmallSystem } from \"./SmallSystem\";\n\n// cspell:word currentdFdX XYRR\n\n// A note on differences between using derivatives vs. approximate derivatives for Newton:\n// * Converged values are the same under both schemes.\n// * With derivatives, Newton convergence is quadratic rather than power 1.62 with approximate derivatives.\n// * With approximate derivatives:\n// - the extra iterative cost is incidental for low iteration counts, and may even be offset by simpler computation.\n// - the step choice is not based on serious analysis, so could be problematic.\n\n/**\n * Base class for Newton iterations in various dimensions.\n * Dimension-specific classes carry all dimension-related data and answer generalized queries from this base class.\n * @internal\n */\nexport abstract class AbstractNewtonIterator {\n /** Compute a step. The current x and function values must be retained for use in later method calls. */\n public abstract computeStep(): boolean;\n /**\n * Return the current step size, scaled for use in tolerance tests.\n * * This is a single number, typically the max of various per-dimension `dx/(1+x)` for the x and dx of that dimension.\n */\n public abstract currentStepSize(): number;\n /**\n * Apply the current step (in all dimensions).\n * @param isFinalStep true if this is a final step.\n */\n public abstract applyCurrentStep(isFinalStep: boolean): void;\n /**\n * The constructor.\n * @param stepSizeTolerance tolerance to consider a single step converged.\n * This number should be \"moderately\" strict. Because 2 successive convergences are required,\n * it is expected that a first \"accept\" for (say) 10 to 14 digit step will be followed by another\n * iteration. A well behaved newton would then hypothetically double the number of digits to\n * 20 to 28. Since the IEEE double only carries 16 digits, this second-convergence step will\n * typically achieve full precision. Default [[Geometry.smallNewtonStep]].\n * @param successiveConvergenceTarget number of successive convergences required for acceptance. Default 2.\n * @param maxIterations max number of iterations. A typical newton step converges in 3 to 6 iterations.\n * Allow 15 to 20 to catch difficult cases. Default 15.\n */\n protected constructor(\n stepSizeTolerance: number = Geometry.smallNewtonStep,\n successiveConvergenceTarget: number = 2,\n maxIterations: number = 15,\n ) {\n this._stepSizeTolerance = stepSizeTolerance;\n this._successiveConvergenceTarget = successiveConvergenceTarget;\n this._maxIterations = maxIterations;\n }\n /** Number of consecutive steps which passed convergence condition. */\n protected _numAccepted: number = 0;\n /** Target number of successive convergences. */\n protected _successiveConvergenceTarget: number;\n /** Convergence target (the implementation-specific currentStepSize is compared to this). */\n protected _stepSizeTolerance: number;\n /** Max iterations allowed. */\n protected _maxIterations: number;\n /** Number of iterations (incremented at each step). */\n public numIterations: number = 0;\n /** Get the relative tolerance for comparing iterations in [[testConvergence]]. */\n public get stepSizeTolerance(): number {\n return this._stepSizeTolerance;\n }\n /** Smallest iterate size difference in later iterations. */\n private _leastDelta: number = Number.MAX_VALUE;\n /**\n * The current late iterate has the least delta encountered. Remember it.\n * * Implement this method along with [[restoreCandidate]].\n */\n protected cacheCandidate?(): void;\n /**\n * Set Newton result to the cached candidate.\n * * This is the best approximation to the root found during Newton iteration and may be useful to the caller\n * even when Newton fails to converge.\n * * Implement this method along with [[cacheCandidate]].\n */\n protected restoreCandidate?(): void;\n /**\n * Test if a step is converged.\n * * Convergence is accepted with enough (_successiveConvergenceTarget) small steps (according to _stepSizeTolerance)\n * occur in succession.\n * @param delta step size as reported by currentStepSize.\n */\n public testConvergence(delta: number): boolean {\n if (this.cacheCandidate && delta < this._leastDelta && this.numIterations > 0.5 * this._maxIterations) {\n this._leastDelta = delta;\n this.cacheCandidate();\n }\n if (Math.abs(delta) < this._stepSizeTolerance) {\n this._numAccepted++;\n return this._numAccepted >= this._successiveConvergenceTarget;\n }\n this._numAccepted = 0;\n return false;\n }\n /**\n * Run iterations, calling various methods from base and derived classes:\n * * computeStep -- typically evaluate derivatives and solve linear system.\n * * currentStepSize -- return numeric measure of the step just computed by computeStep.\n * * testConvergence -- test if the step from currentStepSize (along with recent steps) is converged.\n * * applyCurrentStep -- apply the step to the independent variables.\n */\n public runIterations(): boolean {\n this._numAccepted = 0;\n this.numIterations = 0;\n this._leastDelta = Number.MAX_VALUE;\n while (this.numIterations++ < this._maxIterations && this.computeStep()) {\n if (this.testConvergence(this.currentStepSize())) {\n this.applyCurrentStep(true);\n return true;\n }\n this.applyCurrentStep(false);\n }\n if (this.restoreCandidate && this.numIterations >= this._maxIterations && Math.abs(this.currentStepSize()) > this._leastDelta)\n this.restoreCandidate(); // we may have ended up in a late cycle; return our best guess\n return false;\n }\n}\n/**\n * Object to evaluate a newton function. The object must retain most-recent function and derivative\n * values for immediate query.\n * @internal\n */\nexport abstract class NewtonEvaluatorRtoRD {\n /** Evaluate the function and its derivative at x. */\n public abstract evaluate(x: number): boolean;\n /** Most recent function value, i.e., f(x_n). */\n public currentF!: number;\n /** Most recent evaluated derivative, i.e., f'(x_n). */\n public currentdFdX!: number;\n}\n/**\n * Newton iterator for use when both function and derivative can be evaluated.\n * To solve `f(x) = 0`, the Newton iteration is `x_{n+1} = x_n - dx = x_n - f(x_n)/f'(x_n)`.\n * To solve `f(x) = target` which is equivalent to solving `g(x) = f(x) - target = 0`, the Newton iteration is\n * `x_{n+1} = x_n - dx = x_n - g(x_n)/g'(x_n) = x_n - (f(x_n)-target)/f'(x_n)`.\n * @internal\n */\nexport class Newton1dUnbounded extends AbstractNewtonIterator {\n private _func: NewtonEvaluatorRtoRD;\n /** Current step is dx. */\n private _currentStep!: number;\n /** Current X is x_n. */\n private _currentX!: number;\n /** The target */\n private _target!: number;\n /**\n * Constructor for 1D newton iteration with derivatives.\n * @param func function that returns both function value and derivative.\n */\n public constructor(func: NewtonEvaluatorRtoRD, maxIterations?: number) {\n super(undefined, undefined, maxIterations);\n this._func = func;\n this.setTarget(0);\n }\n /** Set the independent variable, i.e., x_n. */\n public setX(x: number): void {\n this._currentX = x;\n }\n /** Get the independent variable, i.e., x_n. */\n public getX(): number {\n return this._currentX;\n }\n /** Set the target function value. */\n public setTarget(y: number): void {\n this._target = y;\n }\n /** Move the current X by the just-computed step, i.e., `x_n - dx`. */\n public applyCurrentStep(): void {\n this.setX(this._currentX - this._currentStep);\n }\n /** Compute the univariate newton step dx. */\n public computeStep(): boolean {\n if (this._func.evaluate(this._currentX)) {\n const dx = Geometry.conditionalDivideFraction(this._func.currentF - this._target, this._func.currentdFdX);\n if (dx !== undefined) {\n this._currentStep = dx;\n return true;\n }\n }\n return false;\n }\n /** Return the current step size as a relative number, i.e., `|dx / (1 + |x_n|)|`. */\n public currentStepSize(): number {\n return Math.abs(this._currentStep / (1.0 + Math.abs(this._currentX)));\n }\n}\n\n/**\n * Object to evaluate a newton function (without derivative). The object must retain most-recent function value.\n * @internal\n */\nexport abstract class NewtonEvaluatorRtoR {\n /** Evaluate function value into member currentF */\n public abstract evaluate(x: number): boolean;\n /** Most recent function evaluation, i.e., f(x_n). */\n public currentF!: number;\n}\n\n/**\n * Intermediate class for managing the parentCurve announcements from an IStrokeHandler.\n * @internal\n */\nexport abstract class NewtonRtoRStrokeHandler extends NewtonEvaluatorRtoR {\n protected _parentCurvePrimitive: CurvePrimitive | undefined;\n constructor() {\n super();\n this._parentCurvePrimitive = undefined;\n }\n /**\n * Retain the parentCurvePrimitive.\n * * Calling this method tells the handler that the parent curve is to be used for detail searches.\n * * Example: Transition spiral search is based on linestring first, then the exact spiral.\n * * Example: CurveChainWithDistanceIndex does NOT do this announcement; the constituents act independently.\n */\n public startParentCurvePrimitive(curve: CurvePrimitive | undefined): void {\n this._parentCurvePrimitive = curve;\n }\n /** Forget the parentCurvePrimitive */\n public endParentCurvePrimitive(_curve: CurvePrimitive | undefined): void {\n this._parentCurvePrimitive = undefined;\n }\n}\n\n/**\n * Newton iteration for a univariate function, using approximate derivatives.\n * To approximate the derivatives we use a small step `h`, i.e., `f'(x_n) = (f(x_n + h) - f(x_n)) / h`.\n * Therefore, to solve `f(x) = 0`, the iteration is\n * `x_{n+1} = x_n - dx = x_n - f(x_n)/f'(x_n) = x_n - f(x_n) * h / (f(x_n + h) - f(x_n))`.\n * @internal\n */\nexport class Newton1dUnboundedApproximateDerivative extends AbstractNewtonIterator {\n private _func: NewtonEvaluatorRtoR;\n /** Current step is dx. */\n private _currentStep!: number;\n /** Current X is x_n. */\n private _currentX!: number;\n /**\n * Step size for approximate derivative for the iteration.\n * * Initialized to 1e-8, which is appropriate for iteration in fraction space.\n * * Should be larger for iteration with real distance as x.\n */\n public derivativeH: number; // h\n\n /**\n * Constructor for 1D newton iteration with approximate derivatives.\n * @param func function that only returns function value (and not derivative).\n */\n public constructor(func: NewtonEvaluatorRtoR, maxIterations?: number) {\n super(undefined, undefined, maxIterations);\n this._func = func;\n this.derivativeH = 1.0e-8;\n }\n /** Set the independent variable, i.e., x_n. */\n public setX(x: number): void {\n this._currentX = x;\n }\n /** Get the independent variable, i.e., x_n. */\n public getX(): number {\n return this._currentX;\n }\n /** Move the current X by the just-computed step, i.e., `x_n - dx`. */\n public applyCurrentStep(): void {\n this.setX(this._currentX - this._currentStep);\n }\n /** Univariate newton step dx, computed with approximate derivative. */\n public computeStep(): boolean {\n if (this._func.evaluate(this._currentX)) {\n const fA = this._func.currentF; // f(x_n)\n if (this._func.evaluate(this._currentX + this.derivativeH)) {\n const fB = this._func.currentF; // f(x_n + h)\n const dx = Geometry.conditionalDivideFraction(fA, (fB - fA) / this.derivativeH);\n if (dx !== undefined) {\n this._currentStep = dx;\n return true;\n }\n }\n }\n return false;\n }\n /** Return the current step size as a relative number, i.e., `|dx / (1 + |x_n|)|`. */\n public currentStepSize(): number {\n return Math.abs(this._currentStep / (1.0 + Math.abs(this._currentX)));\n }\n}\n\n/**\n * Object to evaluate a 2-parameter newton function with derivatives.\n * @internal\n */\nexport abstract class NewtonEvaluatorRRtoRRD {\n /**\n * Iteration controller calls this to ask for evaluation of the function and its two partial derivatives.\n * * The implementation returns true, it must set the currentF object.\n */\n public abstract evaluate(x: number, y: number): boolean;\n /**\n * Most recent function evaluation as parts of the plane.\n * * See doc of [[Newton2dUnboundedWithDerivative]] class for info on 2d newton method.\n * * For `F(u,v) := (x(u,v), y(u,v))` the returned plane stores the following evaluations at current value `X := (u,v)`:\n * * `origin` = F(X) = (x(X), y(X))\n * * `vectorU` = F_u(X) = partial deriv of F wrt u at X = (x_u(X), y_u(X)) = 1st col of Jacobian matrix evaluated at X\n * * `vectorV` = F_v(X) = partial deriv of F wrt v at X = (x_v(X), y_v(X)) = 2nd col of Jacobian matrix evaluated at X\n */\n public currentF!: Plane3dByOriginAndVectors;\n /**\n * Constructor.\n * * This creates a currentF object to (repeatedly) receive function and derivatives.\n */\n public constructor() {\n this.currentF = Plane3dByOriginAndVectors.createXYPlane();\n }\n}\n\n/**\n * Implement evaluation steps for newton iteration in 2 dimensions, using caller supplied NewtonEvaluatorRRtoRRD object.\n * * Suppose we want to find the roots of `F(u,v) := (x(u,v), y(u,v))`. Writing `X := (u,v)` and `F(X)` as column vectors,\n * the 2D Newton's iteration to find a root of `F` is given by:\n * `X_{n+1} = X_n - dX = X_n - JInv(X_n)F(X_n)`, where `JInv` is the inverse of the Jacobian matrix `J`, and `J` is\n * defined by the partial derivatives of the component functions of F:\n *\n * `[dx/du dx/dv]`\n *\n * `[dy/du dy/dv]`\n * @internal\n */\nexport class Newton2dUnboundedWithDerivative extends AbstractNewtonIterator {\n private _func: NewtonEvaluatorRRtoRRD;\n /** Current step, or dX = (du, dv). */\n private _currentStep: Vector2d;\n /** Current uv parameters, or X_n = (u_n, v_n). */\n private _currentUV: Point2d;\n /**\n * Constructor for 2D newton iteration with derivatives.\n * @param func function that returns both function value and derivative.\n * @param maxIterations max number of iterations. Default 15.\n * @param stepSizeTolerance tolerance to consider a single step converged. Default [[Geometry.smallNewtonStep]].\n */\n public constructor(func: NewtonEvaluatorRRtoRRD, maxIterations?: number, stepSizeTolerance?: number) {\n super(stepSizeTolerance, undefined, maxIterations);\n this._func = func;\n this._currentStep = Vector2d.createZero();\n this._currentUV = Point2d.createZero();\n }\n /** Set the current uv parameters, i.e., `X_n = (u_n, v_n)`. */\n public setUV(u: number, v: number): void {\n this._currentUV.set(u, v);\n }\n /** Get the current u parameter of X_n, i.e., u_n. */\n public getU(): number {\n return this._currentUV.x;\n }\n /** Get the current v parameter of X_n, i.e., v_n. */\n public getV(): number {\n return this._currentUV.y;\n }\n /** Update the current uv parameter by currentStep, i.e., compute `X_{n+1} := X_n - dX = (u_n - du, v_n - dv)`. */\n public applyCurrentStep(): void {\n this.setUV(this._currentUV.x - this._currentStep.x, this._currentUV.y - this._currentStep.y);\n }\n /**\n * Evaluate the functions and derivatives at `X_n = (u_n, v_n)`, and solve the Jacobian matrix equation to\n * compute `dX = (du, dv)`.\n */\n public computeStep(): boolean {\n if (!this._func.evaluate(this._currentUV.x, this._currentUV.y))\n return false;\n const fA = this._func.currentF;\n const jCol0 = fA.vectorU;\n const jCol1 = fA.vectorV;\n const fX = fA.origin;\n // Given X_{n+1} = X_n - dX = X_n - JInv(X_n) F(X_n), we solve J(X_n) dX = F(X_n) for dX:\n if (SmallSystem.linearSystem2d(jCol0.x, jCol1.x, jCol0.y, jCol1.y, fX.x, fX.y, this._currentStep))\n return true;\n return false;\n }\n /**\n * Return the current relative step size, i.e., the larger absolute component of `dX / (1 + |X_n|)`\n */\n public currentStepSize(): number {\n return Geometry.maxAbsXY(\n this._currentStep.x / (1.0 + Math.abs(this._currentUV.x)),\n this._currentStep.y / (1.0 + Math.abs(this._currentUV.y)),\n );\n }\n /** Candidate solution cache. */\n private _cachedUV: Point2d | undefined;\n /** The current late iterate has the least delta encountered. Remember it. */\n protected override cacheCandidate(): void {\n if (this._cachedUV)\n this._cachedUV.setFrom(this._currentUV);\n else\n this._cachedUV = this._currentUV.clone();\n }\n /** Set Newton result to the cached candidate. */\n protected override restoreCandidate(): void {\n if (this._cachedUV)\n this.setUV(this._cachedUV.x, this._cachedUV.y);\n }\n}\n/**\n * SimpleNewton has static methods for newton methods with evaluated functions presented as immediate arguments\n * (not function object).\n * @internal\n */\nexport class SimpleNewton {\n /**\n * Run a one-dimensional newton iteration with separate functions for function and derivative.\n * * Completion is at 2 (TWO) successive passes at `absoluteTolerance + relTol * abs(x)`, where relTol is\n * chosen internally.\n * * `absoluteTolerance` is usually aggressively tight -- should come into play only for x near zero.\n * * The `relTol` is fluffy (for instance around 1e-11) but in properly converging cases the extra pass after\n * first success normally moves to full machine precision.\n * * This is an open-loop newton -- it just runs, and returns undefined if anything bad happens.\n */\n public static runNewton1D(\n x: number,\n func: (x: number) => number | undefined,\n derivative: (x: number) => number | undefined,\n absoluteTolerance: number = Geometry.smallFloatingPoint,\n ): number | undefined {\n let numConverged = 0;\n let tolerance: number;\n const relTol = Geometry.smallNewtonStep;\n for (let iteration = 0; iteration < 20; iteration++) {\n const f = func(x);\n const df = derivative(x);\n if (f !== undefined && df !== undefined) {\n const dx = Geometry.conditionalDivideCoordinate(f, df);\n if (dx === undefined)\n return undefined;\n x -= dx;\n // console.log(x); // print approximations for debug\n tolerance = absoluteTolerance + Math.abs(x) * relTol;\n if (Math.abs(dx) < tolerance) {\n numConverged++;\n if (dx === 0.0 || numConverged > 1) // bypass convergence count on true 0 dx\n return x;\n } else {\n numConverged = 0;\n }\n }\n }\n return undefined;\n }\n}\n\n/**\n * Class to evaluate XY intersection between 2 curve primitives using the Newton method.\n * @internal\n */\nexport class CurveCurveIntersectionXYRRToRRD extends NewtonEvaluatorRRtoRRD {\n private _curveP: CurvePrimitive;\n private _curveQ: CurvePrimitive;\n private _rayP: Ray3d;\n private _rayQ: Ray3d;\n constructor(curveP: CurvePrimitive, curveQ: CurvePrimitive) {\n super();\n this._curveP = curveP;\n this._curveQ = curveQ;\n this._rayP = Ray3d.createZero();\n this._rayQ = Ray3d.createZero();\n }\n public evaluate(fractionU: number, fractionV: number): boolean {\n /**\n * To find an intersection between xy-curves P(u) = (x_p(u), y_p(u)) and Q(v) = (x_q(v), y_q(v)) we should solve\n * F(u,v) := P(u) - Q(v) = (0,0)\n * Using the Newton method we can find the fractions u and v at the intersection via\n * [u_{n+1}] [u_n] [x_p'(u_n) -x_q'(v_n)] [x_p(u_n) - x_q(v_n)]\n * = - Inv( )\n * [v_{n+1}] [v_n] [y_p'(u_n) -y_q'(v_n)] [y_p(u_n) - y_q(v_n)]\n * Note that this is xy intersection so we can ignore z.\n */\n this._curveP.fractionToPointAndDerivative(fractionU, this._rayP);\n this._curveQ.fractionToPointAndDerivative(fractionV, this._rayQ);\n this.currentF.setOriginAndVectorsXYZ(\n this._rayP.origin.x - this._rayQ.origin.x, this._rayP.origin.y - this._rayQ.origin.y, 0.0,\n this._rayP.direction.x, this._rayP.direction.y, 0.0,\n -this._rayQ.direction.x, -this._rayQ.direction.y, 0.0,\n );\n return true;\n }\n}\n\n/**\n * Class to evaluate XY close approach between a curve primitive and a point using the Newton method.\n * @internal\n */\nexport class CurvePointCloseApproachXYRtoRD extends NewtonEvaluatorRtoRD {\n private _curveP: CurvePrimitive;\n private _pointQ: Point3d;\n private _planeP: Plane3dByOriginAndVectors;\n constructor(curveP: CurvePrimitive, pointQ: Point3d) {\n super();\n this._curveP = curveP;\n this._pointQ = pointQ;\n this._planeP = Plane3dByOriginAndVectors.createXYPlane();\n }\n public evaluate(fractionU: number): boolean {\n /**\n * To find a close approach between xy-curve P(u) and xy-point q we should solve\n * F(u) := P'(u).(P(u) - q) = 0\n * For a solution u, the segment S(u) := P(u) - q is perpendicular to the curve tangent P'(u), which means S(u) is\n * a close approach.\n * Using the Newton method we can find the fractions u at the close approach location via\n * u_{n+1} = u_n + F(u_n)/F'(u_n) = u_n + [ P'(u_n).S(u_n) ]/[ P''(u_n).S(u_n) + P'(u_n).P'(u_n) ]\n * Note that this is xy close approach so we can ignore z.\n */\n this._curveP.fractionToPointAnd2Derivatives(fractionU, this._planeP);\n const segX = this._planeP.origin.x - this._pointQ.x;\n const segY = this._planeP.origin.y - this._pointQ.y;\n const pDerivX = this._planeP.vectorU.x;\n const pDerivY = this._planeP.vectorU.y;\n const p2DerivX = this._planeP.vectorV.x;\n const p2DerivY = this._planeP.vectorV.y;\n this.currentF = pDerivX * segX + pDerivY * segY;\n this.currentdFdX = p2DerivX * segX + pDerivX * pDerivX + p2DerivY * segY + pDerivY * pDerivY;\n return true;\n }\n}\n\n/**\n * Class to evaluate XY close approach between 2 curve primitives using the Newton method.\n * @internal\n */\nexport class CurveCurveCloseApproachXYRRtoRRD extends NewtonEvaluatorRRtoRRD {\n private _curveP: CurvePrimitive;\n private _curveQ: CurvePrimitive;\n private _planeP: Plane3dByOriginAndVectors;\n private _planeQ: Plane3dByOriginAndVectors;\n constructor(curveP: CurvePrimitive, curveQ: CurvePrimitive) {\n super();\n this._curveP = curveP;\n this._curveQ = curveQ;\n this._planeP = Plane3dByOriginAndVectors.createXYPlane();\n this._planeQ = Plane3dByOriginAndVectors.createXYPlane();\n }\n public evaluate(fractionU: number, fractionV: number): boolean {\n /**\n * To find a close approach between xy-curves P(u) and Q(v) we should solve\n * F(u,v) := (P'(u).(P(u) - Q(v)), Q'(v).(P(u) - Q(v))) = (0,0)\n * For a solution (u,v), the segment S(u,v) := P(u) - Q(v) is perpendicular to the curve tangents P'(u) and Q'(v),\n * which means S(u,v) is a close approach.\n * Using the Newton method we can find the fractions u and v at the close approach location via\n * [u_{n+1}] [u_n] [P''(u_n).S(u_n,v_n) + P'(u_n).P'(u_n) -P'(u_n).Q'(v_n)] [P'(u_n).S(u_n,v_n)]\n * = - Inv( )\n * [v_{n+1}] [v_n] [Q'(v_n).P'(u_n) Q''(v_n).S(u_n,v_n) - Q'(v_n).Q'(v_n)] [Q'(v_n).S(u_n,v_n)]\n * Note that this is xy close approach so we can ignore z.\n */\n this._curveP.fractionToPointAnd2Derivatives(fractionU, this._planeP);\n this._curveQ.fractionToPointAnd2Derivatives(fractionV, this._planeQ);\n const segX = this._planeP.origin.x - this._planeQ.origin.x;\n const segY = this._planeP.origin.y - this._planeQ.origin.y;\n const pDerivX = this._planeP.vectorU.x;\n const pDerivY = this._planeP.vectorU.y;\n const qDerivX = this._planeQ.vectorU.x;\n const qDerivY = this._planeQ.vectorU.y;\n const p2DerivX = this._planeP.vectorV.x;\n const p2DerivY = this._planeP.vectorV.y;\n const q2DerivX = this._planeQ.vectorV.x;\n const q2DerivY = this._planeQ.vectorV.y;\n this.currentF.setOriginAndVectorsXYZ(\n pDerivX * segX + pDerivY * segY,\n qDerivX * segX + qDerivY * segY,\n 0.0,\n p2DerivX * segX + p2DerivY * segY + pDerivX * pDerivX + pDerivY * pDerivY,\n qDerivX * pDerivX + qDerivY * pDerivY,\n 0.0,\n -(pDerivX * qDerivX + pDerivY * qDerivY),\n q2DerivX * segX + q2DerivY * segY - qDerivX * qDerivX - qDerivY * qDerivY,\n 0.0,\n );\n return true;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loop.d.ts","sourceRoot":"","sources":["../../../src/curve/Loop.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,OAAO,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kBAAkB;gBAEhB,KAAK,EAAE,IAAI,GAAG,SAAS,EAAE,MAAM,EAAE,cAAc,GAAG,SAAS,EAAE,KAAK,EAAE,IAAI,GAAG,SAAS,EAAE,MAAM,EAAE,cAAc,GAAG,SAAS;IAO1H,uCAAuC;IAChC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc;IAI7C,uCAAuC;IAChC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc;CAI9C;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,iFAAiF;IACjF,iBAAiB,EAAE,IAAI,EAAE,CAAC;IAC1B,0EAA0E;IAC1E,iBAAiB,EAAE,IAAI,EAAE,CAAC;IAC1B,mEAAmE;IACnE,OAAO,EAAE,IAAI,EAAE,CAAC;IAChB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC9B"}
|
package/lib/esm/curve/Loop.js
CHANGED
|
@@ -84,7 +84,9 @@ export class Loop extends CurveChain {
|
|
|
84
84
|
}
|
|
85
85
|
/** Create a new `Loop` with no children */
|
|
86
86
|
cloneEmptyPeer() {
|
|
87
|
-
|
|
87
|
+
const emptyClone = new Loop();
|
|
88
|
+
emptyClone.isInner = this.isInner;
|
|
89
|
+
return emptyClone;
|
|
88
90
|
}
|
|
89
91
|
/** Second step of double dispatch: call `handler.handleLoop(this)` */
|
|
90
92
|
dispatchToGeometryHandler(handler) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loop.js","sourceRoot":"","sources":["../../../src/curve/Loop.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAQ/F,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;;GAIG;AACH,MAAM,OAAO,IAAK,SA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,EAAE,CAAC;QAC9B,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAClC,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,uEAAuE;IAChE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAC7B,iBAAiB;IACV,KAAK,CAAQ;IACpB,2CAA2C;IACpC,MAAM,CAAkB;IAC/B,kBAAkB;IACX,KAAK,CAAQ;IACpB,2CAA2C;IACpC,MAAM,CAAkB;IAC/B,kBAAkB;IAClB,YACE,KAAuB,EAAE,MAAkC,EAAE,KAAuB,EAAE,MAAkC;QAExH,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IACD,uCAAuC;IAChC,IAAI,CAAC,IAAU,EAAE,KAAqB;QAC3C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,uCAAuC;IAChC,IAAI,CAAC,IAAU,EAAE,KAAqB;QAC3C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Curve\n */\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\nimport { CurveChainWithDistanceIndex } from \"./CurveChainWithDistanceIndex\";\nimport { CurveChain } from \"./CurveCollection\";\nimport { CurvePrimitive } from \"./CurvePrimitive\";\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\nimport { GeometryQuery } from \"./GeometryQuery\";\nimport { LineString3d } from \"./LineString3d\";\nimport { StrokeOptions } from \"./StrokeOptions\";\n\n/**\n * A `Loop` is a curve chain that is the boundary of a closed (planar) loop.\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\n * @public\n */\nexport class Loop extends CurveChain {\n /** String name for schema properties */\n public readonly curveCollectionType = \"loop\";\n /** Tag value that can be set to true for user code to mark inner and outer loops. */\n public override isInner: boolean = false;\n /** Test if `other` is a `Loop` */\n public isSameGeometryClass(other: GeometryQuery): boolean {\n return other instanceof Loop;\n }\n public constructor() {\n super();\n }\n /**\n * Create a loop from a variable length list of [[CurvePrimitive]]s.\n * * A significant gap between the end of one curve and the start of the next, or between chain start and end,\n * is not bridged and may cause unexpected behavior.\n * @param curves array of individual curve primitives, assumed to form a closed planar loop.\n */\n public static create(...curves: CurvePrimitive[]): Loop {\n const result = new Loop();\n for (const curve of curves) {\n if (curve instanceof CurveChainWithDistanceIndex)\n result.children.push(...curve.path.children);\n else\n result.children.push(curve);\n }\n return result;\n }\n /**\n * Create a loop from an array of [[CurvePrimitive]]s.\n * * A significant gap between the end of one curve and the start of the next, or between chain start and end,\n * is not bridged and may cause unexpected behavior.\n * @param curves array of individual curve primitives, assumed to form a closed planar loop.\n */\n public static createArray(curves: CurvePrimitive[]): Loop {\n return this.create(...curves);\n }\n /**\n * Create a loop from an array of coplanar points.\n * @param points vertices of polygon, closure point optional.\n */\n public static createPolygon(points: IndexedXYZCollection | Point3d[]): Loop {\n const linestring = LineString3d.create(points);\n linestring.addClosurePoint();\n return Loop.create(linestring);\n }\n /** Create a loop with the stroked form of this loop. */\n public cloneStroked(options?: StrokeOptions): Loop {\n const strokes = LineString3d.create();\n for (const curve of this.children)\n curve.emitStrokes(strokes, options);\n // eliminate near-duplicate points between children\n strokes.removeDuplicatePoints();\n if (strokes.isPhysicallyClosed) {\n strokes.popPoint();\n strokes.addClosurePoint();\n }\n return Loop.create(strokes);\n }\n /** Return the boundary type (2) of a corresponding MicroStation CurveVector */\n public dgnBoundaryType(): number {\n /**\n * All \"Loop\" become \"outer\". TypeScript Loop object is equivalent to a native CurveVector with\n * boundaryType = BOUNDARY_TYPE_Outer. In other words, TypeScript has no flavor of Loop that\n * carries \"hole\" semantics.\n */\n return 2;\n }\n /** Invoke `processor.announceLoop(this, indexInParent)` */\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\n return processor.announceLoop(this, indexInParent);\n }\n /** Create a new `Loop` with no children */\n public cloneEmptyPeer(): Loop {\n const emptyClone = new Loop();\n emptyClone.isInner = this.isInner;\n return emptyClone;\n }\n /** Second step of double dispatch: call `handler.handleLoop(this)` */\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\n return handler.handleLoop(this);\n }\n}\n\n/**\n * Structure carrying a pair of loops with curve geometry.\n * @public\n */\nexport class LoopCurveLoopCurve {\n /** First loop */\n public loopA?: Loop;\n /** A curve (typically an edge of loopA) */\n public curveA?: CurvePrimitive;\n /** second loop */\n public loopB?: Loop;\n /** A curve (typically an edge of loopB) */\n public curveB?: CurvePrimitive;\n /** Constructor */\n public constructor(\n loopA: Loop | undefined, curveA: CurvePrimitive | undefined, loopB: Loop | undefined, curveB: CurvePrimitive | undefined,\n ) {\n this.loopA = loopA;\n this.curveA = curveA;\n this.loopB = loopB;\n this.curveB = curveB;\n }\n /** Set the loopA and curveA members */\n public setA(loop: Loop, curve: CurvePrimitive) {\n this.loopA = loop;\n this.curveA = curve;\n }\n /** Set the loopB and curveB members */\n public setB(loop: Loop, curve: CurvePrimitive) {\n this.loopB = loop;\n this.curveB = curve;\n }\n}\n\n/**\n * Carrier object for loops characterized by area sign\n * @public\n */\nexport interface SignedLoops {\n /** Array of loops that have positive area sign (i.e. counterclockwise loops). */\n positiveAreaLoops: Loop[];\n /** Array of loops that have negative area sign (i.e. clockwise loops). */\n negativeAreaLoops: Loop[];\n /** Slivers where there are coincident sections of input curves. */\n slivers: Loop[];\n /** Array indicating edges between loops */\n edges?: LoopCurveLoopCurve[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClosestPointStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAY,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,sCAAsC,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAA+B,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAC5D,MAAM,CAA6B;IACnC,aAAa,CAAkC;IAC/C,WAAW,CAAU;IACrB,OAAO,CAA8B;IACrC,OAAO,CAAU;IACzB,iFAAiF;IACzE,UAAU,GAAW,CAAC,CAAC;IACvB,UAAU,GAAW,CAAC,CAAC;IAC/B,uFAAuF;IAC/E,UAAU,GAAW,CAAC,CAAC;IACvB,UAAU,GAAW,CAAC,CAAC;IACvB,aAAa,GAAW,CAAC,CAAC;IAClC,qCAAqC;IAC7B,UAAU,CAAU;IACpB,QAAQ,CAAQ;IAChB,aAAa,CAAyC;IAC9D,kBAAkB;IAClB,YAAmB,UA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AAI,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE,oFAAoF;YAChH,IAAI,CAAC,cAAc,EAAE,CAAC;QACxB,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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Geometry } from \"../../Geometry\";\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Newton1dUnboundedApproximateDerivative, NewtonRtoRStrokeHandler } from \"../../numerics/Newton\";\nimport { SmallSystem } from \"../../numerics/SmallSystem\";\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"../CurveExtendMode\";\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\n\n/**\n * Context for searching for the closest point to a CurvePrimitive.\n * @internal\n */\nexport class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\n private _curve: CurvePrimitive | undefined;\n private _closestPoint: CurveLocationDetail | undefined;\n private _spacePoint: Point3d;\n private _extend: VariantCurveExtendParameter;\n private _xyOnly: boolean;\n // fraction and function value on one side of an interval that may bracket a root\n private _fractionA: number = 0;\n private _functionA: number = 0;\n // fraction and function value on the other side of an interval that may bracket a root\n private _fractionB: number = 0;\n private _functionB: number = 0;\n private _numThisCurve: number = 0;\n // scratch vars to use within methods\n private _workPoint: Point3d;\n private _workRay: Ray3d;\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\n /** Constructor */\n public constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail, xyOnly?: boolean) {\n super();\n this._spacePoint = spacePoint;\n this._workPoint = Point3d.create();\n this._workRay = Ray3d.createZero();\n this._closestPoint = result;\n if (this._closestPoint)\n this._closestPoint.a = Geometry.largeCoordinateResult\n this._extend = extend ?? false;\n this._xyOnly = xyOnly ?? false;\n this.startCurvePrimitive(undefined);\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\n }\n public claimResult(): CurveLocationDetail | undefined {\n if (this._closestPoint) {\n this._newtonSolver.setX(this._closestPoint.fraction);\n this._curve = this._closestPoint.curve;\n if (this._newtonSolver.runIterations()) {\n let fraction = this._newtonSolver.getX();\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\n this.announceSolutionFraction(fraction);\n }\n }\n return this._closestPoint;\n }\n public needPrimaryGeometryForStrokes() {\n return true;\n }\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\n this._curve = curve;\n this._fractionA = 0.0;\n this._numThisCurve = 0;\n this._functionA = 0.0;\n }\n public endCurvePrimitive() {\n }\n public announceIntervalForUniformStepStrokes(\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\n ): void {\n this.startCurvePrimitive(cp);\n this.announceSolutionFraction(0.0); // test start point as closest\n this.announceSolutionFraction(1.0); // test end point as closest\n if (numStrokes < 1)\n numStrokes = 1;\n const df = 1.0 / numStrokes;\n for (let i = 0; i <= numStrokes; i++) {\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\n cp.fractionToPointAndDerivative(fraction, this._workRay);\n this.announceRay(fraction, this._workRay);\n }\n }\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\n const distance = this._xyOnly ? this._spacePoint.distanceXY(point) : this._spacePoint.distance(point);\n if (this._closestPoint && distance > this._closestPoint.a)\n return;\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\n this._closestPoint.a = distance;\n if (this._parentCurvePrimitive !== undefined)\n this._closestPoint.curve = this._parentCurvePrimitive;\n }\n public announceSegmentInterval(\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number,\n ): void {\n let localFraction = 0;\n if (this._xyOnly)\n localFraction = SmallSystem.lineSegment3dXYClosestPointUnbounded(point0, point1, this._spacePoint) ?? 0;\n else\n localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\n // only consider segment extension at a parent curve endpoint, i.e. when fraction0 is 0 or fraction1 is 1\n const extend0 = (fraction0 === 0) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 0) : CurveExtendMode.None;\n const extend1 = (fraction1 === 1) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 1) : CurveExtendMode.None;\n localFraction = CurveExtendOptions.correctFraction([extend0, extend1], localFraction);\n this._workPoint = point0.interpolate(localFraction, point1);\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\n this.announceCandidate(cp, globalFraction, this._workPoint);\n }\n /**\n * Given a function `f` and (unordered) fractions `a` and `b`, search for and announce a root of `f` in this\n * fractional interval.\n * * This method searches for a root of `f` if and only if the stroke segment defined by `(a, f(a))` and\n * `(b, f(b))` has a root. This is a HEURISTIC: given continuous `f` between `a` and `b`, a root of the stroke\n * segment implies a root of `f`, but not vice-versa. Therefore, if the strokes are not sufficiently dense,\n * this method can miss a root of `f`.\n */\n private searchInterval() {\n if (this._functionA * this._functionB > 0)\n return; // stroke segment has no root; ASSUME the function has no root either\n if (this._functionA === 0)\n this.announceSolutionFraction(this._fractionA);\n if (this._functionB === 0)\n this.announceSolutionFraction(this._fractionB);\n // by the Intermediate Value Theorem, a root lies between fractionA and fractionB; use Newton to find it.\n if (this._functionA * this._functionB < 0) {\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\n if (fraction) {\n this._newtonSolver.setX(fraction);\n if (this._newtonSolver.runIterations())\n this.announceSolutionFraction(this._newtonSolver.getX());\n }\n }\n }\n private announceSolutionFraction(fraction: number) {\n if (this._curve)\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\n }\n /**\n * Evaluate the univariate real-valued function for which we are finding roots.\n * * For finding the closest point to curve X from point Q, this function is `f(t) := Q-X(t) dot X'(t)`.\n * * Either `pointAndDerivative` must be defined, or both `fraction` and `curve`.\n * @param pointAndDerivative pre-evaluated curve\n * @param fraction fraction at which to evaluate `curve`\n * @param curve curve to evaluate at `fraction`\n */\n private evaluateFunction(pointAndDerivative?: Ray3d, fraction?: number, curve?: CurvePrimitive): number | undefined {\n if (pointAndDerivative)\n this._workRay.setFrom(pointAndDerivative);\n else if (fraction !== undefined && curve)\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\n else\n return undefined;\n if (this._xyOnly)\n return this._workRay.dotProductToPointXY(this._spacePoint);\n else\n return this._workRay.dotProductToPoint(this._spacePoint);\n }\n public evaluate(fraction: number): boolean {\n let curve = this._curve;\n if (this._parentCurvePrimitive)\n curve = this._parentCurvePrimitive;\n const value = this.evaluateFunction(undefined, fraction, curve);\n if (value === undefined)\n return false;\n this.currentF = value;\n return true;\n }\n private announceRay(fraction: number, data: Ray3d): void {\n const value = this.evaluateFunction(data);\n assert(value !== undefined, \"expect defined because evaluateFunction never returns undefined for input Ray3d\");\n this._functionB = value;\n this._fractionB = fraction;\n if (this._numThisCurve++ > 0) // after the first stroke point, a stroke segment is defined, so we have an interval\n this.searchInterval();\n this._functionA = this._functionB;\n this._fractionA = this._fractionB;\n }\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\n this._workRay.set(point, tangent);\n this.announceRay(fraction, this._workRay);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ClosestPointStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAY,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,sCAAsC,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAA+B,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAC5D,MAAM,CAA6B;IACnC,aAAa,CAAkC;IAC/C,WAAW,CAAU;IACrB,OAAO,CAA8B;IACrC,OAAO,CAAU;IACzB,iFAAiF;IACzE,UAAU,GAAW,CAAC,CAAC;IACvB,UAAU,GAAW,CAAC,CAAC;IAC/B,uFAAuF;IAC/E,UAAU,GAAW,CAAC,CAAC;IACvB,UAAU,GAAW,CAAC,CAAC;IACvB,aAAa,GAAW,CAAC,CAAC;IAClC,qCAAqC;IAC7B,UAAU,CAAU;IACpB,QAAQ,CAAQ;IAChB,aAAa,CAAyC;IAC9D,kBAAkB;IAClB,YAAmB,UAAmB,EAAE,MAAoC,EAAE,MAA4B,EAAE,MAAgB;QAC1H,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,OAAO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AAI,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":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Curve\n */\n\nimport { assert } from \"@itwin/core-bentley\";\nimport { Geometry } from \"../../Geometry\";\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\nimport { Newton1dUnboundedApproximateDerivative, NewtonRtoRStrokeHandler } from \"../../numerics/Newton\";\nimport { SmallSystem } from \"../../numerics/SmallSystem\";\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"../CurveExtendMode\";\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\nimport { CurvePrimitive } from \"../CurvePrimitive\";\n\n/**\n * Context for searching for the closest point to a CurvePrimitive.\n * @internal\n */\nexport class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\n private _curve: CurvePrimitive | undefined;\n private _closestPoint: CurveLocationDetail | undefined;\n private _spacePoint: Point3d;\n private _extend: VariantCurveExtendParameter;\n private _xyOnly: boolean;\n // fraction and function value on one side of an interval that may bracket a root\n private _fractionA: number = 0;\n private _functionA: number = 0;\n // fraction and function value on the other side of an interval that may bracket a root\n private _fractionB: number = 0;\n private _functionB: number = 0;\n private _numThisCurve: number = 0;\n // scratch vars to use within methods\n private _workPoint: Point3d;\n private _workRay: Ray3d;\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\n /** Constructor */\n public constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail, xyOnly?: boolean) {\n super();\n this._spacePoint = spacePoint;\n this._workPoint = Point3d.create();\n this._workRay = Ray3d.createZero();\n this._closestPoint = result;\n if (this._closestPoint)\n this._closestPoint.a = Geometry.largeCoordinateResult;\n this._extend = extend ?? false;\n this._xyOnly = xyOnly ?? false;\n this.startCurvePrimitive(undefined);\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\n }\n public claimResult(): CurveLocationDetail | undefined {\n if (this._closestPoint) {\n this._newtonSolver.setX(this._closestPoint.fraction);\n this._curve = this._closestPoint.curve;\n if (this._newtonSolver.runIterations()) {\n let fraction = this._newtonSolver.getX();\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\n this.announceSolutionFraction(fraction);\n }\n }\n return this._closestPoint;\n }\n public needPrimaryGeometryForStrokes() {\n return true;\n }\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\n this._curve = curve;\n this._fractionA = 0.0;\n this._numThisCurve = 0;\n this._functionA = 0.0;\n }\n public endCurvePrimitive() {\n }\n public announceIntervalForUniformStepStrokes(\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\n ): void {\n this.startCurvePrimitive(cp);\n this.announceSolutionFraction(0.0); // test start point as closest\n this.announceSolutionFraction(1.0); // test end point as closest\n if (numStrokes < 1)\n numStrokes = 1;\n const df = 1.0 / numStrokes;\n for (let i = 0; i <= numStrokes; i++) {\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\n cp.fractionToPointAndDerivative(fraction, this._workRay);\n this.announceRay(fraction, this._workRay);\n }\n }\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\n const distance = this._xyOnly ? this._spacePoint.distanceXY(point) : this._spacePoint.distance(point);\n if (this._closestPoint && distance > this._closestPoint.a)\n return;\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\n this._closestPoint.a = distance;\n if (this._parentCurvePrimitive !== undefined)\n this._closestPoint.curve = this._parentCurvePrimitive;\n }\n public announceSegmentInterval(\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number,\n ): void {\n let localFraction = 0;\n if (this._xyOnly)\n localFraction = SmallSystem.lineSegment3dXYClosestPointUnbounded(point0, point1, this._spacePoint) ?? 0;\n else\n localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\n // only consider segment extension at a parent curve endpoint, i.e. when fraction0 is 0 or fraction1 is 1\n const extend0 = (fraction0 === 0) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 0) : CurveExtendMode.None;\n const extend1 = (fraction1 === 1) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 1) : CurveExtendMode.None;\n localFraction = CurveExtendOptions.correctFraction([extend0, extend1], localFraction);\n this._workPoint = point0.interpolate(localFraction, point1);\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\n this.announceCandidate(cp, globalFraction, this._workPoint);\n }\n /**\n * Given a function `f` and (unordered) fractions `a` and `b`, search for and announce a root of `f` in this\n * fractional interval.\n * * This method searches for a root of `f` if and only if the stroke segment defined by `(a, f(a))` and\n * `(b, f(b))` has a root. This is a HEURISTIC: given continuous `f` between `a` and `b`, a root of the stroke\n * segment implies a root of `f`, but not vice-versa. Therefore, if the strokes are not sufficiently dense,\n * this method can miss a root of `f`.\n */\n private searchInterval() {\n if (this._functionA * this._functionB > 0)\n return; // stroke segment has no root; ASSUME the function has no root either\n if (this._functionA === 0)\n this.announceSolutionFraction(this._fractionA);\n if (this._functionB === 0)\n this.announceSolutionFraction(this._fractionB);\n // by the Intermediate Value Theorem, a root lies between fractionA and fractionB; use Newton to find it.\n if (this._functionA * this._functionB < 0) {\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\n if (fraction) {\n this._newtonSolver.setX(fraction);\n if (this._newtonSolver.runIterations())\n this.announceSolutionFraction(this._newtonSolver.getX());\n }\n }\n }\n private announceSolutionFraction(fraction: number) {\n if (this._curve)\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\n }\n /**\n * Evaluate the univariate real-valued function for which we are finding roots.\n * * For finding the closest point to curve X from point Q, this function is `f(t) := Q-X(t) dot X'(t)`.\n * * Either `pointAndDerivative` must be defined, or both `fraction` and `curve`.\n * @param pointAndDerivative pre-evaluated curve\n * @param fraction fraction at which to evaluate `curve`\n * @param curve curve to evaluate at `fraction`\n */\n private evaluateFunction(pointAndDerivative?: Ray3d, fraction?: number, curve?: CurvePrimitive): number | undefined {\n if (pointAndDerivative)\n this._workRay.setFrom(pointAndDerivative);\n else if (fraction !== undefined && curve)\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\n else\n return undefined;\n if (this._xyOnly)\n return this._workRay.dotProductToPointXY(this._spacePoint);\n else\n return this._workRay.dotProductToPoint(this._spacePoint);\n }\n public evaluate(fraction: number): boolean {\n let curve = this._curve;\n if (this._parentCurvePrimitive)\n curve = this._parentCurvePrimitive;\n const value = this.evaluateFunction(undefined, fraction, curve);\n if (value === undefined)\n return false;\n this.currentF = value;\n return true;\n }\n private announceRay(fraction: number, data: Ray3d): void {\n const value = this.evaluateFunction(data);\n assert(value !== undefined, \"expect defined because evaluateFunction never returns undefined for input Ray3d\");\n this._functionB = value;\n this._fractionB = fraction;\n if (this._numThisCurve++ > 0) // after the first stroke point, a stroke segment is defined, so we have an interval\n this.searchInterval();\n this._functionA = this._functionB;\n this._fractionA = this._fractionB;\n }\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\n this._workRay.set(point, tangent);\n this.announceRay(fraction, this._workRay);\n }\n}\n"]}
|
|
@@ -167,14 +167,6 @@ export declare class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHa
|
|
|
167
167
|
allPerpendicularsArcArcBounded(arcA: Arc3d, arcB: Arc3d, reversed?: boolean): void;
|
|
168
168
|
/** Low level dispatch of arc with Arc3d. */
|
|
169
169
|
private dispatchArcArc;
|
|
170
|
-
/** Low level dispatch of arc with (beziers of) a bspline curve */
|
|
171
|
-
private dispatchArcBsplineCurve3d;
|
|
172
|
-
/** Low level dispatch of (beziers of) a bspline curve with (beziers of) a bspline curve */
|
|
173
|
-
private dispatchBSplineCurve3dBSplineCurve3d;
|
|
174
|
-
/** Low level dispatch of linestring with (beziers of) a bspline curve */
|
|
175
|
-
private dispatchLineStringBSplineCurve;
|
|
176
|
-
/** Low level dispatch of segment with (beziers of) a bspline curve */
|
|
177
|
-
private dispatchSegmentBsplineCurve;
|
|
178
170
|
/** Detail computation for segment approaching linestring. */
|
|
179
171
|
private computeSegmentLineString;
|
|
180
172
|
/** Detail computation for arc approaching linestring. */
|
|
@@ -202,23 +194,17 @@ export declare class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHa
|
|
|
202
194
|
private dispatchCurveCollection;
|
|
203
195
|
/** Low level dispatch to geomA given a CurveChainWithDistanceIndex in geometryB. */
|
|
204
196
|
private dispatchCurveChainWithDistanceIndex;
|
|
205
|
-
/**
|
|
206
|
-
|
|
207
|
-
/** Double dispatch handler for strongly typed linestring. */
|
|
208
|
-
handleLineString3d(lsA: LineString3d): any;
|
|
209
|
-
/** Double dispatch handler for strongly typed arc. */
|
|
210
|
-
handleArc3d(arcA: Arc3d): any;
|
|
211
|
-
/** Double dispatch handler for strongly typed bspline curve. */
|
|
212
|
-
handleBSplineCurve3d(curveA: BSplineCurve3d): any;
|
|
197
|
+
/** Specifies whether the curve needs to be stroked for close approach computation. */
|
|
198
|
+
private needsStroking;
|
|
213
199
|
/**
|
|
214
|
-
* Process seeds for xy close approach between
|
|
200
|
+
* Process seeds for xy close approach between one curve and another curve to be stroked.
|
|
215
201
|
* * Refine each result via Newton iteration. If it doesn't converge, remove it.
|
|
216
|
-
* @param seeds
|
|
217
|
-
* @param curveA
|
|
218
|
-
* @param
|
|
219
|
-
* @param reversed whether `
|
|
202
|
+
* @param seeds the initial seed results to refine.
|
|
203
|
+
* @param curveA curve to find its XY close approach with curveB.
|
|
204
|
+
* @param curveB the other curve to be stroked.
|
|
205
|
+
* @param reversed whether `curveB` data is in `detailA` of each recorded pair, and `curveA` data in `detailB`.
|
|
220
206
|
*/
|
|
221
|
-
private
|
|
207
|
+
private refineStrokedResultsByNewton;
|
|
222
208
|
/**
|
|
223
209
|
* Append stroke points and return the line string.
|
|
224
210
|
* * This is a convenient wrapper for [[CurvePrimitive.emitStrokes]] but the analogous instance method cannot be added
|
|
@@ -230,12 +216,20 @@ export declare class CurveCurveCloseApproachXY extends RecurseToCurvesGeometryHa
|
|
|
230
216
|
/** Find and return the close approaches between curveA and the discretization of curveB. */
|
|
231
217
|
private computeDiscreteCloseApproachResults;
|
|
232
218
|
/**
|
|
233
|
-
* Compute the XY close approach of a curve and
|
|
234
|
-
* @param curveA curve to find its close approach with
|
|
235
|
-
* @param
|
|
236
|
-
* @param reversed whether `
|
|
219
|
+
* Compute the XY close approach of a curve and another curve to be stroked.
|
|
220
|
+
* @param curveA curve to find its XY close approach with curveB.
|
|
221
|
+
* @param curveB the other curve to be stroked.
|
|
222
|
+
* @param reversed whether `curveB` data will be recorded in `detailA` of each result, and `curveA` data in `detailB`.
|
|
237
223
|
*/
|
|
238
|
-
private
|
|
224
|
+
private dispatchCurveStrokedCurve;
|
|
225
|
+
/** Double dispatch handler for strongly typed segment. */
|
|
226
|
+
handleLineSegment3d(segmentA: LineSegment3d): any;
|
|
227
|
+
/** Double dispatch handler for strongly typed linestring. */
|
|
228
|
+
handleLineString3d(lsA: LineString3d): any;
|
|
229
|
+
/** Double dispatch handler for strongly typed arc. */
|
|
230
|
+
handleArc3d(arcA: Arc3d): any;
|
|
231
|
+
/** Double dispatch handler for strongly typed bspline curve. */
|
|
232
|
+
handleBSplineCurve3d(curveA: BSplineCurve3d): any;
|
|
239
233
|
/** Double dispatch handler for strongly typed spiral curve. */
|
|
240
234
|
handleTransitionSpiral(spiral: TransitionSpiral3d): any;
|
|
241
235
|
/** Double dispatch handler for strongly typed CurveChainWithDistanceIndex. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurveCurveCloseApproachXY.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/CurveCurveCloseApproachXY.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAsB,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAOlF,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAG7E,OAAO,EAA0C,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEzG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAKlE;;;;;;;;;;;;;GAaG;AACH,qBAAa,yBAA0B,SAAQ,8BAA8B;IAC3E,OAAO,CAAC,UAAU,CAAuB;IACzC;;;OAGG;IACH,OAAO,CAAC,oBAAoB,CAAqB;IACjD,gFAAgF;IAChF,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,gBAAgB,CAAS;IACjC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAuC;IAEvD,OAAO,CAAC,MAAM,CAAC,aAAa,CAAoB;IAChD,OAAO,CAAC,MAAM,CAAC,aAAa,CAAoB;IAChD,OAAO,CAAC,MAAM,CAAC,aAAa,CAAoB;IAChD,OAAO,C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