@itwin/core-geometry 5.4.0-dev.6 → 5.4.0

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/lib/cjs/bspline/SurfaceLocationDetail.d.ts +1 -1
  3. package/lib/cjs/bspline/SurfaceLocationDetail.js +1 -1
  4. package/lib/cjs/bspline/SurfaceLocationDetail.js.map +1 -1
  5. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  6. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  7. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +13 -0
  8. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  9. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +78 -3
  10. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  11. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +1 -1
  12. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js +1 -1
  13. package/lib/cjs/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  14. package/lib/cjs/curve/spiral/ClothoidSeries.d.ts +3 -3
  15. package/lib/cjs/curve/spiral/ClothoidSeries.d.ts.map +1 -1
  16. package/lib/cjs/curve/spiral/ClothoidSeries.js +15 -11
  17. package/lib/cjs/curve/spiral/ClothoidSeries.js.map +1 -1
  18. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts +2 -5
  19. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
  20. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js +4 -12
  21. package/lib/cjs/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  22. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +7 -6
  23. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  24. package/lib/cjs/curve/spiral/DirectSpiral3d.js +8 -6
  25. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  26. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
  27. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  28. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +9 -5
  29. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  30. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts +8 -7
  31. package/lib/cjs/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  32. package/lib/cjs/curve/spiral/NormalizedTransition.js +32 -16
  33. package/lib/cjs/curve/spiral/NormalizedTransition.js.map +1 -1
  34. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  35. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js +1 -0
  36. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  37. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts +1 -1
  38. package/lib/cjs/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  39. package/lib/cjs/curve/spiral/TransitionSpiral3d.js +1 -0
  40. package/lib/cjs/curve/spiral/TransitionSpiral3d.js.map +1 -1
  41. package/lib/cjs/geometry3d/Ray3d.d.ts +1 -2
  42. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  43. package/lib/cjs/geometry3d/Ray3d.js +1 -2
  44. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  45. package/lib/cjs/numerics/Newton.d.ts +1 -1
  46. package/lib/cjs/numerics/Newton.js +1 -1
  47. package/lib/cjs/numerics/Newton.js.map +1 -1
  48. package/lib/esm/bspline/SurfaceLocationDetail.d.ts +1 -1
  49. package/lib/esm/bspline/SurfaceLocationDetail.js +1 -1
  50. package/lib/esm/bspline/SurfaceLocationDetail.js.map +1 -1
  51. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  52. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  53. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +13 -0
  54. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  55. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +78 -3
  56. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  57. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.d.ts +1 -1
  58. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js +1 -1
  59. package/lib/esm/curve/spiral/AustralianRailCorpXYEvaluator.js.map +1 -1
  60. package/lib/esm/curve/spiral/ClothoidSeries.d.ts +3 -3
  61. package/lib/esm/curve/spiral/ClothoidSeries.d.ts.map +1 -1
  62. package/lib/esm/curve/spiral/ClothoidSeries.js +15 -11
  63. package/lib/esm/curve/spiral/ClothoidSeries.js.map +1 -1
  64. package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts +2 -5
  65. package/lib/esm/curve/spiral/CzechSpiralEvaluator.d.ts.map +1 -1
  66. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js +4 -12
  67. package/lib/esm/curve/spiral/CzechSpiralEvaluator.js.map +1 -1
  68. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +7 -6
  69. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  70. package/lib/esm/curve/spiral/DirectSpiral3d.js +8 -6
  71. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  72. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +2 -2
  73. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  74. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +9 -5
  75. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  76. package/lib/esm/curve/spiral/NormalizedTransition.d.ts +8 -7
  77. package/lib/esm/curve/spiral/NormalizedTransition.d.ts.map +1 -1
  78. package/lib/esm/curve/spiral/NormalizedTransition.js +32 -16
  79. package/lib/esm/curve/spiral/NormalizedTransition.js.map +1 -1
  80. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  81. package/lib/esm/curve/spiral/TransitionConditionalProperties.js +1 -0
  82. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  83. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts +1 -1
  84. package/lib/esm/curve/spiral/TransitionSpiral3d.d.ts.map +1 -1
  85. package/lib/esm/curve/spiral/TransitionSpiral3d.js +1 -0
  86. package/lib/esm/curve/spiral/TransitionSpiral3d.js.map +1 -1
  87. package/lib/esm/geometry3d/Ray3d.d.ts +1 -2
  88. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  89. package/lib/esm/geometry3d/Ray3d.js +1 -2
  90. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  91. package/lib/esm/numerics/Newton.d.ts +1 -1
  92. package/lib/esm/numerics/Newton.js +1 -1
  93. package/lib/esm/numerics/Newton.js.map +1 -1
  94. package/package.json +3 -3
@@ -3,8 +3,8 @@ import { XYCurveEvaluator } from "./XYCurveEvaluator";
3
3
  * Methods to evaluate caller-specified number of terms of the x and y Taylor series for a clothoid.
4
4
  * Each instance has:
5
5
  * * number of x and y terms to use.
6
- * * constant for theta = c*x*x.
7
- * * This value is c = 1/(2*R*L) for curve length L measured from inflection to point with radius R.
6
+ * * constant for theta = cxx.
7
+ * * This value is c = 1/2RL for curve length L measured from inflection to point with radius R.
8
8
  * @internal
9
9
  */
10
10
  export declare class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {
@@ -12,7 +12,7 @@ export declare class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {
12
12
  numXTerms: number;
13
13
  /** Number of terms to use in y Taylor series. */
14
14
  numYTerms: number;
15
- /** Constant c = 1/(2*R*L) in theta = c*s*s. */
15
+ /** Constant c = 1/2RL in theta = cxx. */
16
16
  constantDiv2LR: number;
17
17
  /** The nominal curve length. */
18
18
  nominalLength1: number;
@@ -1 +1 @@
1
- {"version":3,"file":"ClothoidSeries.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/ClothoidSeries.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD;;;;;;;GAOG;AACH,qBAAa,yBAA0B,SAAQ,gBAAgB;IAC7D,iDAAiD;IAC1C,SAAS,EAAE,MAAM,CAAC;IACzB,iDAAiD;IAC1C,SAAS,EAAE,MAAM,CAAC;IACzB,+CAA+C;IACxC,cAAc,EAAE,MAAM,CAAC;IAC9B,gCAAgC;IACzB,cAAc,EAAE,MAAM,CAAC;gBACX,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,GAAE,MAAU,EAAE,SAAS,GAAE,MAAU;IAO/G,2BAA2B;IACpB,KAAK,IAAI,yBAAyB;IAGlC,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAI9C,gCAAgC;IACzB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IASzC;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG5C;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG5C;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG7C;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG7C;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG9C;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG9C;;;;OAIG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAuBzD,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE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AW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG5C;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG7C;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG7C;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG9C;;;OAGG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAG9C;;;;OAIG;IACI,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAyBzD,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAyBzD,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAsB1D,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAsB1D,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAS3D,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAS3D,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAYvC,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAavC,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CASlD"}
@@ -15,8 +15,8 @@ const Newton_1 = require("../../numerics/Newton");
15
15
  * Methods to evaluate caller-specified number of terms of the x and y Taylor series for a clothoid.
16
16
  * Each instance has:
17
17
  * * number of x and y terms to use.
18
- * * constant for theta = c*x*x.
19
- * * This value is c = 1/(2*R*L) for curve length L measured from inflection to point with radius R.
18
+ * * constant for theta = cxx.
19
+ * * This value is c = 1/2RL for curve length L measured from inflection to point with radius R.
20
20
  * @internal
21
21
  */
22
22
  class ClothoidSeriesRLEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
@@ -24,7 +24,7 @@ class ClothoidSeriesRLEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
24
24
  numXTerms;
25
25
  /** Number of terms to use in y Taylor series. */
26
26
  numYTerms;
27
- /** Constant c = 1/(2*R*L) in theta = c*s*s. */
27
+ /** Constant c = 1/2RL in theta = cxx. */
28
28
  constantDiv2LR;
29
29
  /** The nominal curve length. */
30
30
  nominalLength1;
@@ -101,10 +101,12 @@ class ClothoidSeriesRLEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
101
101
  * @param numTerms number of terms to use.
102
102
  */
103
103
  fractionToXGo(fraction, numTerms) {
104
- // write the Taylor series for cos(theta)
105
- // replace theta by s*s*c
106
- // integrate wrt s
107
- // x = s - s^5 c^2/ 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...
104
+ // write the Taylor series for cos(theta):
105
+ // 1 - theta^2 / 2! + theta^4 / 4! - theta^6 / 6! + ...
106
+ // replace theta by s*s*c:
107
+ // 1 - s^4c^2 / 2! + s^8c^4 / 4! - s^12c^6 / 6! + ...
108
+ // integrate wrt s:
109
+ // x = s - s^5 c^2 / 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...
108
110
  // x = s(1 - (s^4 c^2/2) ( 1/5 - (s^4 c^2 / 3*4) (1/9 - ...) ) )
109
111
  const s = fraction * this.nominalLength1;
110
112
  let result = s;
@@ -124,9 +126,11 @@ class ClothoidSeriesRLEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
124
126
  return result;
125
127
  }
126
128
  fractionToYGo(fraction, numTerms) {
127
- // write the Taylor series for sin(theta)
128
- // replace theta by s*s*c
129
- // integrate wrt s
129
+ // write the Taylor series for sin(theta):
130
+ // theta - theta^3 / 3! + theta^5 / 5! - theta^7 / 7! + ...
131
+ // replace theta by s*s*c:
132
+ // s^2 c - s^6 c^3 / 3! + s^10 c^5 / 5! - s^14 c^7 / 7! + ...
133
+ // integrate wrt s:
130
134
  // y = s^3 c / 3 - s^7 c^3 / 7*3! + s^11 c^5 / 11*5! - s^15 c^7 / 15*7! + ...
131
135
  // y = s^3 c ( 1/3 - s^4 c^2/ 3! ( (1/7) - (s^4 c^2 / 4*5) (1/11 - ...) ) )
132
136
  const s = fraction * this.nominalLength1;
@@ -174,7 +178,7 @@ class ClothoidSeriesRLEvaluator extends XYCurveEvaluator_1.XYCurveEvaluator {
174
178
  // dY = q - q^3/3!
175
179
  // q = s^2 c
176
180
  // dY = s^2 c - s^6 c^3/3! + s^10 c^5/ 5!
177
- // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))
181
+ // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))
178
182
  const s = fraction * this.nominalLength1;
179
183
  const q1 = s * s * this.constantDiv2LR;
180
184
  let result = q1;
@@ -1 +1 @@
1
- {"version":3,"file":"ClothoidSeries.js","sourceRoot":"","sources":["../../../../src/curve/spiral/ClothoidSeries.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,6CAA0C;AAC1C,yDAAsD;AACtD,kDAAqD;AAErD;;;;;;;GAOG;AACH,MAAa,yBAA0B,SAAQ,mCAAgB;IAC7D,iDAAiD;IAC1C,SAAS,CAAS;IACzB,iDAAiD;IAC1C,SAAS,CAAS;IACzB,+CAA+C;IACxC,cAAc,CAAS;IAC9B,gCAAgC;IACzB,cAAc,CAAS;IAC9B,YAAmB,cAAsB,EAAE,cAAsB,EAAE,YAAoB,CAAC,EAAE,YAAoB,CAAC;QAC7G,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IACD,2BAA2B;IACpB,KAAK;QACV,OAAO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AAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IACnG,CAAC;IACM,aAAa,CAAC,QAAgB;QACnC,eAAe;QACf,iFAAiF;QACjF,MAAM,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC;QACzC,MAAM,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,oCAAoC;QACpC,6FAA6F;QAC7F,wEAAwE;QACxE,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;QAC/D,OAAO,CAAC,CAAC,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAClG,CAAC;IACM,WAAW,CAAC,CAAS;QAC1B,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,MAAM,SAAS,GAAG,qBAAY,CAAC,WAAW,CAAC,SAAS,EAClD,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EACxC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,OAAO,SAAS,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA/ND,8DA+NC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\r\nimport { SimpleNewton } from \"../../numerics/Newton\";\r\n\r\n/**\r\n * Methods to evaluate caller-specified number of terms of the x and y Taylor series for a clothoid.\r\n * Each instance has:\r\n * * number of x and y terms to use.\r\n * * constant for theta = c*x*x.\r\n * * This value is c = 1/(2*R*L) for curve length L measured from inflection to point with radius R.\r\n * @internal\r\n */\r\nexport class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {\r\n /** Number of terms to use in x Taylor series. */\r\n public numXTerms: number;\r\n /** Number of terms to use in y Taylor series. */\r\n public numYTerms: number;\r\n /** Constant c = 1/(2*R*L) in theta = c*s*s. */\r\n public constantDiv2LR: number;\r\n /** The nominal curve length. */\r\n public nominalLength1: number;\r\n public constructor(nominalLength1: number, constantDiv2LR: number, numXTerms: number = 4, numYTerms: number = 4) {\r\n super();\r\n this.nominalLength1 = nominalLength1;\r\n this.constantDiv2LR = constantDiv2LR;\r\n this.numXTerms = numXTerms;\r\n this.numYTerms = numYTerms;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): ClothoidSeriesRLEvaluator {\r\n return new ClothoidSeriesRLEvaluator(this.nominalLength1, this.constantDiv2LR, this.numXTerms, this.numYTerms);\r\n }\r\n public scaleInPlace(scaleFactor: number): void {\r\n this.nominalLength1 *= scaleFactor;\r\n this.constantDiv2LR /= (scaleFactor * scaleFactor);\r\n }\r\n /** Member by member matchup. */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof ClothoidSeriesRLEvaluator) {\r\n return this.numXTerms === other.numXTerms\r\n && this.numYTerms === other.numYTerms\r\n && Geometry.isAlmostEqualNumber(this.constantDiv2LR, other.constantDiv2LR)\r\n && Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Evaluate the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToX(fraction: number): number {\r\n return this.fractionToXGo(fraction, this.numXTerms);\r\n }\r\n /**\r\n * Evaluate the Y series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToY(fraction: number): number {\r\n return this.fractionToYGo(fraction, this.numYTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDX(fraction: number): number {\r\n return this.fractionToDXGo(fraction, this.numXTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDY(fraction: number): number {\r\n return this.fractionToDYGo(fraction, this.numYTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDDX(fraction: number): number {\r\n return this.fractionToDDXGo(fraction, this.numXTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDDY(fraction: number): number {\r\n return this.fractionToDDYGo(fraction, this.numYTerms);\r\n }\r\n /**\r\n * Evaluate the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n * @param numTerms number of terms to use.\r\n */\r\n public fractionToXGo(fraction: number, numTerms: number): number {\r\n // write the Taylor series for cos(theta)\r\n // replace theta by s*s*c\r\n // integrate wrt s\r\n // x = s - s^5 c^2/ 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...\r\n // x = s(1 - (s^4 c^2/2) ( 1/5 - (s^4 c^2 / 3*4) (1/9 - ...) ) )\r\n const s = fraction * this.nominalLength1;\r\n let result = s;\r\n if (numTerms < 2)\r\n return result;\r\n const q1 = s * s * this.constantDiv2LR;\r\n const beta = - q1 * q1;\r\n let alpha = s;\r\n let m = 1;\r\n let n = 5;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha / n;\r\n m += 2;\r\n n += 4;\r\n }\r\n return result;\r\n }\r\n public fractionToYGo(fraction: number, numTerms: number): number {\r\n // write the Taylor series for sin(theta)\r\n // replace theta by s*s*c\r\n // integrate wrt s\r\n // y = s^3 c / 3 - s^7 c^3 / 7*3! + s^11 c^5 / 11*5! - s^15 c^7 / 15*7! + ...\r\n // y = s^3 c ( 1/3 - s^4 c^2/ 3! ( (1/7) - (s^4 c^2 / 4*5) (1/11 - ...) ) )\r\n const s = fraction * this.nominalLength1;\r\n const q1 = s * s * this.constantDiv2LR;\r\n let result = q1 * s / 3;\r\n if (numTerms < 2)\r\n return result;\r\n const beta = - q1 * q1;\r\n let alpha = q1 * s;\r\n let m = 2;\r\n let n = 7;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha / n;\r\n m += 2;\r\n n += 4;\r\n }\r\n return result;\r\n }\r\n public fractionToDXGo(fraction: number, numTerms: number): number {\r\n // yes -- this does happen during derivatives of cosines with more than 0 terms\r\n if (numTerms <= 0)\r\n return 0;\r\n // dX = 1 - s^4c^2/2 + s^8 c^4 / 4! -\r\n // new Term = old Term * beta / (m(m+1))\r\n const s = fraction * this.nominalLength1;\r\n let result = 1;\r\n if (numTerms < 2) {\r\n return result * this.nominalLength1;\r\n }\r\n const q1 = s * s * this.constantDiv2LR;\r\n const beta = - q1 * q1;\r\n let alpha = 1.0;\r\n let m = 1;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha;\r\n m += 2;\r\n }\r\n return result * this.nominalLength1;\r\n }\r\n public fractionToDYGo(fraction: number, numTerms: number): number {\r\n if (numTerms <= 0)\r\n return 0;\r\n // dY = q - q^3/3!\r\n // q = s^2 c\r\n // dY = s^2 c - s^6 c^3/3! + s^10 c^5/ 5!\r\n // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))\r\n const s = fraction * this.nominalLength1;\r\n const q1 = s * s * this.constantDiv2LR;\r\n let result = q1;\r\n if (numTerms < 2)\r\n return result * this.nominalLength1;\r\n const beta = - q1 * q1;\r\n let alpha = q1;\r\n let m = 2;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha;\r\n m += 2;\r\n }\r\n return result * this.nominalLength1;\r\n }\r\n public fractionToDDXGo(fraction: number, numTerms: number): number {\r\n // DX is \"cosine\"\r\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2 * this.constantDiv2LR * s;\r\n const sine = this.fractionToDYGo(fraction, numTerms - 1);\r\n const resultA = (- dTheta * sine * this.nominalLength1);\r\n return resultA;\r\n }\r\n public fractionToDDYGo(fraction: number, numTerms: number): number {\r\n // DY is \"sine\"\r\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n // BUT .... derivative of the cosine series leading term is zero ... use one less term\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2 * this.constantDiv2LR * s;\r\n const cosine = this.fractionToDXGo(fraction, numTerms);\r\n return cosine * dTheta * this.nominalLength1;\r\n }\r\n public fractionToD3X(fraction: number): number {\r\n if (this.numXTerms <= 1)\r\n return 0.0;\r\n // DX is \"cosine\"\r\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2.0 * this.constantDiv2LR * s;\r\n const d2Theta = 2.0 * this.constantDiv2LR;\r\n const sine = this.fractionToDYGo(fraction, this.numXTerms - 1);\r\n const cosine = this.fractionToDXGo(fraction, this.numXTerms - 1);\r\n return (- cosine * dTheta * dTheta - sine * d2Theta) * this.nominalLength1 * this.nominalLength1;\r\n }\r\n public fractionToD3Y(fraction: number): number {\r\n // DY is \"sine\"\r\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2.0 * this.constantDiv2LR * s;\r\n const d2Theta = 2.0 * this.constantDiv2LR;\r\n // dY is sine series with numYTerms.\r\n // ddY is cosine series. Leading term of sine series is non-constant, so numYTerms here also\r\n // d3Y is sine series. Derivative of preceding cosine killed first term.\r\n const cosine = this.fractionToDXGo(fraction, this.numYTerms);\r\n const sine = this.fractionToDYGo(fraction, this.numYTerms - 1);\r\n return (-sine * dTheta * dTheta + cosine * d2Theta) * this.nominalLength1 * this.nominalLength1;\r\n }\r\n public xToFraction(x: number): number | undefined {\r\n const fraction0 = x / this.nominalLength1;\r\n const fraction1 = SimpleNewton.runNewton1D(fraction0,\r\n (f: number) => (this.fractionToX(f) - x),\r\n (f: number) => this.fractionToDX(f));\r\n if (fraction1 === undefined)\r\n return undefined;\r\n return fraction1;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ClothoidSeries.js","sourceRoot":"","sources":["../../../../src/curve/spiral/ClothoidSeries.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,6CAA0C;AAC1C,yDAAsD;AACtD,kDAAqD;AAErD;;;;;;;GAOG;AACH,MAAa,yBAA0B,SAAQ,mCAAgB;IAC7D,iDAAiD;IAC1C,SAAS,CAAS;IACzB,iDAAiD;IAC1C,SAAS,CAAS;IACzB,yCAAyC;IAClC,cAAc,CAAS;IAC9B,gCAAgC;IACzB,cAAc,CAAS;IAC9B,YAAmB,cAAsB,EAAE,cAAsB,EAAE,YAAoB,CAAC,EAAE,YAAoB,CAAC;QAC7G,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,S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,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YACzB,OAAO,SAAS,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAnOD,8DAmOC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { XYCurveEvaluator } from \"./XYCurveEvaluator\";\r\nimport { SimpleNewton } from \"../../numerics/Newton\";\r\n\r\n/**\r\n * Methods to evaluate caller-specified number of terms of the x and y Taylor series for a clothoid.\r\n * Each instance has:\r\n * * number of x and y terms to use.\r\n * * constant for theta = cxx.\r\n * * This value is c = 1/2RL for curve length L measured from inflection to point with radius R.\r\n * @internal\r\n */\r\nexport class ClothoidSeriesRLEvaluator extends XYCurveEvaluator {\r\n /** Number of terms to use in x Taylor series. */\r\n public numXTerms: number;\r\n /** Number of terms to use in y Taylor series. */\r\n public numYTerms: number;\r\n /** Constant c = 1/2RL in theta = cxx. */\r\n public constantDiv2LR: number;\r\n /** The nominal curve length. */\r\n public nominalLength1: number;\r\n public constructor(nominalLength1: number, constantDiv2LR: number, numXTerms: number = 4, numYTerms: number = 4) {\r\n super();\r\n this.nominalLength1 = nominalLength1;\r\n this.constantDiv2LR = constantDiv2LR;\r\n this.numXTerms = numXTerms;\r\n this.numYTerms = numYTerms;\r\n }\r\n /** Return a deep clone. */\r\n public clone(): ClothoidSeriesRLEvaluator {\r\n return new ClothoidSeriesRLEvaluator(this.nominalLength1, this.constantDiv2LR, this.numXTerms, this.numYTerms);\r\n }\r\n public scaleInPlace(scaleFactor: number): void {\r\n this.nominalLength1 *= scaleFactor;\r\n this.constantDiv2LR /= (scaleFactor * scaleFactor);\r\n }\r\n /** Member by member matchup. */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof ClothoidSeriesRLEvaluator) {\r\n return this.numXTerms === other.numXTerms\r\n && this.numYTerms === other.numYTerms\r\n && Geometry.isAlmostEqualNumber(this.constantDiv2LR, other.constantDiv2LR)\r\n && Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Evaluate the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToX(fraction: number): number {\r\n return this.fractionToXGo(fraction, this.numXTerms);\r\n }\r\n /**\r\n * Evaluate the Y series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToY(fraction: number): number {\r\n return this.fractionToYGo(fraction, this.numYTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDX(fraction: number): number {\r\n return this.fractionToDXGo(fraction, this.numXTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDY(fraction: number): number {\r\n return this.fractionToDYGo(fraction, this.numYTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDDX(fraction: number): number {\r\n return this.fractionToDDXGo(fraction, this.numXTerms);\r\n }\r\n /**\r\n * Evaluate the derivative of the Y series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n */\r\n public fractionToDDY(fraction: number): number {\r\n return this.fractionToDDYGo(fraction, this.numYTerms);\r\n }\r\n /**\r\n * Evaluate the X series at a nominal distance along the curve.\r\n * @param fraction fractional position along the curve.\r\n * @param numTerms number of terms to use.\r\n */\r\n public fractionToXGo(fraction: number, numTerms: number): number {\r\n // write the Taylor series for cos(theta):\r\n // 1 - theta^2 / 2! + theta^4 / 4! - theta^6 / 6! + ...\r\n // replace theta by s*s*c:\r\n // 1 - s^4c^2 / 2! + s^8c^4 / 4! - s^12c^6 / 6! + ...\r\n // integrate wrt s:\r\n // x = s - s^5 c^2 / 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...\r\n // x = s(1 - (s^4 c^2/2) ( 1/5 - (s^4 c^2 / 3*4) (1/9 - ...) ) )\r\n const s = fraction * this.nominalLength1;\r\n let result = s;\r\n if (numTerms < 2)\r\n return result;\r\n const q1 = s * s * this.constantDiv2LR;\r\n const beta = - q1 * q1;\r\n let alpha = s;\r\n let m = 1;\r\n let n = 5;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha / n;\r\n m += 2;\r\n n += 4;\r\n }\r\n return result;\r\n }\r\n public fractionToYGo(fraction: number, numTerms: number): number {\r\n // write the Taylor series for sin(theta):\r\n // theta - theta^3 / 3! + theta^5 / 5! - theta^7 / 7! + ...\r\n // replace theta by s*s*c:\r\n // s^2 c - s^6 c^3 / 3! + s^10 c^5 / 5! - s^14 c^7 / 7! + ...\r\n // integrate wrt s:\r\n // y = s^3 c / 3 - s^7 c^3 / 7*3! + s^11 c^5 / 11*5! - s^15 c^7 / 15*7! + ...\r\n // y = s^3 c ( 1/3 - s^4 c^2/ 3! ( (1/7) - (s^4 c^2 / 4*5) (1/11 - ...) ) )\r\n const s = fraction * this.nominalLength1;\r\n const q1 = s * s * this.constantDiv2LR;\r\n let result = q1 * s / 3;\r\n if (numTerms < 2)\r\n return result;\r\n const beta = - q1 * q1;\r\n let alpha = q1 * s;\r\n let m = 2;\r\n let n = 7;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha / n;\r\n m += 2;\r\n n += 4;\r\n }\r\n return result;\r\n }\r\n public fractionToDXGo(fraction: number, numTerms: number): number {\r\n // yes -- this does happen during derivatives of cosines with more than 0 terms\r\n if (numTerms <= 0)\r\n return 0;\r\n // dX = 1 - s^4c^2/2 + s^8 c^4 / 4! -\r\n // new Term = old Term * beta / (m(m+1))\r\n const s = fraction * this.nominalLength1;\r\n let result = 1;\r\n if (numTerms < 2) {\r\n return result * this.nominalLength1;\r\n }\r\n const q1 = s * s * this.constantDiv2LR;\r\n const beta = - q1 * q1;\r\n let alpha = 1.0;\r\n let m = 1;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha;\r\n m += 2;\r\n }\r\n return result * this.nominalLength1;\r\n }\r\n public fractionToDYGo(fraction: number, numTerms: number): number {\r\n if (numTerms <= 0)\r\n return 0;\r\n // dY = q - q^3/3!\r\n // q = s^2 c\r\n // dY = s^2 c - s^6 c^3/3! + s^10 c^5/ 5!\r\n // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))\r\n const s = fraction * this.nominalLength1;\r\n const q1 = s * s * this.constantDiv2LR;\r\n let result = q1;\r\n if (numTerms < 2)\r\n return result * this.nominalLength1;\r\n const beta = - q1 * q1;\r\n let alpha = q1;\r\n let m = 2;\r\n for (let i = 1; i < numTerms; i++) {\r\n alpha *= beta / (m * (m + 1));\r\n result += alpha;\r\n m += 2;\r\n }\r\n return result * this.nominalLength1;\r\n }\r\n public fractionToDDXGo(fraction: number, numTerms: number): number {\r\n // DX is \"cosine\"\r\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2 * this.constantDiv2LR * s;\r\n const sine = this.fractionToDYGo(fraction, numTerms - 1);\r\n const resultA = (- dTheta * sine * this.nominalLength1);\r\n return resultA;\r\n }\r\n public fractionToDDYGo(fraction: number, numTerms: number): number {\r\n // DY is \"sine\"\r\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n // BUT .... derivative of the cosine series leading term is zero ... use one less term\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2 * this.constantDiv2LR * s;\r\n const cosine = this.fractionToDXGo(fraction, numTerms);\r\n return cosine * dTheta * this.nominalLength1;\r\n }\r\n public fractionToD3X(fraction: number): number {\r\n if (this.numXTerms <= 1)\r\n return 0.0;\r\n // DX is \"cosine\"\r\n // DDX is \"- sine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2.0 * this.constantDiv2LR * s;\r\n const d2Theta = 2.0 * this.constantDiv2LR;\r\n const sine = this.fractionToDYGo(fraction, this.numXTerms - 1);\r\n const cosine = this.fractionToDXGo(fraction, this.numXTerms - 1);\r\n return (- cosine * dTheta * dTheta - sine * d2Theta) * this.nominalLength1 * this.nominalLength1;\r\n }\r\n public fractionToD3Y(fraction: number): number {\r\n // DY is \"sine\"\r\n // DDY is \"cosine\" series times chain rule dTheta/ds = 2 * s * this.constantDivLR\r\n const s = fraction * this.nominalLength1;\r\n const dTheta = 2.0 * this.constantDiv2LR * s;\r\n const d2Theta = 2.0 * this.constantDiv2LR;\r\n // dY is sine series with numYTerms.\r\n // ddY is cosine series. Leading term of sine series is non-constant, so numYTerms here also\r\n // d3Y is sine series. Derivative of preceding cosine killed first term.\r\n const cosine = this.fractionToDXGo(fraction, this.numYTerms);\r\n const sine = this.fractionToDYGo(fraction, this.numYTerms - 1);\r\n return (-sine * dTheta * dTheta + cosine * d2Theta) * this.nominalLength1 * this.nominalLength1;\r\n }\r\n public xToFraction(x: number): number | undefined {\r\n const fraction0 = x / this.nominalLength1;\r\n const fraction1 = SimpleNewton.runNewton1D(fraction0,\r\n (f: number) => (this.fractionToX(f) - x),\r\n (f: number) => this.fractionToDX(f));\r\n if (fraction1 === undefined)\r\n return undefined;\r\n return fraction1;\r\n }\r\n}\r\n"]}
@@ -20,7 +20,7 @@ export declare class CzechSpiralEvaluator extends CubicEvaluator {
20
20
  * (0.25==>0.99215), (0.15==>0.997184), (0.10==>0.998749), (0.05==>999687)
21
21
  */
22
22
  static gammaConstant(length1: number, radius1: number): number | undefined;
23
- /** Compute the czech cubic constant. */
23
+ /** Compute the Czech cubic constant. */
24
24
  static computeCubicM(length1: number, radius1: number): number | undefined;
25
25
  static create(length1: number, radius1: number): CzechSpiralEvaluator | undefined;
26
26
  scaleInPlace(scaleFactor: number): void;
@@ -67,10 +67,7 @@ export declare class CzechSpiralEvaluator extends CubicEvaluator {
67
67
  export declare class ItalianSpiralEvaluator extends CubicEvaluator {
68
68
  nominalLength1: number;
69
69
  nominalRadius1: number;
70
- /**
71
- * Compute the czech cubic constant.
72
- * * Funky mixture of lengths.
73
- */
70
+ /** Compute the Italian cubic constant. */
74
71
  private static computeCubicM;
75
72
  /** Constructor is private. Caller responsible for cubicM validity. */
76
73
  private constructor();
@@ -1 +1 @@
1
- {"version":3,"file":"CzechSpiralEvaluator.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/CzechSpiralEvaluator.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;;;;;GASG;AACH,qBAAa,oBAAqB,SAAQ,cAAc;IAC/C,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IAC9B,sEAAsE;IACtE,OAAO;IAKP;;;;OAIG;WACW,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAGjF,wCAAwC;WAC1B,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;WAQnE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAMxE,YAAY,CAAC,WAAW,EAAE,MAAM;IAKhD,2CAA2C;IACpC,KAAK,IAAI,oBAAoB;IAGpC,gCAAgC;IACzB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IAOzC;;;;;;OAMG;IACI,2BAA2B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAGrD;;;;OAIG;IACI,2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C;IACzB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IAOzC;;;;;;OAMG;IACI,6BAA6B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAGvD;;;;OAIG;IACI,6BAA6B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAGpE"}
@@ -38,7 +38,7 @@ class CzechSpiralEvaluator extends CubicEvaluator_1.CubicEvaluator {
38
38
  static gammaConstant(length1, radius1) {
39
39
  return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);
40
40
  }
41
- /** Compute the czech cubic constant. */
41
+ /** Compute the Czech cubic constant. */
42
42
  static computeCubicM(length1, radius1) {
43
43
  const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);
44
44
  // in the private update method, the LR values should have been vetted
@@ -132,17 +132,9 @@ exports.CzechSpiralEvaluator = CzechSpiralEvaluator;
132
132
  class ItalianSpiralEvaluator extends CubicEvaluator_1.CubicEvaluator {
133
133
  nominalLength1;
134
134
  nominalRadius1;
135
- /**
136
- * Compute the czech cubic constant.
137
- * * Funky mixture of lengths.
138
- */
135
+ /** Compute the Italian cubic constant. */
139
136
  static computeCubicM(lengthXByForward, radius1) {
140
- const gamma = CzechSpiralEvaluator.gammaConstant(lengthXByForward, radius1);
141
- // in the private update method, the LR values should have been vetted
142
- if (gamma === undefined)
143
- return undefined;
144
- // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator
145
- return gamma / Math.abs((6.0 * radius1 * lengthXByForward));
137
+ return CzechSpiralEvaluator.computeCubicM(lengthXByForward, radius1);
146
138
  }
147
139
  /** Constructor is private. Caller responsible for cubicM validity. */
148
140
  constructor(length1, radius1, lengthX, cubicM) {
@@ -151,7 +143,7 @@ class ItalianSpiralEvaluator extends CubicEvaluator_1.CubicEvaluator {
151
143
  this.nominalRadius1 = radius1;
152
144
  }
153
145
  static create(length1, radius1) {
154
- // this seems goofy.; lengthX from forward, then invert for another but that's what the native code does too
146
+ // this seems goofy; lengthX from forward, then invert for another but that's what the native code does too
155
147
  const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);
156
148
  const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);
157
149
  if (lengthX1 === undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"CzechSpiralEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/CzechSpiralEvaluator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,6CAA0C;AAC1C,qDAAkD;AAClD,kDAAqD;AAErD;;;;;;;;;GASG;AACH,MAAa,oBAAqB,SAAQ,+BAAc;IAC/C,cAAc,CAAS;IACvB,cAAc,CAAS;IAC9B,sEAAsE;IACtE,YAAoB,OAAe,EAAE,OAAe,EAAE,MAAc;QAClE,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;IAChC,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,aAAa,CAAC,OAAe,EAAE,OAAe;QAC1D,OAAO,GAAG,GAAG,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;IAChF,CAAC;IACD,wCAAwC;IACjC,MAAM,CAAC,aAAa,CAAC,OAAe,EAAE,OAAe;QAC1D,MAAM,KAAK,GAAG,oBAAoB,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,sEAAsE;QACtE,IAAI,KAAK,KAAK,SAAS;YACrB,OAAO,SAAS,CAAC;QACnB,iHAAiH;QACjH,OAAO,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IACrD,CAAC;IACM,MAAM,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,IAAI,WAAW,CAAC;QACnC,IAAI,CAAC,cAAc,IAAI,WAAW,CAAC;QACnC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IACD,2CAA2C;IACpC,KAAK;QACV,OAAO,IAAI,sBAAsB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7G,CAAC;IACD,gCAAgC;IACzB,aAAa,CAAC,KAAU;QAC7B,IAAI,KAAK,YAAY,sBAAsB,EAAE,CAAC;YAC5C,OAAO,mBAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC;mBACtE,mBAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD;;;;;;OAMG;IACI,6BAA6B,CAAC,CAAS;QAC5C,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;IACD;;;;OAIG;IACI,6BAA6B,CAAC,CAAS;QAC5C,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;CACF;AApED,wDAoEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { CubicEvaluator } from \"./CubicEvaluator\";\r\nimport { SimpleNewton } from \"../../numerics/Newton\";\r\n\r\n/**\r\n * Czech cubic.\r\n * This is y = m*x^3 with\r\n * * x any point on the x axis.\r\n * * `fraction` along the spiral goes to `x = fraction * L`.\r\n * * m is gamma/(6RL).\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.\r\n * @internal\r\n */\r\nexport class CzechSpiralEvaluator extends CubicEvaluator {\r\n public nominalLength1: number;\r\n public nominalRadius1: number;\r\n /** Constructor is private. Caller responsible for cubicM validity. */\r\n private constructor(length1: number, radius1: number, cubicM: number) {\r\n super(length1, cubicM);\r\n this.nominalLength1 = length1;\r\n this.nominalRadius1 = radius1;\r\n }\r\n /**\r\n * Return the scale factor between simple x^3 / (6RL) cubic and the czech correction.\r\n * * For typical case with l1/R1 smallish, this is just less than 1.0:\r\n * (0.25==>0.99215), (0.15==>0.997184), (0.10==>0.998749), (0.05==>999687)\r\n */\r\n public static gammaConstant(length1: number, radius1: number): number | undefined {\r\n return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);\r\n }\r\n /** Compute the czech cubic constant. */\r\n public static computeCubicM(length1: number, radius1: number): number | undefined {\r\n const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);\r\n // in the private update method, the LR values should have been vetted\r\n if (gamma === undefined)\r\n return undefined;\r\n // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator\r\n return gamma / Math.abs((6.0 * radius1 * length1));\r\n }\r\n public static create(length1: number, radius1: number): CzechSpiralEvaluator | undefined {\r\n const m = this.computeCubicM(length1, radius1);\r\n if (m === undefined)\r\n return undefined;\r\n return new CzechSpiralEvaluator(length1, radius1, m);\r\n }\r\n public override scaleInPlace(scaleFactor: number) {\r\n this.nominalLength1 *= scaleFactor;\r\n this.nominalRadius1 *= scaleFactor;\r\n super.scaleInPlace(scaleFactor);\r\n }\r\n /** Return a deep copy of the evaluator. */\r\n public clone(): CzechSpiralEvaluator {\r\n return new CzechSpiralEvaluator(this.nominalLength1, this.nominalRadius1, this.cubicM);\r\n }\r\n /** Member by member matchup. */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof CzechSpiralEvaluator) {\r\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\r\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\r\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\r\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate\r\n * CurvePrimitive measurements.\r\n * @param x distance along the x axis.\r\n */\r\n public xToCzechApproximateDistance(x: number): number {\r\n return CzechSpiralEvaluator.forwardL2R2Map(x, 1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n /**\r\n * Return the inverse of the `forwardL2R2Map` function.\r\n * * The undefined result can only occur for distances outside the usual spirals.\r\n * @param d (approximate) distance along the spiral.\r\n */\r\n public czechApproximateDistanceToX(d: number): number | undefined {\r\n return CzechSpiralEvaluator.inverseL2R2Map(d, 1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n /**\r\n * Evaluate a series expansion that is used with varying signs (plus or minus 1) in czech and italian spirals.\r\n * @param x distance along the x axis.\r\n */\r\n public static forwardL2R2Map(x: number, sign: number, length: number, radius: number): number {\r\n const l2 = length * length;\r\n const r2 = radius * radius;\r\n const Q = 4.0 * r2 - l2;\r\n const xx = x * x;\r\n return x * (1.0 + sign * xx * xx / (10.0 * Q * l2));\r\n }\r\n /**\r\n * Return the inverse of the `forwardL2R2Map` function.\r\n * * The undefined result can only occur for distances outside the usual spirals.\r\n * @param d (approximate) distance along the spiral.\r\n */\r\n public static inverseL2R2Map(d: number, sign: number, length: number, radius: number): number | undefined {\r\n const l2 = length * length;\r\n const r2 = radius * radius;\r\n const Q = 4.0 * r2 - l2;\r\n const a = sign / (10.0 * Q * l2);\r\n return SimpleNewton.runNewton1D(\r\n d,\r\n (x: number) => {\r\n const xx = x * x;\r\n return x * (1.0 + xx * xx * a) - d;\r\n },\r\n (x: number) => {\r\n const xx = x * x;\r\n return 1.0 + 5 * xx * xx * a;\r\n },\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Italian cubic.\r\n * This is y = m*x^3 with\r\n * * x any point on the x axis.\r\n * * `fraction` along the spiral goes to `x = fraction * L`.\r\n * * m is gamma/(6RL).\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.\r\n * @internal\r\n */\r\nexport class ItalianSpiralEvaluator extends CubicEvaluator {\r\n public nominalLength1: number;\r\n public nominalRadius1: number;\r\n\r\n /**\r\n * Compute the czech cubic constant.\r\n * * Funky mixture of lengths.\r\n */\r\n private static computeCubicM(lengthXByForward: number, radius1: number): number | undefined {\r\n const gamma = CzechSpiralEvaluator.gammaConstant(lengthXByForward, radius1);\r\n // in the private update method, the LR values should have been vetted\r\n if (gamma === undefined)\r\n return undefined;\r\n // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator\r\n return gamma / Math.abs((6.0 * radius1 * lengthXByForward));\r\n }\r\n /** Constructor is private. Caller responsible for cubicM validity. */\r\n private constructor(length1: number, radius1: number, lengthX: number, cubicM: number) {\r\n super(lengthX, cubicM);\r\n this.nominalLength1 = length1;\r\n this.nominalRadius1 = radius1;\r\n }\r\n public static create(length1: number, radius1: number): ItalianSpiralEvaluator | undefined {\r\n // this seems goofy.; lengthX from forward, then invert for another but that's what the native code does too\r\n const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);\r\n const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);\r\n if (lengthX1 === undefined)\r\n return undefined;\r\n const m = ItalianSpiralEvaluator.computeCubicM(lengthX, radius1);\r\n if (m === undefined)\r\n return undefined;\r\n return new ItalianSpiralEvaluator(length1, radius1, lengthX1, m);\r\n }\r\n public override scaleInPlace(scaleFactor: number) {\r\n this.nominalLength1 *= scaleFactor;\r\n this.nominalRadius1 *= scaleFactor;\r\n super.scaleInPlace(scaleFactor);\r\n }\r\n /** Return a deep copy of the evaluator. */\r\n public clone(): ItalianSpiralEvaluator {\r\n return new ItalianSpiralEvaluator(this.nominalLength1, this.nominalRadius1, super.axisLength, this.cubicM);\r\n }\r\n /** Member by member matchup. */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof ItalianSpiralEvaluator) {\r\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\r\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\r\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\r\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate\r\n * CurvePrimitive measurements.\r\n * @param x distance along the x axis.\r\n */\r\n public distanceToItalianApproximateX(x: number): number {\r\n return CzechSpiralEvaluator.forwardL2R2Map(x, -1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n /**\r\n * Return the inverse of the `forwardL2R2Map` function.\r\n * * The undefined result can only occur for distances outside the usual spirals.\r\n * @param d (approximate) distance along the spiral.\r\n */\r\n public xToItalianApproximateDistance(d: number): number | undefined {\r\n return CzechSpiralEvaluator.inverseL2R2Map(d, -1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CzechSpiralEvaluator.js","sourceRoot":"","sources":["../../../../src/curve/spiral/CzechSpiralEvaluator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AACH,6CAA0C;AAC1C,qDAAkD;AAClD,kDAAqD;AAErD;;;;;;;;;GASG;AACH,MAAa,oBAAqB,SAAQ,+BAAc;IAC/C,cAAc,CAAS;IACvB,c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B,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;IACD;;;;OAIG;IACI,6BAA6B,CAAC,CAAS;QAC5C,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAChG,CAAC;CACF;AA3DD,wDA2DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { CubicEvaluator } from \"./CubicEvaluator\";\r\nimport { SimpleNewton } from \"../../numerics/Newton\";\r\n\r\n/**\r\n * Czech cubic.\r\n * This is y = m*x^3 with\r\n * * x any point on the x axis.\r\n * * `fraction` along the spiral goes to `x = fraction * L`.\r\n * * m is gamma/(6RL).\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.\r\n * @internal\r\n */\r\nexport class CzechSpiralEvaluator extends CubicEvaluator {\r\n public nominalLength1: number;\r\n public nominalRadius1: number;\r\n /** Constructor is private. Caller responsible for cubicM validity. */\r\n private constructor(length1: number, radius1: number, cubicM: number) {\r\n super(length1, cubicM);\r\n this.nominalLength1 = length1;\r\n this.nominalRadius1 = radius1;\r\n }\r\n /**\r\n * Return the scale factor between simple x^3 / (6RL) cubic and the czech correction.\r\n * * For typical case with l1/R1 smallish, this is just less than 1.0:\r\n * (0.25==>0.99215), (0.15==>0.997184), (0.10==>0.998749), (0.05==>999687)\r\n */\r\n public static gammaConstant(length1: number, radius1: number): number | undefined {\r\n return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);\r\n }\r\n /** Compute the Czech cubic constant. */\r\n public static computeCubicM(length1: number, radius1: number): number | undefined {\r\n const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);\r\n // in the private update method, the LR values should have been vetted\r\n if (gamma === undefined)\r\n return undefined;\r\n // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator\r\n return gamma / Math.abs((6.0 * radius1 * length1));\r\n }\r\n public static create(length1: number, radius1: number): CzechSpiralEvaluator | undefined {\r\n const m = this.computeCubicM(length1, radius1);\r\n if (m === undefined)\r\n return undefined;\r\n return new CzechSpiralEvaluator(length1, radius1, m);\r\n }\r\n public override scaleInPlace(scaleFactor: number) {\r\n this.nominalLength1 *= scaleFactor;\r\n this.nominalRadius1 *= scaleFactor;\r\n super.scaleInPlace(scaleFactor);\r\n }\r\n /** Return a deep copy of the evaluator. */\r\n public clone(): CzechSpiralEvaluator {\r\n return new CzechSpiralEvaluator(this.nominalLength1, this.nominalRadius1, this.cubicM);\r\n }\r\n /** Member by member matchup. */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof CzechSpiralEvaluator) {\r\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\r\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\r\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\r\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate\r\n * CurvePrimitive measurements.\r\n * @param x distance along the x axis.\r\n */\r\n public xToCzechApproximateDistance(x: number): number {\r\n return CzechSpiralEvaluator.forwardL2R2Map(x, 1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n /**\r\n * Return the inverse of the `forwardL2R2Map` function.\r\n * * The undefined result can only occur for distances outside the usual spirals.\r\n * @param d (approximate) distance along the spiral.\r\n */\r\n public czechApproximateDistanceToX(d: number): number | undefined {\r\n return CzechSpiralEvaluator.inverseL2R2Map(d, 1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n /**\r\n * Evaluate a series expansion that is used with varying signs (plus or minus 1) in czech and italian spirals.\r\n * @param x distance along the x axis.\r\n */\r\n public static forwardL2R2Map(x: number, sign: number, length: number, radius: number): number {\r\n const l2 = length * length;\r\n const r2 = radius * radius;\r\n const Q = 4.0 * r2 - l2;\r\n const xx = x * x;\r\n return x * (1.0 + sign * xx * xx / (10.0 * Q * l2));\r\n }\r\n /**\r\n * Return the inverse of the `forwardL2R2Map` function.\r\n * * The undefined result can only occur for distances outside the usual spirals.\r\n * @param d (approximate) distance along the spiral.\r\n */\r\n public static inverseL2R2Map(d: number, sign: number, length: number, radius: number): number | undefined {\r\n const l2 = length * length;\r\n const r2 = radius * radius;\r\n const Q = 4.0 * r2 - l2;\r\n const a = sign / (10.0 * Q * l2);\r\n return SimpleNewton.runNewton1D(\r\n d,\r\n (x: number) => {\r\n const xx = x * x;\r\n return x * (1.0 + xx * xx * a) - d;\r\n },\r\n (x: number) => {\r\n const xx = x * x;\r\n return 1.0 + 5 * xx * xx * a;\r\n },\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Italian cubic.\r\n * This is y = m*x^3 with\r\n * * x any point on the x axis.\r\n * * `fraction` along the spiral goes to `x = fraction * L`.\r\n * * m is gamma/(6RL).\r\n * * 1/(6RL) is the leading term of the sine series.\r\n * * `gamma = 2R/sqrt(4RR-LL)` pushes y down a little bit to simulate the lost series terms.\r\n * @internal\r\n */\r\nexport class ItalianSpiralEvaluator extends CubicEvaluator {\r\n public nominalLength1: number;\r\n public nominalRadius1: number;\r\n /** Compute the Italian cubic constant. */\r\n private static computeCubicM(lengthXByForward: number, radius1: number): number | undefined {\r\n return CzechSpiralEvaluator.computeCubicM(lengthXByForward, radius1);\r\n }\r\n /** Constructor is private. Caller responsible for cubicM validity. */\r\n private constructor(length1: number, radius1: number, lengthX: number, cubicM: number) {\r\n super(lengthX, cubicM);\r\n this.nominalLength1 = length1;\r\n this.nominalRadius1 = radius1;\r\n }\r\n public static create(length1: number, radius1: number): ItalianSpiralEvaluator | undefined {\r\n // this seems goofy; lengthX from forward, then invert for another but that's what the native code does too\r\n const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);\r\n const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);\r\n if (lengthX1 === undefined)\r\n return undefined;\r\n const m = ItalianSpiralEvaluator.computeCubicM(lengthX, radius1);\r\n if (m === undefined)\r\n return undefined;\r\n return new ItalianSpiralEvaluator(length1, radius1, lengthX1, m);\r\n }\r\n public override scaleInPlace(scaleFactor: number) {\r\n this.nominalLength1 *= scaleFactor;\r\n this.nominalRadius1 *= scaleFactor;\r\n super.scaleInPlace(scaleFactor);\r\n }\r\n /** Return a deep copy of the evaluator. */\r\n public clone(): ItalianSpiralEvaluator {\r\n return new ItalianSpiralEvaluator(this.nominalLength1, this.nominalRadius1, super.axisLength, this.cubicM);\r\n }\r\n /** Member by member matchup. */\r\n public isAlmostEqual(other: any): boolean {\r\n if (other instanceof ItalianSpiralEvaluator) {\r\n return Geometry.isSameCoordinate(this.nominalLength1, other.nominalLength1)\r\n && Geometry.isSameCoordinate(this.nominalRadius1, other.nominalRadius1);\r\n }\r\n return false;\r\n }\r\n /**\r\n * Return a (fast but mediocre) approximation of spiral length as a function of x axis position.\r\n * * This x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.\r\n * * It is supported here for users interested in replicating the Czech distance mapping rather than the more accurate\r\n * CurvePrimitive measurements.\r\n * @param x distance along the x axis.\r\n */\r\n public distanceToItalianApproximateX(x: number): number {\r\n return CzechSpiralEvaluator.forwardL2R2Map(x, -1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n /**\r\n * Return the inverse of the `forwardL2R2Map` function.\r\n * * The undefined result can only occur for distances outside the usual spirals.\r\n * @param d (approximate) distance along the spiral.\r\n */\r\n public xToItalianApproximateDistance(d: number): number | undefined {\r\n return CzechSpiralEvaluator.inverseL2R2Map(d, -1.0, this.nominalLength1, this.nominalRadius1);\r\n }\r\n}\r\n"]}
@@ -15,16 +15,17 @@ import { XYCurveEvaluator } from "./XYCurveEvaluator";
15
15
  * DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have
16
16
  * "direct" xy calculations without the integrations required for IntegratedSpiral3d.
17
17
  * * Each DirectSpiral3d carries an XYCurveEvaluator to give it specialized behavior.
18
- * * Direct spirals that flow through serialization to native imodel02 are created with these static methods:
18
+ * * Direct spirals are created with these static methods:
19
19
  * * createArema
20
20
  * * createJapaneseCubic
21
- * * createAustralianRail
22
- * * createDirectHalfCosine
23
21
  * * createChineseCubic
22
+ * * createWesternAustralian
23
+ * * createDirectHalfCosine
24
+ * * createAustralianRail
24
25
  * * createCzechCubic
25
26
  * * createPolishCubic
27
+ * * createMXCubicAlongArc
26
28
  * * createItalian
27
- * * createWesternAustralian
28
29
  * @public
29
30
  */
30
31
  export declare class DirectSpiral3d extends TransitionSpiral3d {
@@ -110,11 +111,11 @@ export declare class DirectSpiral3d extends TransitionSpiral3d {
110
111
  /**
111
112
  * Create an MX Cubic whose nominal length is close to along the curve.
112
113
  * This is y = m*x^3 with
113
- * * m is 1/(6RL1).
114
+ * * m is 1/(6RL).
114
115
  * * 1/(6RL) is the leading term of the sine series.
115
116
  * * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length.
116
117
  * * x is axis position that is slightly LESS than nominal distance along.
117
- * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 R R L L))
118
+ * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 RR LL))
118
119
  * @param localToWorld
119
120
  * @param nominalL1
120
121
  * @param nominalR1
@@ -1 +1 @@
1
- {"version":3,"file":"DirectSpiral3d.d.ts","sourceRoot":"","sources":["../../../../src/curve/spiral/DirectSpiral3d.ts"],"names":[],"mappings":"AAQA,OAAO,EA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AAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAG/D,6CAA6C;IAC7B,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;CAUnD"}
@@ -24,18 +24,20 @@ const TransitionSpiral3d_1 = require("./TransitionSpiral3d");
24
24
  * DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have
25
25
  * "direct" xy calculations without the integrations required for IntegratedSpiral3d.
26
26
  * * Each DirectSpiral3d carries an XYCurveEvaluator to give it specialized behavior.
27
- * * Direct spirals that flow through serialization to native imodel02 are created with these static methods:
27
+ * * Direct spirals are created with these static methods:
28
28
  * * createArema
29
29
  * * createJapaneseCubic
30
- * * createAustralianRail
31
- * * createDirectHalfCosine
32
30
  * * createChineseCubic
31
+ * * createWesternAustralian
32
+ * * createDirectHalfCosine
33
+ * * createAustralianRail
33
34
  * * createCzechCubic
34
35
  * * createPolishCubic
36
+ * * createMXCubicAlongArc
35
37
  * * createItalian
36
- * * createWesternAustralian
37
38
  * @public
38
39
  */
40
+ // see internaldocs/Spiral.md for more info
39
41
  class DirectSpiral3d extends TransitionSpiral3d_1.TransitionSpiral3d {
40
42
  /** String name for schema properties. */
41
43
  curvePrimitiveType = "transitionSpiral";
@@ -191,11 +193,11 @@ class DirectSpiral3d extends TransitionSpiral3d_1.TransitionSpiral3d {
191
193
  /**
192
194
  * Create an MX Cubic whose nominal length is close to along the curve.
193
195
  * This is y = m*x^3 with
194
- * * m is 1/(6RL1).
196
+ * * m is 1/(6RL).
195
197
  * * 1/(6RL) is the leading term of the sine series.
196
198
  * * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length.
197
199
  * * x is axis position that is slightly LESS than nominal distance along.
198
- * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 R R L L))
200
+ * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 RR LL))
199
201
  * @param localToWorld
200
202
  * @param nominalL1
201
203
  * @param nominalR1