@itwin/core-geometry 4.10.0-dev.3 → 4.10.0-dev.31

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 (208) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/lib/cjs/Geometry.d.ts +2 -2
  3. package/lib/cjs/Geometry.js +2 -2
  4. package/lib/cjs/Geometry.js.map +1 -1
  5. package/lib/cjs/clipping/ClipPrimitive.d.ts +7 -7
  6. package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
  7. package/lib/cjs/clipping/ClipPrimitive.js +1 -1
  8. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  9. package/lib/cjs/core-geometry.d.ts +1 -1
  10. package/lib/cjs/core-geometry.d.ts.map +1 -1
  11. package/lib/cjs/core-geometry.js +1 -1
  12. package/lib/cjs/core-geometry.js.map +1 -1
  13. package/lib/cjs/curve/Arc3d.d.ts +21 -10
  14. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  15. package/lib/cjs/curve/Arc3d.js +66 -38
  16. package/lib/cjs/curve/Arc3d.js.map +1 -1
  17. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +27 -8
  18. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  19. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +44 -25
  20. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  21. package/lib/cjs/curve/CurveFactory.d.ts +11 -13
  22. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  23. package/lib/cjs/curve/CurveFactory.js +19 -46
  24. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  25. package/lib/cjs/curve/LineSegment3d.js +2 -2
  26. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  27. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  28. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +5 -4
  29. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  30. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
  31. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  32. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +40 -65
  33. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  34. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +22 -7
  35. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
  36. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js +131 -70
  37. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  38. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  39. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +14 -11
  40. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  41. package/lib/cjs/geometry3d/Angle.d.ts +5 -5
  42. package/lib/cjs/geometry3d/Angle.js +5 -5
  43. package/lib/cjs/geometry3d/Angle.js.map +1 -1
  44. package/lib/cjs/geometry3d/AngleSweep.d.ts +101 -13
  45. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  46. package/lib/cjs/geometry3d/AngleSweep.js +156 -57
  47. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  48. package/lib/cjs/geometry3d/BilinearPatch.js +4 -4
  49. package/lib/cjs/geometry3d/BilinearPatch.js.map +1 -1
  50. package/lib/cjs/geometry3d/Matrix3d.d.ts +35 -31
  51. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  52. package/lib/cjs/geometry3d/Matrix3d.js +55 -31
  53. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  54. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +6 -5
  55. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  56. package/lib/cjs/geometry3d/Point3dVector3d.js +6 -5
  57. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  58. package/lib/cjs/geometry3d/PolygonOps.js +2 -2
  59. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  60. package/lib/cjs/geometry3d/Ray3d.js +2 -2
  61. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  62. package/lib/cjs/geometry3d/Transform.d.ts +4 -2
  63. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  64. package/lib/cjs/geometry3d/Transform.js +4 -2
  65. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  66. package/lib/cjs/geometry4d/Map4d.d.ts +5 -5
  67. package/lib/cjs/geometry4d/Map4d.js +5 -5
  68. package/lib/cjs/geometry4d/Map4d.js.map +1 -1
  69. package/lib/cjs/geometry4d/Matrix4d.d.ts +4 -7
  70. package/lib/cjs/geometry4d/Matrix4d.d.ts.map +1 -1
  71. package/lib/cjs/geometry4d/Matrix4d.js +4 -7
  72. package/lib/cjs/geometry4d/Matrix4d.js.map +1 -1
  73. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  74. package/lib/cjs/geometry4d/Point4d.js +2 -1
  75. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  76. package/lib/cjs/numerics/Newton.d.ts +3 -0
  77. package/lib/cjs/numerics/Newton.d.ts.map +1 -1
  78. package/lib/cjs/numerics/Newton.js +2 -5
  79. package/lib/cjs/numerics/Newton.js.map +1 -1
  80. package/lib/cjs/numerics/Polynomials.d.ts +46 -201
  81. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  82. package/lib/cjs/numerics/Polynomials.js +132 -445
  83. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  84. package/lib/cjs/numerics/SmallSystem.d.ts +164 -0
  85. package/lib/cjs/numerics/SmallSystem.d.ts.map +1 -0
  86. package/lib/cjs/numerics/SmallSystem.js +321 -0
  87. package/lib/cjs/numerics/SmallSystem.js.map +1 -0
  88. package/lib/cjs/polyface/PolyfaceClip.d.ts +3 -3
  89. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  90. package/lib/cjs/polyface/PolyfaceClip.js +1 -1
  91. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  92. package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts +1 -1
  93. package/lib/cjs/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -1
  94. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js +7 -7
  95. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  96. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  97. package/lib/cjs/topology/Graph.js +2 -2
  98. package/lib/cjs/topology/Graph.js.map +1 -1
  99. package/lib/cjs/topology/InsertAndRetriangulateContext.js +2 -2
  100. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  101. package/lib/cjs/topology/Merging.d.ts +1 -1
  102. package/lib/cjs/topology/Merging.d.ts.map +1 -1
  103. package/lib/cjs/topology/Merging.js +2 -2
  104. package/lib/cjs/topology/Merging.js.map +1 -1
  105. package/lib/esm/Geometry.d.ts +2 -2
  106. package/lib/esm/Geometry.js +2 -2
  107. package/lib/esm/Geometry.js.map +1 -1
  108. package/lib/esm/clipping/ClipPrimitive.d.ts +7 -7
  109. package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
  110. package/lib/esm/clipping/ClipPrimitive.js +1 -1
  111. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  112. package/lib/esm/core-geometry.d.ts +1 -1
  113. package/lib/esm/core-geometry.d.ts.map +1 -1
  114. package/lib/esm/core-geometry.js +1 -1
  115. package/lib/esm/core-geometry.js.map +1 -1
  116. package/lib/esm/curve/Arc3d.d.ts +21 -10
  117. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  118. package/lib/esm/curve/Arc3d.js +66 -38
  119. package/lib/esm/curve/Arc3d.js.map +1 -1
  120. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +27 -8
  121. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  122. package/lib/esm/curve/CurveChainWithDistanceIndex.js +44 -25
  123. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  124. package/lib/esm/curve/CurveFactory.d.ts +11 -13
  125. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  126. package/lib/esm/curve/CurveFactory.js +17 -44
  127. package/lib/esm/curve/CurveFactory.js.map +1 -1
  128. package/lib/esm/curve/LineSegment3d.js +1 -1
  129. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  130. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  131. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +4 -3
  132. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  133. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +1 -0
  134. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  135. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +35 -60
  136. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  137. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts +22 -7
  138. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.d.ts.map +1 -1
  139. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js +130 -69
  140. package/lib/esm/curve/internalContexts/CurveCurveIntersectXYZ.js.map +1 -1
  141. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  142. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +14 -11
  143. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  144. package/lib/esm/geometry3d/Angle.d.ts +5 -5
  145. package/lib/esm/geometry3d/Angle.js +5 -5
  146. package/lib/esm/geometry3d/Angle.js.map +1 -1
  147. package/lib/esm/geometry3d/AngleSweep.d.ts +101 -13
  148. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  149. package/lib/esm/geometry3d/AngleSweep.js +156 -57
  150. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  151. package/lib/esm/geometry3d/BilinearPatch.js +1 -1
  152. package/lib/esm/geometry3d/BilinearPatch.js.map +1 -1
  153. package/lib/esm/geometry3d/Matrix3d.d.ts +35 -31
  154. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  155. package/lib/esm/geometry3d/Matrix3d.js +55 -31
  156. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  157. package/lib/esm/geometry3d/Point3dVector3d.d.ts +6 -5
  158. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  159. package/lib/esm/geometry3d/Point3dVector3d.js +6 -5
  160. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  161. package/lib/esm/geometry3d/PolygonOps.js +2 -2
  162. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  163. package/lib/esm/geometry3d/Ray3d.js +1 -1
  164. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  165. package/lib/esm/geometry3d/Transform.d.ts +4 -2
  166. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  167. package/lib/esm/geometry3d/Transform.js +4 -2
  168. package/lib/esm/geometry3d/Transform.js.map +1 -1
  169. package/lib/esm/geometry4d/Map4d.d.ts +5 -5
  170. package/lib/esm/geometry4d/Map4d.js +5 -5
  171. package/lib/esm/geometry4d/Map4d.js.map +1 -1
  172. package/lib/esm/geometry4d/Matrix4d.d.ts +4 -7
  173. package/lib/esm/geometry4d/Matrix4d.d.ts.map +1 -1
  174. package/lib/esm/geometry4d/Matrix4d.js +4 -7
  175. package/lib/esm/geometry4d/Matrix4d.js.map +1 -1
  176. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  177. package/lib/esm/geometry4d/Point4d.js +2 -1
  178. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  179. package/lib/esm/numerics/Newton.d.ts +3 -0
  180. package/lib/esm/numerics/Newton.d.ts.map +1 -1
  181. package/lib/esm/numerics/Newton.js +1 -4
  182. package/lib/esm/numerics/Newton.js.map +1 -1
  183. package/lib/esm/numerics/Polynomials.d.ts +46 -201
  184. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  185. package/lib/esm/numerics/Polynomials.js +132 -444
  186. package/lib/esm/numerics/Polynomials.js.map +1 -1
  187. package/lib/esm/numerics/SmallSystem.d.ts +164 -0
  188. package/lib/esm/numerics/SmallSystem.d.ts.map +1 -0
  189. package/lib/esm/numerics/SmallSystem.js +317 -0
  190. package/lib/esm/numerics/SmallSystem.js.map +1 -0
  191. package/lib/esm/polyface/PolyfaceClip.d.ts +3 -3
  192. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  193. package/lib/esm/polyface/PolyfaceClip.js +1 -1
  194. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  195. package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts +1 -1
  196. package/lib/esm/polyface/multiclip/OffsetMeshContext.d.ts.map +1 -1
  197. package/lib/esm/polyface/multiclip/OffsetMeshContext.js +4 -4
  198. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  199. package/lib/esm/topology/Graph.d.ts.map +1 -1
  200. package/lib/esm/topology/Graph.js +1 -1
  201. package/lib/esm/topology/Graph.js.map +1 -1
  202. package/lib/esm/topology/InsertAndRetriangulateContext.js +1 -1
  203. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  204. package/lib/esm/topology/Merging.d.ts +1 -1
  205. package/lib/esm/topology/Merging.d.ts.map +1 -1
  206. package/lib/esm/topology/Merging.js +1 -1
  207. package/lib/esm/topology/Merging.js.map +1 -1
  208. package/package.json +7 -19
@@ -11,7 +11,8 @@ import { Plane3dByOriginAndVectors } from "../geometry3d/Plane3dByOriginAndVecto
11
11
  import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
12
12
  import { Range1d, Range3d } from "../geometry3d/Range";
13
13
  import { Ray3d } from "../geometry3d/Ray3d";
14
- import { SineCosinePolynomial, SmallSystem, TrigPolynomial } from "../numerics/Polynomials";
14
+ import { SineCosinePolynomial, TrigPolynomial } from "../numerics/Polynomials";
15
+ import { SmallSystem } from "../numerics/SmallSystem";
15
16
  import { CurveExtendMode, CurveExtendOptions } from "./CurveExtendMode";
16
17
  import { CurveIntervalRole, CurveLocationDetail, CurveSearchStatus } from "./CurveLocationDetail";
17
18
  import { CurvePrimitive } from "./CurvePrimitive";
@@ -287,19 +288,19 @@ export class Arc3d extends CurvePrimitive {
287
288
  }
288
289
  /**
289
290
  * Create an elliptical arc from three points on the ellipse: two points on an axis and one in between.
290
- * @param point0 start of arc, on an axis
291
- * @param point1 point on arc somewhere between `point0` and `point2`
292
- * @param point2 point on arc directly opposite `point0`
293
- * @param sweep angular sweep, measured from `point0` in the direction of `point1`.
294
- * For a half-ellipse from `point0` to `point2` passing through `point1`, pass `AngleSweep.createStartEndDegrees(0,180)`.
291
+ * @param start start of arc, on an axis
292
+ * @param middle point on arc somewhere between `start` and `end`
293
+ * @param end point on arc directly opposite `start`
294
+ * @param sweep angular sweep, measured from `start` in the direction of `middle`.
295
+ * For a half-ellipse from `start` to `end` passing through `middle`, pass `AngleSweep.createStartEndDegrees(0,180)`.
295
296
  * Default value is full sweep to create the entire ellipse.
296
297
  * @param result optional preallocated result
297
298
  * @returns elliptical arc, or undefined if construction impossible.
298
299
  */
299
- static createStartMiddleEnd(point0, point1, point2, sweep, result) {
300
- const center = Point3d.createAdd2Scaled(point0, 0.5, point2, 0.5);
301
- const vector0 = Vector3d.createStartEnd(center, point0);
302
- const vector1 = Vector3d.createStartEnd(center, point1);
300
+ static createStartMiddleEnd(start, middle, end, sweep, result) {
301
+ const center = Point3d.createAdd2Scaled(start, 0.5, end, 0.5);
302
+ const vector0 = Vector3d.createStartEnd(center, start);
303
+ const vector1 = Vector3d.createStartEnd(center, middle);
303
304
  const v0DotV1 = vector0.dotProduct(vector1);
304
305
  const v0Len2 = vector0.magnitudeSquared();
305
306
  if (Math.abs(v0DotV1) >= v0Len2)
@@ -307,7 +308,7 @@ export class Arc3d extends CurvePrimitive {
307
308
  const normal = vector0.crossProduct(vector1);
308
309
  const vector90 = normal.unitCrossProductWithDefault(vector0, 0, 0, 0);
309
310
  const v1DotV90 = vector1.dotProduct(vector90);
310
- // Solve the standard ellipse equation for the unknown axis length, given local coords of point1 (v0.v1/||v0||, v90.v1)
311
+ // solve the standard ellipse equation for the unknown axis length, given local coords of middle (v0.v1/||v0||, v90.v1)
311
312
  const v90Len = Geometry.safeDivideFraction(v0Len2 * v1DotV90, Math.sqrt(v0Len2 * v0Len2 - v0DotV1 * v0DotV1), 0);
312
313
  if (Geometry.isSmallMetricDistanceSquared(v90Len))
313
314
  return undefined;
@@ -316,33 +317,55 @@ export class Arc3d extends CurvePrimitive {
316
317
  }
317
318
  /**
318
319
  * Create a circular arc defined by start point, tangent at start point, and end point.
319
- * If tangent is parallel to line segment from start to end, return the line segment.
320
+ * * The circular arc is swept from `start` to `end` in the direction of `tangentAtStart`.
321
+ * * If `tangentAtStart` is parallel to the line segment from `start` to `end`, return the line segment.
320
322
  */
321
323
  static createCircularStartTangentEnd(start, tangentAtStart, end, result) {
322
- // To find the circle passing through start and end with tangentAtStart at start:
323
- // - find line 1: the perpendicular bisector of the line from start to end.
324
- // - find line 2: the perpendicular to the tangentAtStart.
325
- // - intersection of the two lines would be the circle center.
326
- const vector = Vector3d.createStartEnd(start, end);
327
- const normal = tangentAtStart.crossProduct(vector).normalize();
328
- if (normal) {
329
- const vectorPerp = normal.crossProduct(vector);
330
- const tangentPerp = normal.crossProduct(tangentAtStart);
331
- const midPoint = start.plusScaled(vector, 0.5);
332
- const lineSeg1 = LineSegment3d.create(start, start.plusScaled(tangentPerp, 1));
333
- const lineSeg2 = LineSegment3d.create(midPoint, midPoint.plusScaled(vectorPerp, 1));
334
- const intersection = LineSegment3d.closestApproach(lineSeg1, true, lineSeg2, true);
335
- if (intersection) {
336
- const center = intersection.detailA.point;
337
- const vector0 = Vector3d.createStartEnd(center, start);
338
- const vector90 = normal.crossProduct(vector0);
339
- const endVector = Vector3d.createStartEnd(center, end);
340
- const sweep = AngleSweep.create(vector0.signedAngleTo(endVector, normal));
324
+ // see itwinjs-core\core\geometry\internaldocs\Arc3d.md to clarify below algorithm
325
+ const startToEnd = Vector3d.createStartEnd(start, end);
326
+ const frame = Matrix3d.createRigidFromColumns(tangentAtStart, startToEnd, AxisOrder.XYZ);
327
+ if (frame !== undefined) {
328
+ const vv = startToEnd.dotProduct(startToEnd);
329
+ const vw = frame.dotColumnY(startToEnd);
330
+ const radius = Geometry.conditionalDivideCoordinate(vv, 2 * vw);
331
+ if (radius !== undefined) {
332
+ const vector0 = frame.columnY();
333
+ vector0.scaleInPlace(-radius); // center to start
334
+ const vector90 = frame.columnX();
335
+ vector90.scaleInPlace(radius);
336
+ const centerToEnd = vector0.plus(startToEnd);
337
+ const sweepAngle = vector0.angleTo(centerToEnd);
338
+ let sweepRadians = sweepAngle.radians; // always positive and less than PI
339
+ if (tangentAtStart.dotProduct(centerToEnd) < 0.0) // sweepRadians is the wrong way
340
+ sweepRadians = 2.0 * Math.PI - sweepRadians;
341
+ const center = start.plusScaled(vector0, -1.0);
342
+ const sweep = AngleSweep.createStartEndRadians(0.0, sweepRadians);
341
343
  return Arc3d.create(center, vector0, vector90, sweep, result);
342
344
  }
343
345
  }
344
346
  return LineSegment3d.create(start, end);
345
347
  }
348
+ /**
349
+ * Create a circular arc from start point, tangent at start, radius, optional plane normal, arc sweep.
350
+ * * The vector from start point to center is in the direction of upVector crossed with tangentA.
351
+ * @param start start point.
352
+ * @param tangentAtStart vector in tangent direction at the start.
353
+ * @param radius signed radius.
354
+ * @param upVector optional out-of-plane vector. Defaults to positive Z.
355
+ * @param sweep angular range. If single `Angle` is given, start angle is at 0 degrees (the start point).
356
+ */
357
+ static createCircularStartTangentRadius(start, tangentAtStart, radius, upVector, sweep) {
358
+ if (upVector === undefined)
359
+ upVector = Vector3d.unitZ();
360
+ const vector0 = upVector.unitCrossProduct(tangentAtStart);
361
+ if (vector0 === undefined)
362
+ return undefined;
363
+ const center = start.plusScaled(vector0, radius);
364
+ // reverse the A-to-center vector and bring it up to scale
365
+ vector0.scaleInPlace(-radius);
366
+ const vector90 = tangentAtStart.scaleToLength(Math.abs(radius)); // cannot fail; prior unitCrossProduct would have failed first
367
+ return Arc3d.create(center, vector0, vector90, AngleSweep.create(sweep));
368
+ }
346
369
  /**
347
370
  * Create a circular arc defined by start and end points and radius.
348
371
  * @param start start point of the arc
@@ -757,7 +780,7 @@ export class Arc3d extends CurvePrimitive {
757
780
  circularRadius() {
758
781
  return this.isCircular ? this._matrix.columnXMagnitude() : undefined;
759
782
  }
760
- /** Return the larger of the two defining vectors. */
783
+ /** Return the larger length of the two defining vectors. */
761
784
  maxVectorLength() {
762
785
  return Math.max(this._matrix.columnXMagnitude(), this._matrix.columnYMagnitude());
763
786
  }
@@ -965,12 +988,12 @@ export class Arc3d extends CurvePrimitive {
965
988
  };
966
989
  }
967
990
  /** Test if this arc is almost equal to another GeometryQuery object */
968
- isAlmostEqual(otherGeometry) {
991
+ isAlmostEqual(otherGeometry, distanceTol = Geometry.smallMetricDistance, radianTol = Geometry.smallAngleRadians) {
969
992
  if (otherGeometry instanceof Arc3d) {
970
993
  const other = otherGeometry;
971
- return this._center.isAlmostEqual(other._center)
972
- && this._matrix.isAlmostEqual(other._matrix)
973
- && this._sweep.isAlmostEqualAllowPeriodShift(other._sweep);
994
+ return this._center.isAlmostEqual(other._center, distanceTol)
995
+ && this._matrix.isAlmostEqual(other._matrix, distanceTol)
996
+ && this._sweep.isAlmostEqualAllowPeriodShift(other._sweep, radianTol);
974
997
  }
975
998
  return false;
976
999
  }
@@ -1053,7 +1076,12 @@ export class Arc3d extends CurvePrimitive {
1053
1076
  const otherVector0 = this._matrix.multiplyInverse(other.vector0);
1054
1077
  const otherVector90 = this._matrix.multiplyInverse(other.vector90);
1055
1078
  if (otherOrigin && otherVector0 && otherVector90) {
1056
- return { center: otherOrigin, vector0: otherVector0, vector90: otherVector90, sweep: this.sweep.clone() };
1079
+ return {
1080
+ center: otherOrigin,
1081
+ vector0: otherVector0,
1082
+ vector90: otherVector90,
1083
+ sweep: this.sweep.clone(),
1084
+ };
1057
1085
  }
1058
1086
  return undefined;
1059
1087
  }
@@ -1071,7 +1099,7 @@ export class Arc3d extends CurvePrimitive {
1071
1099
  * * `point` is the `point1` input.
1072
1100
  * * both fractions are zero
1073
1101
  * * `arc` is undefined.
1074
- * @param point0 first point of path. (the point before the point of inflection)
1102
+ * @param point0 first point of path (the point before the point of inflection)
1075
1103
  * @param point1 second point of path (the point of inflection)
1076
1104
  * @param point2 third point of path (the point after the point of inflection)
1077
1105
  * @param radius arc radius