@itwin/core-geometry 5.7.2 → 5.8.0-dev.10

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 (242) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/lib/cjs/Geometry.d.ts +24 -14
  3. package/lib/cjs/Geometry.d.ts.map +1 -1
  4. package/lib/cjs/Geometry.js +34 -14
  5. package/lib/cjs/Geometry.js.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.d.ts +1 -1
  7. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurve.js +1 -1
  9. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  10. package/lib/cjs/clipping/ClipPrimitive.d.ts +2 -1
  11. package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
  12. package/lib/cjs/clipping/ClipPrimitive.js +2 -1
  13. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  14. package/lib/cjs/core-geometry.d.ts +1 -0
  15. package/lib/cjs/core-geometry.d.ts.map +1 -1
  16. package/lib/cjs/core-geometry.js +1 -0
  17. package/lib/cjs/core-geometry.js.map +1 -1
  18. package/lib/cjs/curve/Arc3d.d.ts +19 -3
  19. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  20. package/lib/cjs/curve/Arc3d.js +50 -23
  21. package/lib/cjs/curve/Arc3d.js.map +1 -1
  22. package/lib/cjs/curve/ConstrainedCurve2d.d.ts +149 -0
  23. package/lib/cjs/curve/ConstrainedCurve2d.d.ts.map +1 -0
  24. package/lib/cjs/curve/ConstrainedCurve2d.js +317 -0
  25. package/lib/cjs/curve/ConstrainedCurve2d.js.map +1 -0
  26. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +18 -5
  27. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  28. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +34 -14
  29. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  30. package/lib/cjs/curve/CurveCollection.d.ts +12 -11
  31. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  32. package/lib/cjs/curve/CurveCollection.js +36 -36
  33. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  34. package/lib/cjs/curve/CurveExtendMode.d.ts +5 -5
  35. package/lib/cjs/curve/CurveExtendMode.d.ts.map +1 -1
  36. package/lib/cjs/curve/CurveExtendMode.js +4 -1
  37. package/lib/cjs/curve/CurveExtendMode.js.map +1 -1
  38. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  39. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  40. package/lib/cjs/curve/CurvePrimitive.d.ts +14 -2
  41. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  42. package/lib/cjs/curve/CurvePrimitive.js +19 -3
  43. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  44. package/lib/cjs/curve/LineSegment3d.d.ts +2 -2
  45. package/lib/cjs/curve/LineSegment3d.d.ts.map +1 -1
  46. package/lib/cjs/curve/LineSegment3d.js +2 -2
  47. package/lib/cjs/curve/LineSegment3d.js.map +1 -1
  48. package/lib/cjs/curve/LineString3d.d.ts +1 -1
  49. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  50. package/lib/cjs/curve/LineString3d.js +1 -1
  51. package/lib/cjs/curve/LineString3d.js.map +1 -1
  52. package/lib/cjs/curve/Path.d.ts +4 -15
  53. package/lib/cjs/curve/Path.d.ts.map +1 -1
  54. package/lib/cjs/curve/Path.js +1 -35
  55. package/lib/cjs/curve/Path.js.map +1 -1
  56. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts +2 -1
  57. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  58. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +18 -13
  59. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  60. package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.d.ts +26 -0
  61. package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.d.ts.map +1 -0
  62. package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.js +78 -0
  63. package/lib/cjs/curve/internalContexts/PointToCurveTangentHandler.js.map +1 -0
  64. package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts +152 -0
  65. package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts.map +1 -0
  66. package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js +843 -0
  67. package/lib/cjs/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js.map +1 -0
  68. package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.d.ts +97 -0
  69. package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.d.ts.map +1 -0
  70. package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.js +300 -0
  71. package/lib/cjs/curve/internalContexts/geometry2d/ConstraintSet.js.map +1 -0
  72. package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts +105 -0
  73. package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts.map +1 -0
  74. package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.js +141 -0
  75. package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2d.js.map +1 -0
  76. package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts +27 -0
  77. package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts.map +1 -0
  78. package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js +152 -0
  79. package/lib/cjs/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js.map +1 -0
  80. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts +81 -0
  81. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts.map +1 -0
  82. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.js +170 -0
  83. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedCircle2d.js.map +1 -0
  84. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts +96 -0
  85. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts.map +1 -0
  86. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.js +187 -0
  87. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedEllipse2d.js.map +1 -0
  88. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts +91 -0
  89. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts.map +1 -0
  90. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js +197 -0
  91. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js.map +1 -0
  92. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts +129 -0
  93. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts.map +1 -0
  94. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.js +208 -0
  95. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedLine2d.js.map +1 -0
  96. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts +87 -0
  97. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts.map +1 -0
  98. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.js +193 -0
  99. package/lib/cjs/curve/internalContexts/geometry2d/UnboundedParabola2d.js.map +1 -0
  100. package/lib/cjs/geometry3d/Ellipsoid.d.ts +2 -1
  101. package/lib/cjs/geometry3d/Ellipsoid.d.ts.map +1 -1
  102. package/lib/cjs/geometry3d/Ellipsoid.js +2 -1
  103. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  104. package/lib/cjs/geometry3d/Point2dVector2d.d.ts +7 -0
  105. package/lib/cjs/geometry3d/Point2dVector2d.d.ts.map +1 -1
  106. package/lib/cjs/geometry3d/Point2dVector2d.js +9 -0
  107. package/lib/cjs/geometry3d/Point2dVector2d.js.map +1 -1
  108. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  109. package/lib/cjs/geometry3d/Ray3d.d.ts +5 -0
  110. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  111. package/lib/cjs/geometry3d/Ray3d.js +7 -0
  112. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  113. package/lib/cjs/numerics/Newton.d.ts.map +1 -1
  114. package/lib/cjs/numerics/Newton.js +2 -1
  115. package/lib/cjs/numerics/Newton.js.map +1 -1
  116. package/lib/cjs/numerics/Polynomials.d.ts.map +1 -1
  117. package/lib/cjs/numerics/Polynomials.js +8 -6
  118. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  119. package/lib/cjs/topology/HalfEdgeGraphSpineContext.d.ts.map +1 -1
  120. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js +3 -1
  121. package/lib/cjs/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  122. package/lib/esm/Geometry.d.ts +24 -14
  123. package/lib/esm/Geometry.d.ts.map +1 -1
  124. package/lib/esm/Geometry.js +34 -14
  125. package/lib/esm/Geometry.js.map +1 -1
  126. package/lib/esm/bspline/BSplineCurve.d.ts +1 -1
  127. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  128. package/lib/esm/bspline/BSplineCurve.js +1 -1
  129. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  130. package/lib/esm/clipping/ClipPrimitive.d.ts +2 -1
  131. package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
  132. package/lib/esm/clipping/ClipPrimitive.js +2 -1
  133. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  134. package/lib/esm/core-geometry.d.ts +1 -0
  135. package/lib/esm/core-geometry.d.ts.map +1 -1
  136. package/lib/esm/core-geometry.js +1 -0
  137. package/lib/esm/core-geometry.js.map +1 -1
  138. package/lib/esm/curve/Arc3d.d.ts +19 -3
  139. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  140. package/lib/esm/curve/Arc3d.js +50 -23
  141. package/lib/esm/curve/Arc3d.js.map +1 -1
  142. package/lib/esm/curve/ConstrainedCurve2d.d.ts +149 -0
  143. package/lib/esm/curve/ConstrainedCurve2d.d.ts.map +1 -0
  144. package/lib/esm/curve/ConstrainedCurve2d.js +313 -0
  145. package/lib/esm/curve/ConstrainedCurve2d.js.map +1 -0
  146. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +18 -5
  147. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  148. package/lib/esm/curve/CurveChainWithDistanceIndex.js +34 -14
  149. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  150. package/lib/esm/curve/CurveCollection.d.ts +12 -11
  151. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  152. package/lib/esm/curve/CurveCollection.js +36 -36
  153. package/lib/esm/curve/CurveCollection.js.map +1 -1
  154. package/lib/esm/curve/CurveExtendMode.d.ts +5 -5
  155. package/lib/esm/curve/CurveExtendMode.d.ts.map +1 -1
  156. package/lib/esm/curve/CurveExtendMode.js +4 -1
  157. package/lib/esm/curve/CurveExtendMode.js.map +1 -1
  158. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  159. package/lib/esm/curve/CurveFactory.js.map +1 -1
  160. package/lib/esm/curve/CurvePrimitive.d.ts +14 -2
  161. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  162. package/lib/esm/curve/CurvePrimitive.js +19 -3
  163. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  164. package/lib/esm/curve/LineSegment3d.d.ts +2 -2
  165. package/lib/esm/curve/LineSegment3d.d.ts.map +1 -1
  166. package/lib/esm/curve/LineSegment3d.js +2 -2
  167. package/lib/esm/curve/LineSegment3d.js.map +1 -1
  168. package/lib/esm/curve/LineString3d.d.ts +1 -1
  169. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  170. package/lib/esm/curve/LineString3d.js +1 -1
  171. package/lib/esm/curve/LineString3d.js.map +1 -1
  172. package/lib/esm/curve/Path.d.ts +4 -15
  173. package/lib/esm/curve/Path.d.ts.map +1 -1
  174. package/lib/esm/curve/Path.js +1 -35
  175. package/lib/esm/curve/Path.js.map +1 -1
  176. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts +2 -1
  177. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  178. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +19 -14
  179. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  180. package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.d.ts +26 -0
  181. package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.d.ts.map +1 -0
  182. package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.js +74 -0
  183. package/lib/esm/curve/internalContexts/PointToCurveTangentHandler.js.map +1 -0
  184. package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts +152 -0
  185. package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.d.ts.map +1 -0
  186. package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js +839 -0
  187. package/lib/esm/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.js.map +1 -0
  188. package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.d.ts +97 -0
  189. package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.d.ts.map +1 -0
  190. package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.js +295 -0
  191. package/lib/esm/curve/internalContexts/geometry2d/ConstraintSet.js.map +1 -0
  192. package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts +105 -0
  193. package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.d.ts.map +1 -0
  194. package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.js +135 -0
  195. package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2d.js.map +1 -0
  196. package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts +27 -0
  197. package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.d.ts.map +1 -0
  198. package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js +148 -0
  199. package/lib/esm/curve/internalContexts/geometry2d/ImplicitCurve2dConverter.js.map +1 -0
  200. package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts +81 -0
  201. package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.d.ts.map +1 -0
  202. package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.js +166 -0
  203. package/lib/esm/curve/internalContexts/geometry2d/UnboundedCircle2d.js.map +1 -0
  204. package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts +96 -0
  205. package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.d.ts.map +1 -0
  206. package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.js +183 -0
  207. package/lib/esm/curve/internalContexts/geometry2d/UnboundedEllipse2d.js.map +1 -0
  208. package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts +91 -0
  209. package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.d.ts.map +1 -0
  210. package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js +193 -0
  211. package/lib/esm/curve/internalContexts/geometry2d/UnboundedHyperbola2d.js.map +1 -0
  212. package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts +129 -0
  213. package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.d.ts.map +1 -0
  214. package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.js +204 -0
  215. package/lib/esm/curve/internalContexts/geometry2d/UnboundedLine2d.js.map +1 -0
  216. package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts +87 -0
  217. package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.d.ts.map +1 -0
  218. package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.js +189 -0
  219. package/lib/esm/curve/internalContexts/geometry2d/UnboundedParabola2d.js.map +1 -0
  220. package/lib/esm/geometry3d/Ellipsoid.d.ts +2 -1
  221. package/lib/esm/geometry3d/Ellipsoid.d.ts.map +1 -1
  222. package/lib/esm/geometry3d/Ellipsoid.js +2 -1
  223. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  224. package/lib/esm/geometry3d/Point2dVector2d.d.ts +7 -0
  225. package/lib/esm/geometry3d/Point2dVector2d.d.ts.map +1 -1
  226. package/lib/esm/geometry3d/Point2dVector2d.js +9 -0
  227. package/lib/esm/geometry3d/Point2dVector2d.js.map +1 -1
  228. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  229. package/lib/esm/geometry3d/Ray3d.d.ts +5 -0
  230. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  231. package/lib/esm/geometry3d/Ray3d.js +7 -0
  232. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  233. package/lib/esm/numerics/Newton.d.ts.map +1 -1
  234. package/lib/esm/numerics/Newton.js +2 -1
  235. package/lib/esm/numerics/Newton.js.map +1 -1
  236. package/lib/esm/numerics/Polynomials.d.ts.map +1 -1
  237. package/lib/esm/numerics/Polynomials.js +8 -6
  238. package/lib/esm/numerics/Polynomials.js.map +1 -1
  239. package/lib/esm/topology/HalfEdgeGraphSpineContext.d.ts.map +1 -1
  240. package/lib/esm/topology/HalfEdgeGraphSpineContext.js +3 -1
  241. package/lib/esm/topology/HalfEdgeGraphSpineContext.js.map +1 -1
  242. package/package.json +3 -3
@@ -1,8 +1,9 @@
1
+ /** @packageDocumentation
2
+ * @module Curve
3
+ */
1
4
  import { GeometryHandler } from "../geometry3d/GeometryHandler";
2
5
  import { Point3d } from "../geometry3d/Point3dVector3d";
3
6
  import { CurveChain } from "./CurveCollection";
4
- import { VariantCurveExtendParameter } from "./CurveExtendMode";
5
- import { CurveLocationDetail } from "./CurveLocationDetail";
6
7
  import { CurvePrimitive } from "./CurvePrimitive";
7
8
  import { RecursiveCurveProcessor } from "./CurveProcessor";
8
9
  import { GeometryQuery } from "./GeometryQuery";
@@ -29,24 +30,12 @@ export declare class Path extends CurveChain {
29
30
  */
30
31
  static create(...curves: Array<CurvePrimitive | Point3d[]>): Path;
31
32
  /**
32
- * Create a path from a an array of curve primitives.
33
+ * Create a path from an array of curve primitives.
33
34
  * @param curves array of individual curve primitives.
34
35
  */
35
36
  static createArray(curves: CurvePrimitive[]): Path;
36
37
  /** Return a deep copy, with leaf-level curve primitives stroked. */
37
38
  cloneStroked(options?: StrokeOptions): Path;
38
- /**
39
- * Return the closest point on the contained curves.
40
- * @param spacePoint point in space.
41
- * @param extend compute the closest point to the path extended according to variant type:
42
- * * false: do not extend the path
43
- * * true: extend the path at both start and end
44
- * * CurveExtendOptions: extend the path in the specified manner at both start and end
45
- * * CurveExtendOptions[]: first entry applies to path start; second, to path end; any other entries ignored
46
- * @param result optional pre-allocated detail to populate and return.
47
- * @returns details of the closest point.
48
- */
49
- closestPoint(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail): CurveLocationDetail | undefined;
50
39
  /** Return the boundary type (1) of a corresponding MicroStation CurveVector */
51
40
  dgnBoundaryType(): number;
52
41
  /** Clone as a new `Path` with no primitives */
@@ -1 +1 @@
1
- {"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../../src/curve/Path.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EA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":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;GAKG;AACH,qBAAa,IAAK,SAAQ,UAAU;IAClC,wCAAwC;IACxC,SAAgB,mBAAmB,UAAU;IAC7C,+CAA+C;IACxC,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IAGzD,2DAA2D;IACpD,wBAAwB,CAAC,SAAS,EAAE,uBAAuB,EAAE,aAAa,GAAE,MAAW,GAAG,IAAI;IAGrG,+BAA+B;;IAI/B;;;;OAIG;WACW,MAAM,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,cAAc,GAAG,OAAO,EAAE,CAAC,GAAG,IAAI;IAaxE;;;OAGG;WACW,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI;IAGzD,oEAAoE;IAC7D,YAAY,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI;IAMlD,+EAA+E;IACxE,eAAe,IAAI,MAAM;IAGhC,+CAA+C;IACxC,cAAc,IAAI,IAAI;IAG7B,sEAAsE;IAC/D,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;CAGhE"}
@@ -5,15 +5,9 @@
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.Path = void 0;
8
- /** @packageDocumentation
9
- * @module Curve
10
- */
11
- const core_bentley_1 = require("@itwin/core-bentley");
12
8
  const Point3dVector3d_1 = require("../geometry3d/Point3dVector3d");
13
9
  const CurveChainWithDistanceIndex_1 = require("./CurveChainWithDistanceIndex");
14
10
  const CurveCollection_1 = require("./CurveCollection");
15
- const CurveExtendMode_1 = require("./CurveExtendMode");
16
- const CurveLocationDetail_1 = require("./CurveLocationDetail");
17
11
  const CurvePrimitive_1 = require("./CurvePrimitive");
18
12
  const LineString3d_1 = require("./LineString3d");
19
13
  /**
@@ -56,7 +50,7 @@ class Path extends CurveCollection_1.CurveChain {
56
50
  return result;
57
51
  }
58
52
  /**
59
- * Create a path from a an array of curve primitives.
53
+ * Create a path from an array of curve primitives.
60
54
  * @param curves array of individual curve primitives.
61
55
  */
62
56
  static createArray(curves) {
@@ -69,34 +63,6 @@ class Path extends CurveCollection_1.CurveChain {
69
63
  curve.emitStrokes(strokes, options);
70
64
  return Path.create(strokes);
71
65
  }
72
- /**
73
- * Return the closest point on the contained curves.
74
- * @param spacePoint point in space.
75
- * @param extend compute the closest point to the path extended according to variant type:
76
- * * false: do not extend the path
77
- * * true: extend the path at both start and end
78
- * * CurveExtendOptions: extend the path in the specified manner at both start and end
79
- * * CurveExtendOptions[]: first entry applies to path start; second, to path end; any other entries ignored
80
- * @param result optional pre-allocated detail to populate and return.
81
- * @returns details of the closest point.
82
- */
83
- closestPoint(spacePoint, extend = false, result) {
84
- let detailA;
85
- const detailB = new CurveLocationDetail_1.CurveLocationDetail();
86
- if (this.children !== undefined) {
87
- for (let i = 0; i < this.children.length; i++) {
88
- const child = this.children[i]; // head only extends at start; tail, only at end. NOTE: child may be both head and tail!
89
- const mode0 = (i === 0) ? CurveExtendMode_1.CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0) : CurveExtendMode_1.CurveExtendMode.None;
90
- const mode1 = (i === this.children.length - 1) ? CurveExtendMode_1.CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1) : CurveExtendMode_1.CurveExtendMode.None;
91
- if (child.closestPoint(spacePoint, [mode0, mode1], detailB)) {
92
- const smaller = CurveLocationDetail_1.CurveLocationDetail.chooseSmallerA(detailA, detailB);
93
- (0, core_bentley_1.assert)(undefined !== smaller, "expect defined because detailB is always defined");
94
- detailA = result = smaller.clone(result);
95
- }
96
- }
97
- }
98
- return detailA;
99
- }
100
66
  /** Return the boundary type (1) of a corresponding MicroStation CurveVector */
101
67
  dgnBoundaryType() {
102
68
  return 1;
@@ -1 +1 @@
1
- {"version":3,"file":"Path.js","sourceRoot":"","sources":["../../../src/curve/Path.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAA6C;AAE7C,mEAAwD;AACxD,+EAA4E;AAC5E,uDAA+C;AAC/C,uDAAqG;AACrG,+DAA4D;AAC5D,qDAAkD;AAGlD,iDAA8C;AAG9C;;;;;GAKG;AACH,MAAa,IAAK,SAAQ,4BAAU;IAClC,wCAAwC;IACxB,mBAAmB,GAAG,MAAM,CAAC;IAC7C,+CAA+C;IACxC,mBAAmB,CAAC,KAAoB;QAC7C,OAAO,KAAK,YAAY,IAAI,CAAC;IAC/B,CAAC;IACD,2DAA2D;IACpD,wBAAwB,CAAC,SAAkC,EAAE,gBAAwB,CAAC,CAAC;QAC5F,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACrD,CAAC;IACD,+BAA+B;IAC/B;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,GAAG,MAAyC;QAC/D,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QAC1B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,KAAK,YAAY,yDAA2B;gBAC9C,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBAC1C,IAAI,KAAK,YAAY,+BAAc;gBACtC,MAAM,CAAC,QAAQ,CA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AAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,iCAAe,CAAC,IAAI,CAAC;gBACnI,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,oCAAkB,CAAC,mDAAmD,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,iCAAe,CAAC,IAAI,CAAC;gBAC1J,IAAI,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;oBAC5D,MAAM,OAAO,GAAG,yCAAmB,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;oBACrE,IAAA,qBAAM,EAAC,SAAS,KAAK,OAAO,EAAE,kDAAkD,CAAC,CAAC;oBAClF,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,+EAA+E;IACxE,eAAe;QACpB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,+CAA+C;IACxC,cAAc;QACnB,OAAO,IAAI,IAAI,EAAE,CAAC;IACpB,CAAC;IACD,sEAAsE;IAC/D,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AAzFD,oBAyFC","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 { assert } from \"@itwin/core-bentley\";\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { CurveChainWithDistanceIndex } from \"./CurveChainWithDistanceIndex\";\r\nimport { CurveChain } from \"./CurveCollection\";\r\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"./CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"./CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * * A `Path` object is a collection of curves that join head-to-tail to form a path.\r\n * * A `Path` object does not bound a planar region. Use `Loop` to indicate region bounding.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport class Path extends CurveChain {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"path\";\r\n /** Test if `other` is an instance of `Path` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof Path;\r\n }\r\n /** Invoke `processor.announcePath(this, indexInParent)` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announcePath(this, indexInParent);\r\n }\r\n /** Construct an empty path. */\r\n public constructor() {\r\n super();\r\n }\r\n /**\r\n * Create a path from a variable length list of curve primitives\r\n * * CurvePrimitive params are captured.\r\n * @param curves variable length list of individual curve primitives or point arrays.\r\n */\r\n public static create(...curves: Array<CurvePrimitive | Point3d[]>): Path {\r\n const result = new Path();\r\n for (const curve of curves) {\r\n if (curve instanceof CurveChainWithDistanceIndex)\r\n result.children.push(...curve.path.children);\r\n else if (curve instanceof CurvePrimitive)\r\n result.children.push(curve);\r\n else if (Array.isArray(curve) && curve.length > 0 && curve[0] instanceof Point3d) {\r\n result.children.push(LineString3d.create(curve));\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create a path from a an array of curve primitives.\r\n * @param curves array of individual curve primitives.\r\n */\r\n public static createArray(curves: CurvePrimitive[]): Path {\r\n return this.create(...curves);\r\n }\r\n /** Return a deep copy, with leaf-level curve primitives stroked. */\r\n public cloneStroked(options?: StrokeOptions): Path {\r\n const strokes = LineString3d.create();\r\n for (const curve of this.children)\r\n curve.emitStrokes(strokes, options);\r\n return Path.create(strokes);\r\n }\r\n /**\r\n * Return the closest point on the contained curves.\r\n * @param spacePoint point in space.\r\n * @param extend compute the closest point to the path extended according to variant type:\r\n * * false: do not extend the path\r\n * * true: extend the path at both start and end\r\n * * CurveExtendOptions: extend the path in the specified manner at both start and end\r\n * * CurveExtendOptions[]: first entry applies to path start; second, to path end; any other entries ignored\r\n * @param result optional pre-allocated detail to populate and return.\r\n * @returns details of the closest point.\r\n */\r\n public override closestPoint(\r\n spacePoint: Point3d, extend: VariantCurveExtendParameter = false, result?: CurveLocationDetail,\r\n ): CurveLocationDetail | undefined {\r\n let detailA: CurveLocationDetail | undefined;\r\n const detailB = new CurveLocationDetail();\r\n if (this.children !== undefined) {\r\n for (let i = 0; i < this.children.length; i++) {\r\n const child = this.children[i]; // head only extends at start; tail, only at end. NOTE: child may be both head and tail!\r\n const mode0 = (i === 0) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 0) : CurveExtendMode.None;\r\n const mode1 = (i === this.children.length - 1) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(extend, 1) : CurveExtendMode.None;\r\n if (child.closestPoint(spacePoint, [mode0, mode1], detailB)) {\r\n const smaller = CurveLocationDetail.chooseSmallerA(detailA, detailB);\r\n assert(undefined !== smaller, \"expect defined because detailB is always defined\");\r\n detailA = result = smaller.clone(result);\r\n }\r\n }\r\n }\r\n return detailA;\r\n }\r\n /** Return the boundary type (1) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 1;\r\n }\r\n /** Clone as a new `Path` with no primitives */\r\n public cloneEmptyPeer(): Path {\r\n return new Path();\r\n }\r\n /** Second step of double dispatch: call `handler.handlePath(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handlePath(this);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Path.js","sourceRoot":"","sources":["../../../src/curve/Path.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAO/F,mEAAwD;AACxD,+EAA4E;AAC5E,uDAA+C;AAC/C,qDAAkD;AAGlD,iDAA8C;AAG9C;;;;;GAKG;AACH,MAAa,IAAK,SAAQ,4BAAU;IAClC,wCAAwC;IACxB,mBAAmB,GAAG,MAAM,CAAC;IAC7C,+CAA+C;IACxC,mBAAmB,CAAC,KAAoB;QAC7C,OAAO,KAAK,YAAY,IAAI,CAAC;IAC/B,CAAC;IACD,2DAA2D;IACpD,wBAAwB,CAAC,SAAkC,EAAE,gBAAwB,CAAC,CAAC;QAC5F,OAAO,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACrD,CAAC;IACD,+BAA+B;IAC/B;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,MAAM,CAAC,GAAG,MAAyC;QAC/D,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QAC1B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,KAAK,YAAY,yDAA2B;gBAC9C,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBAC1C,IAAI,KAAK,YAAY,+BAAc;gBACtC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;iBACzB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,YAAY,yBAAO,EAAE,CAAC;gBACjF,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,2BAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,WAAW,CAAC,MAAwB;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC;IAChC,CAAC;IACD,oEAAoE;IAC7D,YAAY,CAAC,OAAuB;QACzC,MAAM,OAAO,GAAG,2BAAY,CAAC,MAAM,EAAE,CAAC;QACtC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IACD,+EAA+E;IACxE,eAAe;QACpB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,+CAA+C;IACxC,cAAc;QACnB,OAAO,IAAI,IAAI,EAAE,CAAC;IACpB,CAAC;IACD,sEAAsE;IAC/D,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AA3DD,oBA2DC","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 { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { Point3d } from \"../geometry3d/Point3dVector3d\";\r\nimport { CurveChainWithDistanceIndex } from \"./CurveChainWithDistanceIndex\";\r\nimport { CurveChain } from \"./CurveCollection\";\r\nimport { CurvePrimitive } from \"./CurvePrimitive\";\r\nimport { RecursiveCurveProcessor } from \"./CurveProcessor\";\r\nimport { GeometryQuery } from \"./GeometryQuery\";\r\nimport { LineString3d } from \"./LineString3d\";\r\nimport { StrokeOptions } from \"./StrokeOptions\";\r\n\r\n/**\r\n * * A `Path` object is a collection of curves that join head-to-tail to form a path.\r\n * * A `Path` object does not bound a planar region. Use `Loop` to indicate region bounding.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport class Path extends CurveChain {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"path\";\r\n /** Test if `other` is an instance of `Path` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof Path;\r\n }\r\n /** Invoke `processor.announcePath(this, indexInParent)` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announcePath(this, indexInParent);\r\n }\r\n /** Construct an empty path. */\r\n public constructor() {\r\n super();\r\n }\r\n /**\r\n * Create a path from a variable length list of curve primitives\r\n * * CurvePrimitive params are captured.\r\n * @param curves variable length list of individual curve primitives or point arrays.\r\n */\r\n public static create(...curves: Array<CurvePrimitive | Point3d[]>): Path {\r\n const result = new Path();\r\n for (const curve of curves) {\r\n if (curve instanceof CurveChainWithDistanceIndex)\r\n result.children.push(...curve.path.children);\r\n else if (curve instanceof CurvePrimitive)\r\n result.children.push(curve);\r\n else if (Array.isArray(curve) && curve.length > 0 && curve[0] instanceof Point3d) {\r\n result.children.push(LineString3d.create(curve));\r\n }\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create a path from an array of curve primitives.\r\n * @param curves array of individual curve primitives.\r\n */\r\n public static createArray(curves: CurvePrimitive[]): Path {\r\n return this.create(...curves);\r\n }\r\n /** Return a deep copy, with leaf-level curve primitives stroked. */\r\n public cloneStroked(options?: StrokeOptions): Path {\r\n const strokes = LineString3d.create();\r\n for (const curve of this.children)\r\n curve.emitStrokes(strokes, options);\r\n return Path.create(strokes);\r\n }\r\n /** Return the boundary type (1) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n return 1;\r\n }\r\n /** Clone as a new `Path` with no primitives */\r\n public cloneEmptyPeer(): Path {\r\n return new Path();\r\n }\r\n /** Second step of double dispatch: call `handler.handlePath(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handlePath(this);\r\n }\r\n}\r\n"]}
@@ -16,6 +16,7 @@ export declare class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler i
16
16
  private _closestPoint;
17
17
  private _spacePoint;
18
18
  private _extend;
19
+ private _xyOnly;
19
20
  private _fractionA;
20
21
  private _functionA;
21
22
  private _fractionB;
@@ -25,7 +26,7 @@ export declare class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler i
25
26
  private _workRay;
26
27
  private _newtonSolver;
27
28
  /** Constructor */
28
- constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail);
29
+ constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail, xyOnly?: boolean);
29
30
  claimResult(): CurveLocationDetail | undefined;
30
31
  needPrimaryGeometryForStrokes(): boolean;
31
32
  startCurvePrimitive(curve: CurvePrimitive | undefined): void;
@@ -1 +1 @@
1
- {"version":3,"file":"ClosestPointStrokeHandler.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAsB,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,uBAAwB,YAAW,cAAc;IAC9F,OAAO,CAAC,MAAM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AAM,EAAE,SAAS,EAAE,MAAM,GAC3E,IAAI;IAaP,OAAO,CAAC,iBAAiB;IASlB,uBAAuB,CAC5B,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAC9G,IAAI;IAcP;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,wBAAwB;IAIhC;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAYjB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAU1C,OAAO,CAAC,WAAW;IAUZ,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ;CAIhF"}
@@ -13,6 +13,7 @@ const Geometry_1 = require("../../Geometry");
13
13
  const Point3dVector3d_1 = require("../../geometry3d/Point3dVector3d");
14
14
  const Ray3d_1 = require("../../geometry3d/Ray3d");
15
15
  const Newton_1 = require("../../numerics/Newton");
16
+ const SmallSystem_1 = require("../../numerics/SmallSystem");
16
17
  const CurveExtendMode_1 = require("../CurveExtendMode");
17
18
  const CurveLocationDetail_1 = require("../CurveLocationDetail");
18
19
  const NewtonRtoRStrokeHandler_1 = require("./NewtonRtoRStrokeHandler");
@@ -25,6 +26,7 @@ class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler_1.NewtonRtoRStro
25
26
  _closestPoint;
26
27
  _spacePoint;
27
28
  _extend;
29
+ _xyOnly;
28
30
  // fraction and function value on one side of an interval that may bracket a root
29
31
  _fractionA = 0;
30
32
  _functionA = 0;
@@ -37,7 +39,7 @@ class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler_1.NewtonRtoRStro
37
39
  _workRay;
38
40
  _newtonSolver;
39
41
  /** Constructor */
40
- constructor(spacePoint, extend, result) {
42
+ constructor(spacePoint, extend, result, xyOnly) {
41
43
  super();
42
44
  this._spacePoint = spacePoint;
43
45
  this._workPoint = Point3dVector3d_1.Point3d.create();
@@ -46,6 +48,7 @@ class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler_1.NewtonRtoRStro
46
48
  if (this._closestPoint)
47
49
  this._closestPoint.a = Geometry_1.Geometry.largeCoordinateResult;
48
50
  this._extend = extend ?? false;
51
+ this._xyOnly = xyOnly ?? false;
49
52
  this.startCurvePrimitive(undefined);
50
53
  this._newtonSolver = new Newton_1.Newton1dUnboundedApproximateDerivative(this);
51
54
  }
@@ -86,7 +89,7 @@ class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler_1.NewtonRtoRStro
86
89
  }
87
90
  }
88
91
  announceCandidate(cp, fraction, point) {
89
- const distance = this._spacePoint.distance(point);
92
+ const distance = this._xyOnly ? this._spacePoint.distanceXY(point) : this._spacePoint.distance(point);
90
93
  if (this._closestPoint && distance > this._closestPoint.a)
91
94
  return;
92
95
  this._closestPoint = CurveLocationDetail_1.CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);
@@ -95,16 +98,15 @@ class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler_1.NewtonRtoRStro
95
98
  this._closestPoint.curve = this._parentCurvePrimitive;
96
99
  }
97
100
  announceSegmentInterval(cp, point0, point1, _numStrokes, fraction0, fraction1) {
98
- let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);
99
- // only consider extending the segment if the immediate caller says we are at endpoints
100
- if (!this._extend)
101
- localFraction = Geometry_1.Geometry.clampToStartEnd(localFraction, 0.0, 1.0);
102
- else {
103
- if (fraction0 !== 0.0)
104
- localFraction = Math.max(localFraction, 0.0);
105
- if (fraction1 !== 1.0)
106
- localFraction = Math.min(localFraction, 1.0);
107
- }
101
+ let localFraction = 0;
102
+ if (this._xyOnly)
103
+ localFraction = SmallSystem_1.SmallSystem.lineSegment3dXYClosestPointUnbounded(point0, point1, this._spacePoint) ?? 0;
104
+ else
105
+ localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);
106
+ // only consider segment extension at a parent curve endpoint, i.e. when fraction0 is 0 or fraction1 is 1
107
+ const extend0 = (fraction0 === 0) ? CurveExtendMode_1.CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 0) : CurveExtendMode_1.CurveExtendMode.None;
108
+ const extend1 = (fraction1 === 1) ? CurveExtendMode_1.CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 1) : CurveExtendMode_1.CurveExtendMode.None;
109
+ localFraction = CurveExtendMode_1.CurveExtendOptions.correctFraction([extend0, extend1], localFraction);
108
110
  this._workPoint = point0.interpolate(localFraction, point1);
109
111
  const globalFraction = Geometry_1.Geometry.interpolate(fraction0, localFraction, fraction1);
110
112
  this.announceCandidate(cp, globalFraction, this._workPoint);
@@ -153,7 +155,10 @@ class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler_1.NewtonRtoRStro
153
155
  this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);
154
156
  else
155
157
  return undefined;
156
- return this._workRay.dotProductToPoint(this._spacePoint);
158
+ if (this._xyOnly)
159
+ return this._workRay.dotProductToPointXY(this._spacePoint);
160
+ else
161
+ return this._workRay.dotProductToPoint(this._spacePoint);
157
162
  }
158
163
  evaluate(fraction) {
159
164
  let curve = this._curve;
@@ -1 +1 @@
1
- {"version":3,"file":"ClosestPointStrokeHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/ClosestPointStrokeHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,6CAA0C;AAE1C,sEAAqE;AACrE,kDAA+C;AAC/C,kDAA+E;AAC/E,wDAAqF;AACrF,gEAA6D;AAE7D,uEAAoE;AAEpE;;;GAGG;AACH,MAAa,yBAA0B,SAAQ,iDAAuB;IAC5D,MAAM,CAA6B;IACnC,aAAa,CAAkC;IAC/C,WAAW,CAAU;I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,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;AAnKD,8DAmKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\r\nimport { CurveExtendOptions, VariantCurveExtendParameter } from \"../CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\r\n\r\n/**\r\n * Context for searching for the closest point to a CurvePrimitive.\r\n * @internal\r\n */\r\nexport class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _closestPoint: CurveLocationDetail | undefined;\r\n private _spacePoint: Point3d;\r\n private _extend: VariantCurveExtendParameter;\r\n // fraction and function value on one side of an interval that may bracket a root\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n // fraction and function value on the other side of an interval that may bracket a root\r\n private _fractionB: number = 0;\r\n private _functionB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars to use within methods\r\n private _workPoint: Point3d;\r\n private _workRay: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n /** Constructor */\r\n public constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail) {\r\n super();\r\n this._spacePoint = spacePoint;\r\n this._workPoint = Point3d.create();\r\n this._workRay = Ray3d.createZero();\r\n this._closestPoint = result;\r\n if (this._closestPoint)\r\n this._closestPoint.a = Geometry.largeCoordinateResult\r\n this._extend = extend ?? false;\r\n this.startCurvePrimitive(undefined);\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n public claimResult(): CurveLocationDetail | undefined {\r\n if (this._closestPoint) {\r\n this._newtonSolver.setX(this._closestPoint.fraction);\r\n this._curve = this._closestPoint.curve;\r\n if (this._newtonSolver.runIterations()) {\r\n let fraction = this._newtonSolver.getX();\r\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\r\n this.announceSolutionFraction(fraction);\r\n }\r\n }\r\n return this._closestPoint;\r\n }\r\n public needPrimaryGeometryForStrokes() {\r\n return true;\r\n }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n }\r\n public endCurvePrimitive() {\r\n }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n this.startCurvePrimitive(cp);\r\n this.announceSolutionFraction(0.0); // test start point as closest\r\n this.announceSolutionFraction(1.0); // test end point as closest\r\n if (numStrokes < 1)\r\n numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n }\r\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\r\n const distance = this._spacePoint.distance(point);\r\n if (this._closestPoint && distance > this._closestPoint.a)\r\n return;\r\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\r\n this._closestPoint.a = distance;\r\n if (this._parentCurvePrimitive !== undefined)\r\n this._closestPoint.curve = this._parentCurvePrimitive;\r\n }\r\n public announceSegmentInterval(\r\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n let localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\r\n // only consider extending the segment if the immediate caller says we are at endpoints\r\n if (!this._extend)\r\n localFraction = Geometry.clampToStartEnd(localFraction, 0.0, 1.0);\r\n else {\r\n if (fraction0 !== 0.0)\r\n localFraction = Math.max(localFraction, 0.0);\r\n if (fraction1 !== 1.0)\r\n localFraction = Math.min(localFraction, 1.0);\r\n }\r\n this._workPoint = point0.interpolate(localFraction, point1);\r\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\r\n this.announceCandidate(cp, globalFraction, this._workPoint);\r\n }\r\n /**\r\n * Given a function `f` and (unordered) fractions `a` and `b`, search for and announce a root of `f` in this\r\n * fractional interval.\r\n * * This method searches for a root of `f` if and only if the stroke segment defined by `(a, f(a))` and\r\n * `(b, f(b))` has a root. This is a HEURISTIC: given continuous `f` between `a` and `b`, a root of the stroke\r\n * segment implies a root of `f`, but not vice-versa. Therefore, if the strokes are not sufficiently dense,\r\n * this method can miss a root of `f`.\r\n */\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0)\r\n return; // stroke segment has no root; ASSUME the function has no root either\r\n if (this._functionA === 0)\r\n this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0)\r\n this.announceSolutionFraction(this._fractionB);\r\n // by the Intermediate Value Theorem, a root lies between fractionA and fractionB; use Newton to find it.\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n private announceSolutionFraction(fraction: number) {\r\n if (this._curve)\r\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\r\n }\r\n /**\r\n * Evaluate the univariate real-valued function for which we are finding roots.\r\n * * For finding the closest point to curve X from point Q, this function is `f(t) := Q-X(t) dot X'(t)`.\r\n * * Either `pointAndDerivative` must be defined, or both `fraction` and `curve`.\r\n * @param pointAndDerivative pre-evaluated curve\r\n * @param fraction fraction at which to evaluate `curve`\r\n * @param curve curve to evaluate at `fraction`\r\n */\r\n private evaluateFunction(pointAndDerivative?: Ray3d, fraction?: number, curve?: CurvePrimitive): number | undefined {\r\n if (pointAndDerivative)\r\n this._workRay.setFrom(pointAndDerivative);\r\n else if (fraction !== undefined && curve)\r\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\r\n else\r\n return undefined;\r\n return this._workRay.dotProductToPoint(this._spacePoint);\r\n }\r\n public evaluate(fraction: number): boolean {\r\n let curve = this._curve;\r\n if (this._parentCurvePrimitive)\r\n curve = this._parentCurvePrimitive;\r\n const value = this.evaluateFunction(undefined, fraction, curve);\r\n if (value === undefined)\r\n return false;\r\n this.currentF = value;\r\n return true;\r\n }\r\n private announceRay(fraction: number, data: Ray3d): void {\r\n const value = this.evaluateFunction(data);\r\n assert(value !== undefined, \"expect defined because evaluateFunction never returns undefined for input Ray3d\");\r\n this._functionB = value;\r\n this._fractionB = fraction;\r\n if (this._numThisCurve++ > 0) // after the first stroke point, a stroke segment is defined, so we have an interval\r\n this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\r\n this._workRay.set(point, tangent);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ClosestPointStrokeHandler.js","sourceRoot":"","sources":["../../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;IAC7D,CAAC;IACM,QAAQ,CAAC,QAAgB;QAC9B,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACxB,IAAI,IAAI,CAAC,qBAAqB;YAC5B,KAAK,GAAG,IAAI,CAAC,qBAAqB,CAAC;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAChE,IAAI,KAAK,KAAK,SAAS;YACrB,OAAO,KAAK,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IACO,WAAW,CAAC,QAAgB,EAAE,IAAW;QAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAA,qBAAM,EAAC,KAAK,KAAK,SAAS,EAAE,iFAAiF,CAAC,CAAC;QAC/G,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;QAC3B,IAAI,IAAI,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;AAvKD,8DAuKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { Geometry } from \"../../Geometry\";\r\nimport { IStrokeHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Newton1dUnboundedApproximateDerivative } from \"../../numerics/Newton\";\r\nimport { SmallSystem } from \"../../numerics/SmallSystem\";\r\nimport { CurveExtendMode, CurveExtendOptions, VariantCurveExtendParameter } from \"../CurveExtendMode\";\r\nimport { CurveLocationDetail } from \"../CurveLocationDetail\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\nimport { NewtonRtoRStrokeHandler } from \"./NewtonRtoRStrokeHandler\";\r\n\r\n/**\r\n * Context for searching for the closest point to a CurvePrimitive.\r\n * @internal\r\n */\r\nexport class ClosestPointStrokeHandler extends NewtonRtoRStrokeHandler implements IStrokeHandler {\r\n private _curve: CurvePrimitive | undefined;\r\n private _closestPoint: CurveLocationDetail | undefined;\r\n private _spacePoint: Point3d;\r\n private _extend: VariantCurveExtendParameter;\r\n private _xyOnly: boolean;\r\n // fraction and function value on one side of an interval that may bracket a root\r\n private _fractionA: number = 0;\r\n private _functionA: number = 0;\r\n // fraction and function value on the other side of an interval that may bracket a root\r\n private _fractionB: number = 0;\r\n private _functionB: number = 0;\r\n private _numThisCurve: number = 0;\r\n // scratch vars to use within methods\r\n private _workPoint: Point3d;\r\n private _workRay: Ray3d;\r\n private _newtonSolver: Newton1dUnboundedApproximateDerivative;\r\n /** Constructor */\r\n public constructor(spacePoint: Point3d, extend?: VariantCurveExtendParameter, result?: CurveLocationDetail, xyOnly?: boolean) {\r\n super();\r\n this._spacePoint = spacePoint;\r\n this._workPoint = Point3d.create();\r\n this._workRay = Ray3d.createZero();\r\n this._closestPoint = result;\r\n if (this._closestPoint)\r\n this._closestPoint.a = Geometry.largeCoordinateResult\r\n this._extend = extend ?? false;\r\n this._xyOnly = xyOnly ?? false;\r\n this.startCurvePrimitive(undefined);\r\n this._newtonSolver = new Newton1dUnboundedApproximateDerivative(this);\r\n }\r\n public claimResult(): CurveLocationDetail | undefined {\r\n if (this._closestPoint) {\r\n this._newtonSolver.setX(this._closestPoint.fraction);\r\n this._curve = this._closestPoint.curve;\r\n if (this._newtonSolver.runIterations()) {\r\n let fraction = this._newtonSolver.getX();\r\n fraction = CurveExtendOptions.correctFraction(this._extend, fraction);\r\n this.announceSolutionFraction(fraction);\r\n }\r\n }\r\n return this._closestPoint;\r\n }\r\n public needPrimaryGeometryForStrokes() {\r\n return true;\r\n }\r\n public startCurvePrimitive(curve: CurvePrimitive | undefined) {\r\n this._curve = curve;\r\n this._fractionA = 0.0;\r\n this._numThisCurve = 0;\r\n this._functionA = 0.0;\r\n }\r\n public endCurvePrimitive() {\r\n }\r\n public announceIntervalForUniformStepStrokes(\r\n cp: CurvePrimitive, numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n this.startCurvePrimitive(cp);\r\n this.announceSolutionFraction(0.0); // test start point as closest\r\n this.announceSolutionFraction(1.0); // test end point as closest\r\n if (numStrokes < 1)\r\n numStrokes = 1;\r\n const df = 1.0 / numStrokes;\r\n for (let i = 0; i <= numStrokes; i++) {\r\n const fraction = Geometry.interpolate(fraction0, i * df, fraction1);\r\n cp.fractionToPointAndDerivative(fraction, this._workRay);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n }\r\n private announceCandidate(cp: CurvePrimitive, fraction: number, point: Point3d) {\r\n const distance = this._xyOnly ? this._spacePoint.distanceXY(point) : this._spacePoint.distance(point);\r\n if (this._closestPoint && distance > this._closestPoint.a)\r\n return;\r\n this._closestPoint = CurveLocationDetail.createCurveFractionPoint(cp, fraction, point, this._closestPoint);\r\n this._closestPoint.a = distance;\r\n if (this._parentCurvePrimitive !== undefined)\r\n this._closestPoint.curve = this._parentCurvePrimitive;\r\n }\r\n public announceSegmentInterval(\r\n cp: CurvePrimitive, point0: Point3d, point1: Point3d, _numStrokes: number, fraction0: number, fraction1: number,\r\n ): void {\r\n let localFraction = 0;\r\n if (this._xyOnly)\r\n localFraction = SmallSystem.lineSegment3dXYClosestPointUnbounded(point0, point1, this._spacePoint) ?? 0;\r\n else\r\n localFraction = this._spacePoint.fractionOfProjectionToLine(point0, point1, 0.0);\r\n // only consider segment extension at a parent curve endpoint, i.e. when fraction0 is 0 or fraction1 is 1\r\n const extend0 = (fraction0 === 0) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 0) : CurveExtendMode.None;\r\n const extend1 = (fraction1 === 1) ? CurveExtendOptions.resolveVariantCurveExtendParameterToCurveExtendMode(this._extend, 1) : CurveExtendMode.None;\r\n localFraction = CurveExtendOptions.correctFraction([extend0, extend1], localFraction);\r\n this._workPoint = point0.interpolate(localFraction, point1);\r\n const globalFraction = Geometry.interpolate(fraction0, localFraction, fraction1);\r\n this.announceCandidate(cp, globalFraction, this._workPoint);\r\n }\r\n /**\r\n * Given a function `f` and (unordered) fractions `a` and `b`, search for and announce a root of `f` in this\r\n * fractional interval.\r\n * * This method searches for a root of `f` if and only if the stroke segment defined by `(a, f(a))` and\r\n * `(b, f(b))` has a root. This is a HEURISTIC: given continuous `f` between `a` and `b`, a root of the stroke\r\n * segment implies a root of `f`, but not vice-versa. Therefore, if the strokes are not sufficiently dense,\r\n * this method can miss a root of `f`.\r\n */\r\n private searchInterval() {\r\n if (this._functionA * this._functionB > 0)\r\n return; // stroke segment has no root; ASSUME the function has no root either\r\n if (this._functionA === 0)\r\n this.announceSolutionFraction(this._fractionA);\r\n if (this._functionB === 0)\r\n this.announceSolutionFraction(this._fractionB);\r\n // by the Intermediate Value Theorem, a root lies between fractionA and fractionB; use Newton to find it.\r\n if (this._functionA * this._functionB < 0) {\r\n const fraction = Geometry.inverseInterpolate(this._fractionA, this._functionA, this._fractionB, this._functionB);\r\n if (fraction) {\r\n this._newtonSolver.setX(fraction);\r\n if (this._newtonSolver.runIterations())\r\n this.announceSolutionFraction(this._newtonSolver.getX());\r\n }\r\n }\r\n }\r\n private announceSolutionFraction(fraction: number) {\r\n if (this._curve)\r\n this.announceCandidate(this._curve, fraction, this._curve.fractionToPoint(fraction));\r\n }\r\n /**\r\n * Evaluate the univariate real-valued function for which we are finding roots.\r\n * * For finding the closest point to curve X from point Q, this function is `f(t) := Q-X(t) dot X'(t)`.\r\n * * Either `pointAndDerivative` must be defined, or both `fraction` and `curve`.\r\n * @param pointAndDerivative pre-evaluated curve\r\n * @param fraction fraction at which to evaluate `curve`\r\n * @param curve curve to evaluate at `fraction`\r\n */\r\n private evaluateFunction(pointAndDerivative?: Ray3d, fraction?: number, curve?: CurvePrimitive): number | undefined {\r\n if (pointAndDerivative)\r\n this._workRay.setFrom(pointAndDerivative);\r\n else if (fraction !== undefined && curve)\r\n this._workRay = curve.fractionToPointAndDerivative(fraction, this._workRay);\r\n else\r\n return undefined;\r\n if (this._xyOnly)\r\n return this._workRay.dotProductToPointXY(this._spacePoint);\r\n else\r\n return this._workRay.dotProductToPoint(this._spacePoint);\r\n }\r\n public evaluate(fraction: number): boolean {\r\n let curve = this._curve;\r\n if (this._parentCurvePrimitive)\r\n curve = this._parentCurvePrimitive;\r\n const value = this.evaluateFunction(undefined, fraction, curve);\r\n if (value === undefined)\r\n return false;\r\n this.currentF = value;\r\n return true;\r\n }\r\n private announceRay(fraction: number, data: Ray3d): void {\r\n const value = this.evaluateFunction(data);\r\n assert(value !== undefined, \"expect defined because evaluateFunction never returns undefined for input Ray3d\");\r\n this._functionB = value;\r\n this._fractionB = fraction;\r\n if (this._numThisCurve++ > 0) // after the first stroke point, a stroke segment is defined, so we have an interval\r\n this.searchInterval();\r\n this._functionA = this._functionB;\r\n this._fractionA = this._fractionB;\r\n }\r\n public announcePointTangent(point: Point3d, fraction: number, tangent: Vector3d) {\r\n this._workRay.set(point, tangent);\r\n this.announceRay(fraction, this._workRay);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,26 @@
1
+ /** @packageDocumentation
2
+ * @module Curve
3
+ */
4
+ import { RecurseToCurvesGeometryHandler } from "../../geometry3d/GeometryHandler";
5
+ import { Matrix3d } from "../../geometry3d/Matrix3d";
6
+ import { Point3d } from "../../geometry3d/Point3dVector3d";
7
+ import { Arc3d } from "../Arc3d";
8
+ import { CurvePrimitive } from "../CurvePrimitive";
9
+ type TangencyPointCollector = (spacePoint: Point3d, curve: CurvePrimitive, fraction: number) => any;
10
+ /**
11
+ * Accumulator context for searching for lines tangent to curved geometry.
12
+ * LIMITED IMPLEMENTATION 3/2025
13
+ * * Only Arc3d implements its handler
14
+ * * Arc3d calculation works with the projection of the space point into the plane of the arc.
15
+ * @internal
16
+ */
17
+ export declare class PointToCurveTangentHandler extends RecurseToCurvesGeometryHandler {
18
+ spacePoint: Point3d;
19
+ collector: TangencyPointCollector;
20
+ extendArcs: boolean;
21
+ worldToView: Matrix3d | undefined;
22
+ constructor(spacePoint: Point3d, collector: TangencyPointCollector, extendArcs: boolean | undefined, viewMatrix: Matrix3d | undefined);
23
+ handleArc3d(g: Arc3d): void;
24
+ }
25
+ export {};
26
+ //# sourceMappingURL=PointToCurveTangentHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PointToCurveTangentHandler.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PointToCurveTangentHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAY,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,KAAK,sBAAsB,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,KAAK,GAAG,CAAC;AACpG;;;;;;GAMG;AACH,qBAAa,0BAA2B,SAAQ,8BAA8B;IACrE,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,sBAAsB,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IAEpB,WAAW,EAAE,QAAQ,GAAG,SAAS,CAAC;gBAEvC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,OAAO,YAAQ,EAAE,UAAU,EAAE,QAAQ,GAAG,SAAS;IASvG,WAAW,CAAC,CAAC,EAAE,KAAK;CA0CrC"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Curve
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.PointToCurveTangentHandler = void 0;
11
+ const GeometryHandler_1 = require("../../geometry3d/GeometryHandler");
12
+ const Matrix3d_1 = require("../../geometry3d/Matrix3d");
13
+ const Point3dVector3d_1 = require("../../geometry3d/Point3dVector3d");
14
+ /**
15
+ * Accumulator context for searching for lines tangent to curved geometry.
16
+ * LIMITED IMPLEMENTATION 3/2025
17
+ * * Only Arc3d implements its handler
18
+ * * Arc3d calculation works with the projection of the space point into the plane of the arc.
19
+ * @internal
20
+ */
21
+ class PointToCurveTangentHandler extends GeometryHandler_1.RecurseToCurvesGeometryHandler {
22
+ spacePoint;
23
+ collector;
24
+ extendArcs;
25
+ // if available, do the tangency as viewed in the xy plane AFTER multiplying vectors by this matrix
26
+ worldToView;
27
+ constructor(spacePoint, collector, extendArcs = false, viewMatrix) {
28
+ super();
29
+ this.spacePoint = spacePoint;
30
+ this.collector = collector;
31
+ this.extendArcs = extendArcs;
32
+ this.worldToView = viewMatrix;
33
+ }
34
+ handleArc3d(g) {
35
+ const centerToPoint = Point3dVector3d_1.Vector3d.createStartEnd(g.centerRef, this.spacePoint);
36
+ let localCenterToPoint;
37
+ if (this.worldToView) {
38
+ // Convert the vector spacePoint into the arc's default system in which
39
+ // U vector is column 0
40
+ // V vector is column 1
41
+ // worldToView row 2 is column 2
42
+ const arcToView = Matrix3d_1.Matrix3d.createColumns(g.matrixRef.getColumn(0), g.matrixRef.getColumn(1), this.worldToView.getRow(2));
43
+ localCenterToPoint = arcToView.multiplyInverse(centerToPoint);
44
+ }
45
+ else {
46
+ // Convert the vector spacePoint into the arc's default system in which
47
+ // U vector is column 0
48
+ // V vector is column 1
49
+ // their cross product (or maybe a scale of it) is column 2.
50
+ localCenterToPoint = g.matrixRef.multiplyInverse(centerToPoint);
51
+ }
52
+ if (localCenterToPoint === undefined)
53
+ return;
54
+ // localCenterToPoint is measured in the (de-skewed and descaled!) coordinate system of the
55
+ // arc U and V axes. That is, the arc is now a unit circle.
56
+ // Angle alpha is from the local x axis to localCenterToPoint.
57
+ // Angle beta is from that to the tangency points.
58
+ // The inverse transformation preserves parameter angle in the ellipse sweep.
59
+ if (localCenterToPoint !== undefined) {
60
+ const distanceSquaredXYToPoint = localCenterToPoint.magnitudeSquaredXY();
61
+ if (distanceSquaredXYToPoint <= 1.0) {
62
+ // the point is inside the ellipse
63
+ }
64
+ else {
65
+ const distanceToTangency = Math.sqrt(distanceSquaredXYToPoint - 1.0);
66
+ const alpha = Math.atan2(localCenterToPoint.y, localCenterToPoint.x);
67
+ const beta = Math.atan2(distanceToTangency, 1);
68
+ for (const theta of [alpha + beta, alpha - beta]) {
69
+ const fraction = g.sweep.radiansToPositivePeriodicFraction(theta);
70
+ if (this.extendArcs || fraction <= 1.0)
71
+ this.collector(this.spacePoint, g, fraction);
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ exports.PointToCurveTangentHandler = PointToCurveTangentHandler;
78
+ //# sourceMappingURL=PointToCurveTangentHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PointToCurveTangentHandler.js","sourceRoot":"","sources":["../../../../src/curve/internalContexts/PointToCurveTangentHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sEAAkF;AAClF,wDAAqD;AACrD,sEAAqE;AAKrE;;;;;;GAMG;AACH,MAAa,0BAA2B,SAAQ,gDAA8B;IACrE,UAAU,CAAU;IACpB,SAAS,CAAyB;IAClC,UAAU,CAAU;IAC3B,mGAAmG;IAC5F,WAAW,CAAuB;IACzC,YACE,UAAmB,EAAE,SAAiC,EAAE,aAAsB,KAAK,EAAE,UAAgC;QAErH,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAEe,WAAW,CAAC,CAAQ;QAClC,MAAM,aAAa,GAAG,0BAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5E,IAAI,kBAAwC,CAAC;QAC7C,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,uEAAuE;YACvE,wBAAwB;YACxB,uBAAuB;YACvB,gCAAgC;YAChC,MAAM,SAAS,GAAG,mBAAQ,CAAC,aAAa,CACtC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAC/E,CAAC;YACF,kBAAkB,GAAG,SAAS,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QAChE,CAAC;aAAM,CAAC;YACN,uEAAuE;YACvE,wBAAwB;YACxB,uBAAuB;YACvB,4DAA4D;YAC5D,kBAAkB,GAAG,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QAClE,CAAC;QACD,IAAI,kBAAkB,KAAK,SAAS;YAClC,OAAO;QACT,2FAA2F;QAC3F,2DAA2D;QAC3D,8DAA8D;QAC9D,kDAAkD;QAClD,6EAA6E;QAC7E,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;YACrC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC,kBAAkB,EAAE,CAAC;YACzE,IAAI,wBAAwB,IAAI,GAAG,EAAE,CAAC;gBACpC,kCAAkC;YACpC,CAAC;iBAAM,CAAC;gBACN,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,wBAAwB,GAAG,GAAG,CAAC,CAAA;gBACpE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;gBACrE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;gBAC/C,KAAK,MAAM,KAAK,IAAI,CAAC,KAAK,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC;oBACjD,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,iCAAiC,CAAC,KAAK,CAAC,CAAC;oBAClE,IAAI,IAAI,CAAC,UAAU,IAAI,QAAQ,IAAI,GAAG;wBACpC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;gBACjD,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA1DD,gEA0DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { RecurseToCurvesGeometryHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Matrix3d } from \"../../geometry3d/Matrix3d\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { CurvePrimitive } from \"../CurvePrimitive\";\r\n\r\ntype TangencyPointCollector = (spacePoint: Point3d, curve: CurvePrimitive, fraction: number) => any;\r\n/**\r\n * Accumulator context for searching for lines tangent to curved geometry.\r\n * LIMITED IMPLEMENTATION 3/2025\r\n * * Only Arc3d implements its handler\r\n * * Arc3d calculation works with the projection of the space point into the plane of the arc.\r\n * @internal\r\n */\r\nexport class PointToCurveTangentHandler extends RecurseToCurvesGeometryHandler {\r\n public spacePoint: Point3d;\r\n public collector: TangencyPointCollector;\r\n public extendArcs: boolean;\r\n // if available, do the tangency as viewed in the xy plane AFTER multiplying vectors by this matrix\r\n public worldToView: Matrix3d | undefined;\r\n public constructor(\r\n spacePoint: Point3d, collector: TangencyPointCollector, extendArcs: boolean = false, viewMatrix: Matrix3d | undefined,\r\n ) {\r\n super();\r\n this.spacePoint = spacePoint;\r\n this.collector = collector;\r\n this.extendArcs = extendArcs;\r\n this.worldToView = viewMatrix;\r\n }\r\n\r\n public override handleArc3d(g: Arc3d) {\r\n const centerToPoint = Vector3d.createStartEnd(g.centerRef, this.spacePoint);\r\n let localCenterToPoint: Vector3d | undefined;\r\n if (this.worldToView) {\r\n // Convert the vector spacePoint into the arc's default system in which\r\n // U vector is column 0\r\n // V vector is column 1\r\n // worldToView row 2 is column 2\r\n const arcToView = Matrix3d.createColumns(\r\n g.matrixRef.getColumn(0), g.matrixRef.getColumn(1), this.worldToView.getRow(2),\r\n );\r\n localCenterToPoint = arcToView.multiplyInverse(centerToPoint);\r\n } else {\r\n // Convert the vector spacePoint into the arc's default system in which\r\n // U vector is column 0\r\n // V vector is column 1\r\n // their cross product (or maybe a scale of it) is column 2.\r\n localCenterToPoint = g.matrixRef.multiplyInverse(centerToPoint);\r\n }\r\n if (localCenterToPoint === undefined)\r\n return;\r\n // localCenterToPoint is measured in the (de-skewed and descaled!) coordinate system of the\r\n // arc U and V axes. That is, the arc is now a unit circle.\r\n // Angle alpha is from the local x axis to localCenterToPoint.\r\n // Angle beta is from that to the tangency points.\r\n // The inverse transformation preserves parameter angle in the ellipse sweep.\r\n if (localCenterToPoint !== undefined) {\r\n const distanceSquaredXYToPoint = localCenterToPoint.magnitudeSquaredXY();\r\n if (distanceSquaredXYToPoint <= 1.0) {\r\n // the point is inside the ellipse\r\n } else {\r\n const distanceToTangency = Math.sqrt(distanceSquaredXYToPoint - 1.0)\r\n const alpha = Math.atan2(localCenterToPoint.y, localCenterToPoint.x);\r\n const beta = Math.atan2(distanceToTangency, 1);\r\n for (const theta of [alpha + beta, alpha - beta]) {\r\n const fraction = g.sweep.radiansToPositivePeriodicFraction(theta);\r\n if (this.extendArcs || fraction <= 1.0)\r\n this.collector(this.spacePoint, g, fraction);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -0,0 +1,152 @@
1
+ /** @packageDocumentation
2
+ * @module CartesianGeometry
3
+ */
4
+ import { XAndY } from "../../../geometry3d/XYZProps";
5
+ import { ImplicitCurve2d, ImplicitGeometryMarkup } from "./ImplicitCurve2d";
6
+ import { UnboundedCircle2dByCenterAndRadius } from "./UnboundedCircle2d";
7
+ import { UnboundedLine2dByPointAndNormal } from "./UnboundedLine2d";
8
+ /**
9
+ * Static methods for special case circle and line tangent constructions.
10
+ * @internal
11
+ */
12
+ export declare class ConstrainedImplicitCurve2d {
13
+ /**
14
+ * Return all (i.e., up to 4) circles that are tangent to 3 given lines.
15
+ * @param lineA first line
16
+ * @param lineB second line
17
+ * @param lineC third line
18
+ */
19
+ static circlesTangentLLL(lineA: UnboundedLine2dByPointAndNormal, lineB: UnboundedLine2dByPointAndNormal, lineC: UnboundedLine2dByPointAndNormal): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
20
+ /**
21
+ * Return all (i.e., up to 2) unbounded lines perpendicular to a line and tangent to a circle.
22
+ * @param line the line
23
+ * @param circle the circle
24
+ */
25
+ static linesPerpLTangentC(line: UnboundedLine2dByPointAndNormal, circle: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedLine2dByPointAndNormal>[] | undefined;
26
+ /**
27
+ * Return all (i.e., 4) variants of the line perpendicular to 2 circles (line between centers, with ends at crossing
28
+ * points on respective circles).
29
+ * @param circleA first circle
30
+ * @param circleB second circle
31
+ */
32
+ static linesPerpCPerpC(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedLine2dByPointAndNormal>[] | undefined;
33
+ /**
34
+ * Return all (i.e., up to 2) unbounded lines perpendicular to a line and a circle.
35
+ * @param line the line
36
+ * @param circle the circle
37
+ */
38
+ static linesPerpLPerpC(line: UnboundedLine2dByPointAndNormal, circle: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedLine2dByPointAndNormal>[] | undefined;
39
+ /**
40
+ * Return all (i.e., up to 4) unbounded lines perpendicular to a circle and tangent to a circle.
41
+ * Note that multiple colinear lines are returned tagged with diametrically opposing points of circleA.
42
+ * @param circleA first circle (for perpendicular constraint)
43
+ * @param circleB second circle (for tangent constraint)
44
+ */
45
+ static linesPerpCTangentC(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedLine2dByPointAndNormal>[] | undefined;
46
+ /**
47
+ * Return all (i.e., up to 4) unbounded lines tangent to 2 circles.
48
+ * * There are 4 lines if there is neither intersection nor containment between the circles
49
+ * * There are 2 lines if the circles intersect
50
+ * * THere are no lines if the one circle is entirely inside the other.
51
+ * @param circleA first circle
52
+ * @param circleB second circle
53
+ */
54
+ static linesTangentCC(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedLine2dByPointAndNormal>[] | undefined;
55
+ /**
56
+ * Return all (i.e., up to 8) circles tangent to two lines and a circle.
57
+ * * There are 8 circles if the circle contains the intersection of the lines.
58
+ * * There are 2 circles if the circle is completely contained in one quadrant bounded by the two lines.
59
+ * * There are 2 circles if the circle intersects one ray outward from the intersection.
60
+ * * There are 4 circles if the circle intersects two of the outward rays.
61
+ */
62
+ static circlesTangentLLC(lineA: UnboundedLine2dByPointAndNormal, lineB: UnboundedLine2dByPointAndNormal, circle: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
63
+ /**
64
+ * Return all (i.e., up to 4) circles tangent to 2 circles and a line.
65
+ * @param circleA first circle
66
+ * @param circleB second circle
67
+ * @param line the line
68
+ */
69
+ static circlesTangentCCL(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius, line: UnboundedLine2dByPointAndNormal): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
70
+ /**
71
+ * Special case CCC tangent construction when inputs are colinear.
72
+ * @param circleA first input circle
73
+ * @param circleB second input circle
74
+ * @param circleC third input circle
75
+ * @param rA signed radius for circleA
76
+ * @param rB signed radius for circleB
77
+ * @param rC signed radius for circleC
78
+ * @param result pre-initialized array to which tangent circle markup will be added.
79
+ */
80
+ private static solveColinearCCCTangents;
81
+ /**
82
+ * Return all (i.e., up to 8) circles tangent to 3 circles.
83
+ * @param circles the three input circles
84
+ */
85
+ private static circlesTangentCCCThisOrder;
86
+ /**
87
+ * Return all (i.e., up to 8) circles tangent to 3 circles.
88
+ * @param circleA first circle
89
+ * @param circleB second circle
90
+ * @param circleC third circle
91
+ */
92
+ static circlesTangentCCC(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius, circleC: UnboundedCircle2dByCenterAndRadius): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
93
+ /**
94
+ * Return an unbounded line with the midpoint between pointA and pointB as its reference point
95
+ * and the unit vector from pointA towards pointB as its normal.
96
+ * @param pointA first point
97
+ * @param pointB second point
98
+ * @returns unbounded line, or undefined if pointA and pointB are coincident.
99
+ */
100
+ static bisector(pointA: XAndY, pointB: XAndY): UnboundedLine2dByPointAndNormal | undefined;
101
+ /**
102
+ * Compute circles of specified radius tangent to each of the lines
103
+ * * There are normally 4 circles
104
+ * * The undefined case occurs when the lines are parallel.
105
+ * @param lineA first line
106
+ * @param lineB second line
107
+ * @param radius radius of tangent circles
108
+ * @returns array of circles with annotated tangencies. returns undefined if lines are parallel.
109
+ */
110
+ static circlesTangentLLR(lineA: UnboundedLine2dByPointAndNormal, lineB: UnboundedLine2dByPointAndNormal, radius: number): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
111
+ /**
112
+ * Compute circles of specified radius tangent to both a line and an arc
113
+ * * There can be 0 to 8 circles
114
+ * * The undefined case occurs when the smallest distance from circle to line exceeds radius.
115
+ * @param circleA the circle
116
+ * @param lineB the line
117
+ * @param radius radius of tangent circles
118
+ * @returns array of circles with annotated tangencies
119
+ */
120
+ static circlesTangentCLR(circleA: UnboundedCircle2dByCenterAndRadius, lineB: UnboundedLine2dByPointAndNormal, radius: number): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
121
+ /**
122
+ * Compute circles of specified radius tangent to both circles
123
+ * * There can be 0 to 8 circles
124
+ * * The undefined case is when the smallest distance between the circles exceeds the requested radius.
125
+ * @param circleA the first circle
126
+ * @param circleB the second circle
127
+ * @param radius radius of tangent circles
128
+ * @returns array of circles with annotated tangencies
129
+ */
130
+ static circlesTangentCCR(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius, radius: number): ImplicitGeometryMarkup<UnboundedCircle2dByCenterAndRadius>[] | undefined;
131
+ /**
132
+ * Construct basis vectors for hyperbola or ellipse whose points are equidistant from tangencies with
133
+ * circleA and circleB.
134
+ * * If the curve is a hyperbola, the equation is
135
+ * X = center + vectorU * sec(theta) + vectorV * tan(theta)
136
+ * * If the curve is an ellipse, the equation is
137
+ * X = center + vectorU * cos(theta) + vectorV * sin(theta)
138
+ * @param circleA first circle
139
+ * @param circleB second circle
140
+ */
141
+ static medialCurveCircleCircle(circleA: UnboundedCircle2dByCenterAndRadius, circleB: UnboundedCircle2dByCenterAndRadius): ImplicitCurve2d | undefined;
142
+ /**
143
+ * Construct parabolas whose points are equidistant from tangencies with
144
+ * circleA and circleB.
145
+ * * Note that if th e circle has non-zero radius there are two parabolas based on
146
+ * tangencies on near or far side of the circle.
147
+ * @param line the line
148
+ * @param circle the circle
149
+ */
150
+ static medialCurveLineCircle(line: UnboundedLine2dByPointAndNormal, circle: UnboundedCircle2dByCenterAndRadius): ImplicitCurve2d[] | undefined;
151
+ }
152
+ //# sourceMappingURL=ConstrainedImplicitCurve2d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConstrainedImplicitCurve2d.d.ts","sourceRoot":"","sources":["../../../../../src/curve/internalContexts/geometry2d/ConstrainedImplicitCurve2d.ts"],"names":[],"mappings":"AAIA;;EAEE;AAMF,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAA0B,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AAGzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;AAGpE;;;GAGG;AACH,qBAAa,0BAA0B;IACrC;;;;;OAKG;WACW,iBAAiB,CAC7B,KAAK,EAAE,+BAA+B,EACtC,KAAK,EAAE,+BAA+B,EACtC,KAAK,EAAE,+BAA+B,GACrC,sBAAsB,CAAC,kCAAkC,CAAC,EAAE,GAAG,SAAS;IA6C3E;;;;OAIG;WACW,kBAAkB,CAC9B,IAAI,EAAE,+BAA+B,EAA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