@itwin/core-geometry 5.0.0-dev.2 → 5.0.0-dev.22

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 (278) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  3. package/lib/cjs/bspline/BSplineCurveOps.js +18 -21
  4. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  5. package/lib/cjs/curve/Arc3d.d.ts +30 -7
  6. package/lib/cjs/curve/Arc3d.d.ts.map +1 -1
  7. package/lib/cjs/curve/Arc3d.js +53 -7
  8. package/lib/cjs/curve/Arc3d.js.map +1 -1
  9. package/lib/cjs/curve/CurveCollection.d.ts +16 -2
  10. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  11. package/lib/cjs/curve/CurveCollection.js +33 -2
  12. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  13. package/lib/cjs/curve/CurveFactory.d.ts +81 -53
  14. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  15. package/lib/cjs/curve/CurveFactory.js +190 -103
  16. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  17. package/lib/cjs/curve/LineString3d.d.ts +12 -8
  18. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  19. package/lib/cjs/curve/LineString3d.js +29 -8
  20. package/lib/cjs/curve/LineString3d.js.map +1 -1
  21. package/lib/cjs/curve/Loop.d.ts +12 -6
  22. package/lib/cjs/curve/Loop.d.ts.map +1 -1
  23. package/lib/cjs/curve/Loop.js +12 -6
  24. package/lib/cjs/curve/Loop.js.map +1 -1
  25. package/lib/cjs/curve/Query/CylindricalRange.d.ts +8 -6
  26. package/lib/cjs/curve/Query/CylindricalRange.d.ts.map +1 -1
  27. package/lib/cjs/curve/Query/CylindricalRange.js +13 -9
  28. package/lib/cjs/curve/Query/CylindricalRange.js.map +1 -1
  29. package/lib/cjs/curve/StrokeOptions.d.ts +1 -1
  30. package/lib/cjs/curve/StrokeOptions.d.ts.map +1 -1
  31. package/lib/cjs/curve/StrokeOptions.js.map +1 -1
  32. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  33. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js +24 -18
  34. package/lib/cjs/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  35. package/lib/cjs/geometry3d/AngleSweep.d.ts +1 -1
  36. package/lib/cjs/geometry3d/AngleSweep.d.ts.map +1 -1
  37. package/lib/cjs/geometry3d/AngleSweep.js +1 -1
  38. package/lib/cjs/geometry3d/AngleSweep.js.map +1 -1
  39. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts +14 -8
  40. package/lib/cjs/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  41. package/lib/cjs/geometry3d/BarycentricTriangle.js +17 -8
  42. package/lib/cjs/geometry3d/BarycentricTriangle.js.map +1 -1
  43. package/lib/cjs/geometry3d/FrameBuilder.js +4 -4
  44. package/lib/cjs/geometry3d/FrameBuilder.js.map +1 -1
  45. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts +2 -0
  46. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  47. package/lib/cjs/geometry3d/GrowableFloat64Array.js +4 -0
  48. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  49. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +32 -10
  50. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  51. package/lib/cjs/geometry3d/GrowableXYZArray.js +54 -16
  52. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  53. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +13 -2
  54. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  55. package/lib/cjs/geometry3d/IndexedXYZCollection.js +24 -10
  56. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  57. package/lib/cjs/geometry3d/Matrix3d.d.ts +11 -8
  58. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  59. package/lib/cjs/geometry3d/Matrix3d.js +28 -26
  60. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  61. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +1 -1
  62. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  63. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +6 -6
  64. package/lib/cjs/geometry3d/Point3dVector3d.js +6 -6
  65. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  66. package/lib/cjs/geometry3d/PolygonOps.d.ts +12 -6
  67. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  68. package/lib/cjs/geometry3d/PolygonOps.js +94 -47
  69. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  70. package/lib/cjs/geometry3d/PolylineOps.d.ts +7 -4
  71. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  72. package/lib/cjs/geometry3d/PolylineOps.js +7 -4
  73. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  74. package/lib/cjs/geometry4d/MomentData.d.ts +72 -73
  75. package/lib/cjs/geometry4d/MomentData.d.ts.map +1 -1
  76. package/lib/cjs/geometry4d/MomentData.js +62 -64
  77. package/lib/cjs/geometry4d/MomentData.js.map +1 -1
  78. package/lib/cjs/numerics/Polynomials.d.ts +5 -5
  79. package/lib/cjs/numerics/Polynomials.js +6 -6
  80. package/lib/cjs/numerics/Polynomials.js.map +1 -1
  81. package/lib/cjs/polyface/AuxData.d.ts +2 -2
  82. package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
  83. package/lib/cjs/polyface/AuxData.js +11 -3
  84. package/lib/cjs/polyface/AuxData.js.map +1 -1
  85. package/lib/cjs/polyface/Polyface.d.ts +3 -5
  86. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  87. package/lib/cjs/polyface/Polyface.js +6 -13
  88. package/lib/cjs/polyface/Polyface.js.map +1 -1
  89. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +13 -6
  90. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  91. package/lib/cjs/polyface/PolyfaceBuilder.js +65 -38
  92. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  93. package/lib/cjs/polyface/PolyfaceData.d.ts +13 -3
  94. package/lib/cjs/polyface/PolyfaceData.d.ts.map +1 -1
  95. package/lib/cjs/polyface/PolyfaceData.js +21 -4
  96. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  97. package/lib/cjs/polyface/PolyfaceQuery.d.ts +2 -2
  98. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  99. package/lib/cjs/polyface/PolyfaceQuery.js +4 -3
  100. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  101. package/lib/cjs/serialization/GeometrySamples.d.ts +5 -5
  102. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  103. package/lib/cjs/serialization/GeometrySamples.js +5 -5
  104. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  105. package/lib/cjs/solid/Box.d.ts +9 -3
  106. package/lib/cjs/solid/Box.d.ts.map +1 -1
  107. package/lib/cjs/solid/Box.js +10 -5
  108. package/lib/cjs/solid/Box.js.map +1 -1
  109. package/lib/cjs/solid/Cone.d.ts +3 -2
  110. package/lib/cjs/solid/Cone.d.ts.map +1 -1
  111. package/lib/cjs/solid/Cone.js +3 -3
  112. package/lib/cjs/solid/Cone.js.map +1 -1
  113. package/lib/cjs/solid/LinearSweep.d.ts +9 -3
  114. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  115. package/lib/cjs/solid/LinearSweep.js +9 -4
  116. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  117. package/lib/cjs/solid/RotationalSweep.d.ts +15 -4
  118. package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
  119. package/lib/cjs/solid/RotationalSweep.js +20 -7
  120. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  121. package/lib/cjs/solid/RuledSweep.d.ts +35 -26
  122. package/lib/cjs/solid/RuledSweep.d.ts.map +1 -1
  123. package/lib/cjs/solid/RuledSweep.js +41 -28
  124. package/lib/cjs/solid/RuledSweep.js.map +1 -1
  125. package/lib/cjs/solid/SolidPrimitive.d.ts +12 -11
  126. package/lib/cjs/solid/SolidPrimitive.d.ts.map +1 -1
  127. package/lib/cjs/solid/SolidPrimitive.js +8 -5
  128. package/lib/cjs/solid/SolidPrimitive.js.map +1 -1
  129. package/lib/cjs/solid/Sphere.d.ts +17 -7
  130. package/lib/cjs/solid/Sphere.d.ts.map +1 -1
  131. package/lib/cjs/solid/Sphere.js +22 -16
  132. package/lib/cjs/solid/Sphere.js.map +1 -1
  133. package/lib/cjs/solid/SweepContour.d.ts +1 -1
  134. package/lib/cjs/solid/SweepContour.js +1 -1
  135. package/lib/cjs/solid/SweepContour.js.map +1 -1
  136. package/lib/cjs/solid/TorusPipe.d.ts +8 -2
  137. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  138. package/lib/cjs/solid/TorusPipe.js +9 -5
  139. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  140. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  141. package/lib/esm/bspline/BSplineCurveOps.js +18 -21
  142. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  143. package/lib/esm/curve/Arc3d.d.ts +30 -7
  144. package/lib/esm/curve/Arc3d.d.ts.map +1 -1
  145. package/lib/esm/curve/Arc3d.js +53 -7
  146. package/lib/esm/curve/Arc3d.js.map +1 -1
  147. package/lib/esm/curve/CurveCollection.d.ts +16 -2
  148. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  149. package/lib/esm/curve/CurveCollection.js +33 -2
  150. package/lib/esm/curve/CurveCollection.js.map +1 -1
  151. package/lib/esm/curve/CurveFactory.d.ts +81 -53
  152. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  153. package/lib/esm/curve/CurveFactory.js +190 -103
  154. package/lib/esm/curve/CurveFactory.js.map +1 -1
  155. package/lib/esm/curve/LineString3d.d.ts +12 -8
  156. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  157. package/lib/esm/curve/LineString3d.js +29 -8
  158. package/lib/esm/curve/LineString3d.js.map +1 -1
  159. package/lib/esm/curve/Loop.d.ts +12 -6
  160. package/lib/esm/curve/Loop.d.ts.map +1 -1
  161. package/lib/esm/curve/Loop.js +12 -6
  162. package/lib/esm/curve/Loop.js.map +1 -1
  163. package/lib/esm/curve/Query/CylindricalRange.d.ts +8 -6
  164. package/lib/esm/curve/Query/CylindricalRange.d.ts.map +1 -1
  165. package/lib/esm/curve/Query/CylindricalRange.js +13 -9
  166. package/lib/esm/curve/Query/CylindricalRange.js.map +1 -1
  167. package/lib/esm/curve/StrokeOptions.d.ts +1 -1
  168. package/lib/esm/curve/StrokeOptions.d.ts.map +1 -1
  169. package/lib/esm/curve/StrokeOptions.js.map +1 -1
  170. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.d.ts.map +1 -1
  171. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js +24 -18
  172. package/lib/esm/curve/internalContexts/EllipticalArcApproximationContext.js.map +1 -1
  173. package/lib/esm/geometry3d/AngleSweep.d.ts +1 -1
  174. package/lib/esm/geometry3d/AngleSweep.d.ts.map +1 -1
  175. package/lib/esm/geometry3d/AngleSweep.js +1 -1
  176. package/lib/esm/geometry3d/AngleSweep.js.map +1 -1
  177. package/lib/esm/geometry3d/BarycentricTriangle.d.ts +14 -8
  178. package/lib/esm/geometry3d/BarycentricTriangle.d.ts.map +1 -1
  179. package/lib/esm/geometry3d/BarycentricTriangle.js +17 -8
  180. package/lib/esm/geometry3d/BarycentricTriangle.js.map +1 -1
  181. package/lib/esm/geometry3d/FrameBuilder.js +4 -4
  182. package/lib/esm/geometry3d/FrameBuilder.js.map +1 -1
  183. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts +2 -0
  184. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  185. package/lib/esm/geometry3d/GrowableFloat64Array.js +4 -0
  186. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  187. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +32 -10
  188. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  189. package/lib/esm/geometry3d/GrowableXYZArray.js +54 -16
  190. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  191. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +13 -2
  192. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  193. package/lib/esm/geometry3d/IndexedXYZCollection.js +24 -10
  194. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  195. package/lib/esm/geometry3d/Matrix3d.d.ts +11 -8
  196. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  197. package/lib/esm/geometry3d/Matrix3d.js +28 -26
  198. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  199. package/lib/esm/geometry3d/Point3dArrayCarrier.js +1 -1
  200. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  201. package/lib/esm/geometry3d/Point3dVector3d.d.ts +6 -6
  202. package/lib/esm/geometry3d/Point3dVector3d.js +6 -6
  203. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  204. package/lib/esm/geometry3d/PolygonOps.d.ts +12 -6
  205. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  206. package/lib/esm/geometry3d/PolygonOps.js +94 -47
  207. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  208. package/lib/esm/geometry3d/PolylineOps.d.ts +7 -4
  209. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  210. package/lib/esm/geometry3d/PolylineOps.js +7 -4
  211. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  212. package/lib/esm/geometry4d/MomentData.d.ts +72 -73
  213. package/lib/esm/geometry4d/MomentData.d.ts.map +1 -1
  214. package/lib/esm/geometry4d/MomentData.js +62 -64
  215. package/lib/esm/geometry4d/MomentData.js.map +1 -1
  216. package/lib/esm/numerics/Polynomials.d.ts +5 -5
  217. package/lib/esm/numerics/Polynomials.js +6 -6
  218. package/lib/esm/numerics/Polynomials.js.map +1 -1
  219. package/lib/esm/polyface/AuxData.d.ts +2 -2
  220. package/lib/esm/polyface/AuxData.d.ts.map +1 -1
  221. package/lib/esm/polyface/AuxData.js +11 -3
  222. package/lib/esm/polyface/AuxData.js.map +1 -1
  223. package/lib/esm/polyface/Polyface.d.ts +3 -5
  224. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  225. package/lib/esm/polyface/Polyface.js +6 -13
  226. package/lib/esm/polyface/Polyface.js.map +1 -1
  227. package/lib/esm/polyface/PolyfaceBuilder.d.ts +13 -6
  228. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  229. package/lib/esm/polyface/PolyfaceBuilder.js +65 -38
  230. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  231. package/lib/esm/polyface/PolyfaceData.d.ts +13 -3
  232. package/lib/esm/polyface/PolyfaceData.d.ts.map +1 -1
  233. package/lib/esm/polyface/PolyfaceData.js +21 -4
  234. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  235. package/lib/esm/polyface/PolyfaceQuery.d.ts +2 -2
  236. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  237. package/lib/esm/polyface/PolyfaceQuery.js +4 -3
  238. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  239. package/lib/esm/serialization/GeometrySamples.d.ts +5 -5
  240. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  241. package/lib/esm/serialization/GeometrySamples.js +5 -5
  242. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  243. package/lib/esm/solid/Box.d.ts +9 -3
  244. package/lib/esm/solid/Box.d.ts.map +1 -1
  245. package/lib/esm/solid/Box.js +10 -5
  246. package/lib/esm/solid/Box.js.map +1 -1
  247. package/lib/esm/solid/Cone.d.ts +3 -2
  248. package/lib/esm/solid/Cone.d.ts.map +1 -1
  249. package/lib/esm/solid/Cone.js +3 -3
  250. package/lib/esm/solid/Cone.js.map +1 -1
  251. package/lib/esm/solid/LinearSweep.d.ts +9 -3
  252. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  253. package/lib/esm/solid/LinearSweep.js +9 -4
  254. package/lib/esm/solid/LinearSweep.js.map +1 -1
  255. package/lib/esm/solid/RotationalSweep.d.ts +15 -4
  256. package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
  257. package/lib/esm/solid/RotationalSweep.js +20 -7
  258. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  259. package/lib/esm/solid/RuledSweep.d.ts +35 -26
  260. package/lib/esm/solid/RuledSweep.d.ts.map +1 -1
  261. package/lib/esm/solid/RuledSweep.js +41 -28
  262. package/lib/esm/solid/RuledSweep.js.map +1 -1
  263. package/lib/esm/solid/SolidPrimitive.d.ts +12 -11
  264. package/lib/esm/solid/SolidPrimitive.d.ts.map +1 -1
  265. package/lib/esm/solid/SolidPrimitive.js +8 -5
  266. package/lib/esm/solid/SolidPrimitive.js.map +1 -1
  267. package/lib/esm/solid/Sphere.d.ts +17 -7
  268. package/lib/esm/solid/Sphere.d.ts.map +1 -1
  269. package/lib/esm/solid/Sphere.js +22 -16
  270. package/lib/esm/solid/Sphere.js.map +1 -1
  271. package/lib/esm/solid/SweepContour.d.ts +1 -1
  272. package/lib/esm/solid/SweepContour.js +1 -1
  273. package/lib/esm/solid/SweepContour.js.map +1 -1
  274. package/lib/esm/solid/TorusPipe.d.ts +8 -2
  275. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  276. package/lib/esm/solid/TorusPipe.js +9 -5
  277. package/lib/esm/solid/TorusPipe.js.map +1 -1
  278. package/package.json +4 -4
@@ -21,19 +21,25 @@ export declare class Loop extends CurveChain {
21
21
  isInner: boolean;
22
22
  /** Test if `other` is a `Loop` */
23
23
  isSameGeometryClass(other: GeometryQuery): boolean;
24
- /** Test if `other` is an instance of `Loop` */
25
24
  constructor();
26
25
  /**
27
- * Create a loop from variable length list of CurvePrimitives
28
- * @param curves array of individual curve primitives
26
+ * Create a loop from a variable length list of [[CurvePrimitive]]s.
27
+ * * A significant gap between the end of one curve and the start of the next, or between chain start and end,
28
+ * is not bridged and may cause unexpected behavior.
29
+ * @param curves array of individual curve primitives, assumed to form a closed planar loop.
29
30
  */
30
31
  static create(...curves: CurvePrimitive[]): Loop;
31
32
  /**
32
- * Create a loop from an array of curve primitives
33
- * @param curves array of individual curve primitives
33
+ * Create a loop from an array of [[CurvePrimitive]]s.
34
+ * * A significant gap between the end of one curve and the start of the next, or between chain start and end,
35
+ * is not bridged and may cause unexpected behavior.
36
+ * @param curves array of individual curve primitives, assumed to form a closed planar loop.
34
37
  */
35
38
  static createArray(curves: CurvePrimitive[]): Loop;
36
- /** Create a loop from an array of points */
39
+ /**
40
+ * Create a loop from an array of coplanar points.
41
+ * @param points vertices of polygon, closure point optional.
42
+ */
37
43
  static createPolygon(points: IndexedXYZCollection | Point3d[]): Loop;
38
44
  /** Create a loop with the stroked form of this loop. */
39
45
  cloneStroked(options?: StrokeOptions): Loop;
@@ -1 +1 @@
1
- {"version":3,"file":"Loop.d.ts","sourceRoot":"","sources":["../../../src/curve/Loop.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,OAAO,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,kBA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AAE,CAAC;IAChB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC9B"}
@@ -18,7 +18,6 @@ class Loop extends CurveCollection_1.CurveChain {
18
18
  isSameGeometryClass(other) {
19
19
  return other instanceof Loop;
20
20
  }
21
- /** Test if `other` is an instance of `Loop` */
22
21
  constructor() {
23
22
  super();
24
23
  /** String name for schema properties */
@@ -27,8 +26,10 @@ class Loop extends CurveCollection_1.CurveChain {
27
26
  this.isInner = false;
28
27
  }
29
28
  /**
30
- * Create a loop from variable length list of CurvePrimitives
31
- * @param curves array of individual curve primitives
29
+ * Create a loop from a variable length list of [[CurvePrimitive]]s.
30
+ * * A significant gap between the end of one curve and the start of the next, or between chain start and end,
31
+ * is not bridged and may cause unexpected behavior.
32
+ * @param curves array of individual curve primitives, assumed to form a closed planar loop.
32
33
  */
33
34
  static create(...curves) {
34
35
  const result = new Loop();
@@ -41,13 +42,18 @@ class Loop extends CurveCollection_1.CurveChain {
41
42
  return result;
42
43
  }
43
44
  /**
44
- * Create a loop from an array of curve primitives
45
- * @param curves array of individual curve primitives
45
+ * Create a loop from an array of [[CurvePrimitive]]s.
46
+ * * A significant gap between the end of one curve and the start of the next, or between chain start and end,
47
+ * is not bridged and may cause unexpected behavior.
48
+ * @param curves array of individual curve primitives, assumed to form a closed planar loop.
46
49
  */
47
50
  static createArray(curves) {
48
51
  return this.create(...curves);
49
52
  }
50
- /** Create a loop from an array of points */
53
+ /**
54
+ * Create a loop from an array of coplanar points.
55
+ * @param points vertices of polygon, closure point optional.
56
+ */
51
57
  static createPolygon(points) {
52
58
  const linestring = LineString3d_1.LineString3d.create(points);
53
59
  linestring.addClosurePoint();
@@ -1 +1 @@
1
- {"version":3,"file":"Loop.js","sourceRoot":"","sources":["../../../src/curve/Loop.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,+EAA4E;AAC5E,uDAA+C;AAI/C,iDAA8C;AAG9C;;;;GAIG;AACH,MAAa,IAAK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AA5BD,gDA4BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\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 `Loop` is a curve chain that is the boundary of a closed (planar) loop.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport class Loop extends CurveChain {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"loop\";\r\n /** Tag value that can be set to true for user code to mark inner and outer loops. */\r\n public override isInner: boolean = false;\r\n /** Test if `other` is a `Loop` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof Loop;\r\n }\r\n /** Test if `other` is an instance of `Loop` */\r\n public constructor() {\r\n super();\r\n }\r\n /**\r\n * Create a loop from variable length list of CurvePrimitives\r\n * @param curves array of individual curve primitives\r\n */\r\n public static create(...curves: CurvePrimitive[]): Loop {\r\n const result = new Loop();\r\n for (const curve of curves) {\r\n if (curve instanceof CurveChainWithDistanceIndex)\r\n result.children.push(...curve.path.children);\r\n else\r\n result.children.push(curve);\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create a loop from an array of curve primitives\r\n * @param curves array of individual curve primitives\r\n */\r\n public static createArray(curves: CurvePrimitive[]): Loop {\r\n return this.create(...curves);\r\n }\r\n /** Create a loop from an array of points */\r\n public static createPolygon(points: IndexedXYZCollection | Point3d[]): Loop {\r\n const linestring = LineString3d.create(points);\r\n linestring.addClosurePoint();\r\n return Loop.create(linestring);\r\n }\r\n /** Create a loop with the stroked form of this loop. */\r\n public cloneStroked(options?: StrokeOptions): Loop {\r\n const strokes = LineString3d.create();\r\n for (const curve of this.children)\r\n curve.emitStrokes(strokes, options);\r\n // eliminate near-duplicate points between children\r\n strokes.removeDuplicatePoints();\r\n if (strokes.isPhysicallyClosed) {\r\n strokes.popPoint();\r\n strokes.addClosurePoint();\r\n }\r\n return Loop.create(strokes);\r\n }\r\n /** Return the boundary type (2) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n /**\r\n * All \"Loop\" become \"outer\". TypeScript Loop object is equivalent to a native CurveVector with\r\n * boundaryType = BOUNDARY_TYPE_Outer. In other words, TypeScript has no flavor of Loop that\r\n * carries \"hole\" semantics.\r\n */\r\n return 2;\r\n }\r\n /** Invoke `processor.announceLoop(this, indexInParent)` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceLoop(this, indexInParent);\r\n }\r\n /** Create a new `Loop` with no children */\r\n public cloneEmptyPeer(): Loop {\r\n return new Loop();\r\n }\r\n /** Second step of double dispatch: call `handler.handleLoop(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleLoop(this);\r\n }\r\n}\r\n\r\n/**\r\n * Structure carrying a pair of loops with curve geometry.\r\n * @public\r\n */\r\nexport class LoopCurveLoopCurve {\r\n /** First loop */\r\n public loopA?: Loop;\r\n /** A curve (typically an edge of loopA) */\r\n public curveA?: CurvePrimitive;\r\n /** second loop */\r\n public loopB?: Loop;\r\n /** A curve (typically an edge of loopB) */\r\n public curveB?: CurvePrimitive;\r\n /** Constructor */\r\n public constructor(\r\n loopA: Loop | undefined, curveA: CurvePrimitive | undefined, loopB: Loop | undefined, curveB: CurvePrimitive | undefined,\r\n ) {\r\n this.loopA = loopA;\r\n this.curveA = curveA;\r\n this.loopB = loopB;\r\n this.curveB = curveB;\r\n }\r\n /** Set the loopA and curveA members */\r\n public setA(loop: Loop, curve: CurvePrimitive) {\r\n this.loopA = loop;\r\n this.curveA = curve;\r\n }\r\n /** Set the loopB and curveB members */\r\n public setB(loop: Loop, curve: CurvePrimitive) {\r\n this.loopB = loop;\r\n this.curveB = curve;\r\n }\r\n}\r\n\r\n/**\r\n * Carrier object for loops characterized by area sign\r\n * @public\r\n */\r\nexport interface SignedLoops {\r\n /** Array of loops that have positive area sign (i.e. counterclockwise loops). */\r\n positiveAreaLoops: Loop[];\r\n /** Array of loops that have negative area sign (i.e. clockwise loops). */\r\n negativeAreaLoops: Loop[];\r\n /** Slivers where there are coincident sections of input curves. */\r\n slivers: Loop[];\r\n /** Array indicating edges between loops */\r\n edges?: LoopCurveLoopCurve[];\r\n}\r\n"]}
1
+ {"version":3,"file":"Loop.js","sourceRoot":"","sources":["../../../src/curve/Loop.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAQ/F,+EAA4E;AAC5E,uDAA+C;AAI/C,iDAA8C;AAG9C;;;;GAIG;AACH,MAAa,IAAK,SAAQ,4BAAU;IAKlC,kCAAkC;IAC3B,mBAAmB,CAAC,KAAoB;QAC7C,OAAO,KAAK,YAAY,IAAI,CAAC;IAC/B,CAAC;IACD;QACE,KAAK,EAAE,CAAC;QATV,wCAAwC;QACxB,wBAAmB,GAAG,MAAM,CAAC;QAC7C,qFAAqF;QACrE,YAAO,GAAY,KAAK,CAAC;IAOzC,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,GAAG,MAAwB;QAC9C,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QAC1B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,KAAK,YAAY,yDAA2B;gBAC9C,M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;IACpC,cAAc;QACnB,OAAO,IAAI,IAAI,EAAE,CAAC;IACpB,CAAC;IACD,uEAAuE;IAChE,yBAAyB,CAAC,OAAwB;QACvD,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AAhFD,oBAgFC;AAED;;;GAGG;AACH,MAAa,kBAAkB;IAS7B,kBAAkB;IAClB,YACE,KAAuB,EAAE,MAAkC,EAAE,KAAuB,EAAE,MAAkC;QAExH,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IACD,uCAAuC;IAChC,IAAI,CAAC,IAAU,EAAE,KAAqB;QAC3C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IACD,uCAAuC;IAChC,IAAI,CAAC,IAAU,EAAE,KAAqB;QAC3C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;CACF;AA5BD,gDA4BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\nimport { GeometryHandler } from \"../geometry3d/GeometryHandler\";\r\nimport { IndexedXYZCollection } from \"../geometry3d/IndexedXYZCollection\";\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 `Loop` is a curve chain that is the boundary of a closed (planar) loop.\r\n * @see [Curve Collections]($docs/learning/geometry/CurveCollection.md) learning article.\r\n * @public\r\n */\r\nexport class Loop extends CurveChain {\r\n /** String name for schema properties */\r\n public readonly curveCollectionType = \"loop\";\r\n /** Tag value that can be set to true for user code to mark inner and outer loops. */\r\n public override isInner: boolean = false;\r\n /** Test if `other` is a `Loop` */\r\n public isSameGeometryClass(other: GeometryQuery): boolean {\r\n return other instanceof Loop;\r\n }\r\n public constructor() {\r\n super();\r\n }\r\n /**\r\n * Create a loop from a variable length list of [[CurvePrimitive]]s.\r\n * * A significant gap between the end of one curve and the start of the next, or between chain start and end,\r\n * is not bridged and may cause unexpected behavior.\r\n * @param curves array of individual curve primitives, assumed to form a closed planar loop.\r\n */\r\n public static create(...curves: CurvePrimitive[]): Loop {\r\n const result = new Loop();\r\n for (const curve of curves) {\r\n if (curve instanceof CurveChainWithDistanceIndex)\r\n result.children.push(...curve.path.children);\r\n else\r\n result.children.push(curve);\r\n }\r\n return result;\r\n }\r\n /**\r\n * Create a loop from an array of [[CurvePrimitive]]s.\r\n * * A significant gap between the end of one curve and the start of the next, or between chain start and end,\r\n * is not bridged and may cause unexpected behavior.\r\n * @param curves array of individual curve primitives, assumed to form a closed planar loop.\r\n */\r\n public static createArray(curves: CurvePrimitive[]): Loop {\r\n return this.create(...curves);\r\n }\r\n /**\r\n * Create a loop from an array of coplanar points.\r\n * @param points vertices of polygon, closure point optional.\r\n */\r\n public static createPolygon(points: IndexedXYZCollection | Point3d[]): Loop {\r\n const linestring = LineString3d.create(points);\r\n linestring.addClosurePoint();\r\n return Loop.create(linestring);\r\n }\r\n /** Create a loop with the stroked form of this loop. */\r\n public cloneStroked(options?: StrokeOptions): Loop {\r\n const strokes = LineString3d.create();\r\n for (const curve of this.children)\r\n curve.emitStrokes(strokes, options);\r\n // eliminate near-duplicate points between children\r\n strokes.removeDuplicatePoints();\r\n if (strokes.isPhysicallyClosed) {\r\n strokes.popPoint();\r\n strokes.addClosurePoint();\r\n }\r\n return Loop.create(strokes);\r\n }\r\n /** Return the boundary type (2) of a corresponding MicroStation CurveVector */\r\n public dgnBoundaryType(): number {\r\n /**\r\n * All \"Loop\" become \"outer\". TypeScript Loop object is equivalent to a native CurveVector with\r\n * boundaryType = BOUNDARY_TYPE_Outer. In other words, TypeScript has no flavor of Loop that\r\n * carries \"hole\" semantics.\r\n */\r\n return 2;\r\n }\r\n /** Invoke `processor.announceLoop(this, indexInParent)` */\r\n public announceToCurveProcessor(processor: RecursiveCurveProcessor, indexInParent: number = -1): void {\r\n return processor.announceLoop(this, indexInParent);\r\n }\r\n /** Create a new `Loop` with no children */\r\n public cloneEmptyPeer(): Loop {\r\n return new Loop();\r\n }\r\n /** Second step of double dispatch: call `handler.handleLoop(this)` */\r\n public dispatchToGeometryHandler(handler: GeometryHandler): any {\r\n return handler.handleLoop(this);\r\n }\r\n}\r\n\r\n/**\r\n * Structure carrying a pair of loops with curve geometry.\r\n * @public\r\n */\r\nexport class LoopCurveLoopCurve {\r\n /** First loop */\r\n public loopA?: Loop;\r\n /** A curve (typically an edge of loopA) */\r\n public curveA?: CurvePrimitive;\r\n /** second loop */\r\n public loopB?: Loop;\r\n /** A curve (typically an edge of loopB) */\r\n public curveB?: CurvePrimitive;\r\n /** Constructor */\r\n public constructor(\r\n loopA: Loop | undefined, curveA: CurvePrimitive | undefined, loopB: Loop | undefined, curveB: CurvePrimitive | undefined,\r\n ) {\r\n this.loopA = loopA;\r\n this.curveA = curveA;\r\n this.loopB = loopB;\r\n this.curveB = curveB;\r\n }\r\n /** Set the loopA and curveA members */\r\n public setA(loop: Loop, curve: CurvePrimitive) {\r\n this.loopA = loop;\r\n this.curveA = curve;\r\n }\r\n /** Set the loopB and curveB members */\r\n public setB(loop: Loop, curve: CurvePrimitive) {\r\n this.loopB = loop;\r\n this.curveB = curve;\r\n }\r\n}\r\n\r\n/**\r\n * Carrier object for loops characterized by area sign\r\n * @public\r\n */\r\nexport interface SignedLoops {\r\n /** Array of loops that have positive area sign (i.e. counterclockwise loops). */\r\n positiveAreaLoops: Loop[];\r\n /** Array of loops that have negative area sign (i.e. clockwise loops). */\r\n negativeAreaLoops: Loop[];\r\n /** Slivers where there are coincident sections of input curves. */\r\n slivers: Loop[];\r\n /** Array indicating edges between loops */\r\n edges?: LoopCurveLoopCurve[];\r\n}\r\n"]}
@@ -32,14 +32,16 @@ export declare class CylindricalRangeQuery extends RecurseToCurvesGeometryHandle
32
32
  */
33
33
  static computeMaxVectorFromRay(ray: Ray3d, geometry: GeometryQuery): Vector3d;
34
34
  /**
35
- * Recurse through geometry.children to find linestrings.
36
- * In each linestring, compute the surface normal annotation from
35
+ * Recurse through `geometry.children` to find linestrings.
36
+ * For each linestring, compute and store the normal of the rotational surface resulting from sweeping the
37
+ * geometry around `axis` through a positive angle, using:
37
38
  * * the curve tangent stored in the linestring
38
39
  * * the axis of rotation
39
- * * a default V vector to be used when the linestring point is close to the axis.
40
- * @param geometry
41
- * @param axis
42
- * @param defaultVectorV
40
+ * * a default V vector to be used when the linestring point is close to the axis
41
+ * @param geometry profile curve (e.g., linestring, parity region). The orientation of the curve should be such that
42
+ * the computed normal lies in the same half-space as the rotational sweep direction.
43
+ * @param axis rotational axis
44
+ * @param defaultVectorFromAxis default vector perpendicular to `axis` (e.g., sweepVector)
43
45
  */
44
46
  static buildRotationalNormalsInLineStrings(geometry: AnyCurve, axis: Ray3d, defaultVectorFromAxis: Vector3d): void;
45
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CylindricalRange.d.ts","sourceRoot":"","sources":["../../../../src/curve/Query/CylindricalRange.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAW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AM,UAAU,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,8BAA8B;IAEvE,OAAO,CAAC,WAAW,CAAW;IAC9B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAY;IACjC,kDAAkD;IAClD,OAAO;IAMP,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,aAAa;IAWL,mBAAmB,CAAC,QAAQ,EAAE,aAAa;IAI3C,kBAAkB,CAAC,GAAG,EAAE,YAAY;IAOpC,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,GAAG;IAc7C;;;;OAIG;WACW,uBAAuB,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,GAAG,QAAQ;IAMpF;;;;;;;;;;;OAWG;WACW,mCAAmC,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,qBAAqB,EAAE,QAAQ,GAAG,IAAI;CAgC1H"}
@@ -70,14 +70,16 @@ class CylindricalRangeQuery extends GeometryHandler_1.RecurseToCurvesGeometryHan
70
70
  return accumulator._perpVector.clone();
71
71
  }
72
72
  /**
73
- * Recurse through geometry.children to find linestrings.
74
- * In each linestring, compute the surface normal annotation from
73
+ * Recurse through `geometry.children` to find linestrings.
74
+ * For each linestring, compute and store the normal of the rotational surface resulting from sweeping the
75
+ * geometry around `axis` through a positive angle, using:
75
76
  * * the curve tangent stored in the linestring
76
77
  * * the axis of rotation
77
- * * a default V vector to be used when the linestring point is close to the axis.
78
- * @param geometry
79
- * @param axis
80
- * @param defaultVectorV
78
+ * * a default V vector to be used when the linestring point is close to the axis
79
+ * @param geometry profile curve (e.g., linestring, parity region). The orientation of the curve should be such that
80
+ * the computed normal lies in the same half-space as the rotational sweep direction.
81
+ * @param axis rotational axis
82
+ * @param defaultVectorFromAxis default vector perpendicular to `axis` (e.g., sweepVector)
81
83
  */
82
84
  static buildRotationalNormalsInLineStrings(geometry, axis, defaultVectorFromAxis) {
83
85
  if (geometry instanceof LineString3d_1.LineString3d) {
@@ -86,18 +88,20 @@ class CylindricalRangeQuery extends GeometryHandler_1.RecurseToCurvesGeometryHan
86
88
  const normals = geometry.ensureEmptySurfaceNormals();
87
89
  if (derivatives && normals) {
88
90
  const vectorU = Point3dVector3d_1.Vector3d.create();
89
- const vectorV = Point3dVector3d_1.Vector3d.create(); // v direction (forwward along sweep) for surface of rotation.
91
+ const vectorV = Point3dVector3d_1.Vector3d.create();
90
92
  const xyz = Point3dVector3d_1.Point3d.create();
91
93
  const n = points.length;
92
94
  for (let i = 0; i < n; i++) {
93
95
  points.getPoint3dAtUncheckedPointIndex(i, xyz);
94
96
  axis.perpendicularPartOfVectorToTarget(xyz, vectorU);
97
+ // compute the positive sweep direction. ASSUME: the rotational sweep angle is positive!
95
98
  if (vectorU.isAlmostZero)
96
99
  axis.direction.crossProduct(defaultVectorFromAxis, vectorV);
97
100
  else
98
101
  axis.direction.crossProduct(vectorU, vectorV);
99
- geometry.packedDerivatives.getVector3dAtCheckedVectorIndex(i, vectorU); // reuse vector U as curve derivative
100
- vectorU.crossProduct(vectorV, vectorV); // reuse vector V as normal!
102
+ // ASSUME: orientation-based profile normal is in the same half-space as vectorV
103
+ geometry.packedDerivatives.getVector3dAtCheckedVectorIndex(i, vectorU); // reuse vectorU
104
+ vectorU.crossProduct(vectorV, vectorV); // reuse vectorV
101
105
  vectorV.normalizeInPlace();
102
106
  normals.push(vectorV);
103
107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CylindricalRange.js","sourceRoot":"","sources":["../../../../src/curve/Query/CylindricalRange.ts"],"names":[],"mapp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7B,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;YACnC,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;gBAC7B,IAAI,CAAC,mCAAmC,CAAC,KAAiB,EAAE,IAAI,EAAE,qBAAqB,CAAC,CAAC;YAC3F,CAAC;QACH,CAAC;IACH,CAAC;CACF;AArGD,sDAqGC","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 { RecurseToCurvesGeometryHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { AnyCurve } from \"../CurveTypes\";\r\nimport { GeometryQuery } from \"../GeometryQuery\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\n\r\n/**\r\n * Context for computing geometry range around an axis.\r\n * * The publicly called method is `computeZRRange (ray, geometry)\r\n */\r\nexport class CylindricalRangeQuery extends RecurseToCurvesGeometryHandler {\r\n // private geometry0: GeometryQuery; <-- Never used\r\n private _perpVector: Vector3d;\r\n private _maxDistance: number;\r\n private _localToWorld: Transform;\r\n /** capture ray and initialize evolving ranges. */\r\n private constructor(ray: Ray3d) {\r\n super();\r\n this._perpVector = Vector3d.createZero();\r\n this._maxDistance = 0.0;\r\n this._localToWorld = ray.toRigidZFrame();\r\n }\r\n private _localPoint = Point3d.create();\r\n private _worldPoint = Point3d.create();\r\n private announcePoint(xyz: Point3d) {\r\n this._localToWorld.multiplyInversePoint3d(xyz, this._localPoint);\r\n const distance = this._localPoint.magnitudeXY();\r\n if (distance >= this._maxDistance) {\r\n this._maxDistance = distance;\r\n this._perpVector.setFromPoint3d(this._localPoint);\r\n this._perpVector.z = 0.0;\r\n this._localToWorld.matrix.multiplyXY(this._localPoint.x, this._localPoint.y, this._perpVector);\r\n }\r\n }\r\n\r\n public override handleLineSegment3d(segment0: LineSegment3d) {\r\n this.announcePoint(segment0.startPoint(this._worldPoint));\r\n this.announcePoint(segment0.endPoint(this._worldPoint));\r\n }\r\n public override handleLineString3d(ls0: LineString3d) {\r\n for (let i = 0; i < ls0.numPoints(); i++) {\r\n ls0.pointAt(i, this._worldPoint);\r\n this.announcePoint(this._worldPoint);\r\n }\r\n }\r\n\r\n public override handleArc3d(arc0: Arc3d): any {\r\n // humbug .. just stroke it ..\r\n // exact solution is:\r\n // project the arc to the z=0 plane of the local system.\r\n // find max distance to origin.\r\n const numStroke = StrokeOptions.applyAngleTol(undefined, 3, arc0.sweep.sweepRadians, 0.1);\r\n const df = 1.0 / numStroke;\r\n for (let i = 0; i <= numStroke; i++) {\r\n arc0.fractionToPoint(i * df, this._worldPoint);\r\n this.announcePoint(this._worldPoint);\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Compute the largest vector perpendicular to a ray and ending on the geometry.\r\n * @param geometry0 geometry to search\r\n * @returns vector from ray to geometry.\r\n */\r\n public static computeMaxVectorFromRay(ray: Ray3d, geometry: GeometryQuery): Vector3d {\r\n const accumulator = new CylindricalRangeQuery(ray);\r\n geometry.dispatchToGeometryHandler(accumulator);\r\n return accumulator._perpVector.clone();\r\n }\r\n\r\n /**\r\n * Recurse through geometry.children to find linestrings.\r\n * In each linestring, compute the surface normal annotation from\r\n * * the curve tangent stored in the linestring\r\n * * the axis of rotation\r\n * * a default V vector to be used when the linestring point is close to the axis.\r\n * @param geometry\r\n * @param axis\r\n * @param defaultVectorV\r\n */\r\n public static buildRotationalNormalsInLineStrings(geometry: AnyCurve, axis: Ray3d, defaultVectorFromAxis: Vector3d) {\r\n if (geometry instanceof LineString3d) {\r\n const points = geometry.packedPoints;\r\n const derivatives = geometry.packedDerivatives;\r\n const normals = geometry.ensureEmptySurfaceNormals();\r\n if (derivatives && normals) {\r\n const vectorU = Vector3d.create();\r\n const vectorV = Vector3d.create(); // v direction (forwward along sweep) for surface of rotation.\r\n const xyz = Point3d.create();\r\n const n = points.length;\r\n for (let i = 0; i < n; i++) {\r\n points.getPoint3dAtUncheckedPointIndex(i, xyz);\r\n axis.perpendicularPartOfVectorToTarget(xyz, vectorU);\r\n if (vectorU.isAlmostZero)\r\n axis.direction.crossProduct(defaultVectorFromAxis, vectorV);\r\n else\r\n axis.direction.crossProduct(vectorU, vectorV);\r\n geometry.packedDerivatives.getVector3dAtCheckedVectorIndex(i, vectorU); // reuse vector U as curve derivative\r\n vectorU.crossProduct(vectorV, vectorV); // reuse vector V as normal!\r\n vectorV.normalizeInPlace();\r\n normals.push(vectorV);\r\n }\r\n }\r\n } else if (geometry.children) {\r\n const children = geometry.children;\r\n for (const child of children) {\r\n this.buildRotationalNormalsInLineStrings(child as AnyCurve, axis, defaultVectorFromAxis);\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"CylindricalRange.js","sourceRoot":"","sources":["../../../../src/curve/Query/CylindricalRange.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sEAAkF;AAClF,sEAAqE;AAOrE,kDAA+C;AAC/C,oDAAiD;AAEjD;;;GAGG;AACH,MAAa,qBAAsB,SAAQ,gDAA8B;IAKvE,kDAAkD;IAClD,YAAoB,GAAU;QAC5B,KAAK,EAAE,CAAC;QAKF,gBAAW,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;QAC/B,gBAAW,GAAG,yBAAO,CAAC,MAAM,EAAE,CAAC;QALrC,IAAI,CAAC,WAAW,GAAG,0BAAQ,CAAC,UAAU,EAAE,CAAC;QACzC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC;QACxB,IAA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AC7B,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;gBACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC3B,MAAM,CAAC,+BAA+B,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;oBAC/C,IAAI,CAAC,iCAAiC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;oBACrD,wFAAwF;oBACxF,IAAI,OAAO,CAAC,YAAY;wBACtB,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;;wBAE5D,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;oBAChD,gFAAgF;oBAChF,QAAQ,CAAC,iBAAiB,CAAC,+BAA+B,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,gBAAgB;oBACxF,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAE,gBAAgB;oBACzD,OAAO,CAAC,gBAAgB,EAAE,CAAC;oBAC3B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;QACH,CAAC;aAAM,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;YACnC,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;gBAC7B,IAAI,CAAC,mCAAmC,CAAC,KAAiB,EAAE,IAAI,EAAE,qBAAqB,CAAC,CAAC;YAC3F,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAzGD,sDAyGC","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 { RecurseToCurvesGeometryHandler } from \"../../geometry3d/GeometryHandler\";\r\nimport { Point3d, Vector3d } from \"../../geometry3d/Point3dVector3d\";\r\nimport { Ray3d } from \"../../geometry3d/Ray3d\";\r\nimport { Transform } from \"../../geometry3d/Transform\";\r\nimport { Arc3d } from \"../Arc3d\";\r\nimport { AnyCurve } from \"../CurveTypes\";\r\nimport { GeometryQuery } from \"../GeometryQuery\";\r\nimport { LineSegment3d } from \"../LineSegment3d\";\r\nimport { LineString3d } from \"../LineString3d\";\r\nimport { StrokeOptions } from \"../StrokeOptions\";\r\n\r\n/**\r\n * Context for computing geometry range around an axis.\r\n * * The publicly called method is `computeZRRange (ray, geometry)\r\n */\r\nexport class CylindricalRangeQuery extends RecurseToCurvesGeometryHandler {\r\n // private geometry0: GeometryQuery; <-- Never used\r\n private _perpVector: Vector3d;\r\n private _maxDistance: number;\r\n private _localToWorld: Transform;\r\n /** capture ray and initialize evolving ranges. */\r\n private constructor(ray: Ray3d) {\r\n super();\r\n this._perpVector = Vector3d.createZero();\r\n this._maxDistance = 0.0;\r\n this._localToWorld = ray.toRigidZFrame();\r\n }\r\n private _localPoint = Point3d.create();\r\n private _worldPoint = Point3d.create();\r\n private announcePoint(xyz: Point3d) {\r\n this._localToWorld.multiplyInversePoint3d(xyz, this._localPoint);\r\n const distance = this._localPoint.magnitudeXY();\r\n if (distance >= this._maxDistance) {\r\n this._maxDistance = distance;\r\n this._perpVector.setFromPoint3d(this._localPoint);\r\n this._perpVector.z = 0.0;\r\n this._localToWorld.matrix.multiplyXY(this._localPoint.x, this._localPoint.y, this._perpVector);\r\n }\r\n }\r\n\r\n public override handleLineSegment3d(segment0: LineSegment3d) {\r\n this.announcePoint(segment0.startPoint(this._worldPoint));\r\n this.announcePoint(segment0.endPoint(this._worldPoint));\r\n }\r\n public override handleLineString3d(ls0: LineString3d) {\r\n for (let i = 0; i < ls0.numPoints(); i++) {\r\n ls0.pointAt(i, this._worldPoint);\r\n this.announcePoint(this._worldPoint);\r\n }\r\n }\r\n\r\n public override handleArc3d(arc0: Arc3d): any {\r\n // humbug .. just stroke it ..\r\n // exact solution is:\r\n // project the arc to the z=0 plane of the local system.\r\n // find max distance to origin.\r\n const numStroke = StrokeOptions.applyAngleTol(undefined, 3, arc0.sweep.sweepRadians, 0.1);\r\n const df = 1.0 / numStroke;\r\n for (let i = 0; i <= numStroke; i++) {\r\n arc0.fractionToPoint(i * df, this._worldPoint);\r\n this.announcePoint(this._worldPoint);\r\n }\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Compute the largest vector perpendicular to a ray and ending on the geometry.\r\n * @param geometry0 geometry to search\r\n * @returns vector from ray to geometry.\r\n */\r\n public static computeMaxVectorFromRay(ray: Ray3d, geometry: GeometryQuery): Vector3d {\r\n const accumulator = new CylindricalRangeQuery(ray);\r\n geometry.dispatchToGeometryHandler(accumulator);\r\n return accumulator._perpVector.clone();\r\n }\r\n\r\n /**\r\n * Recurse through `geometry.children` to find linestrings.\r\n * For each linestring, compute and store the normal of the rotational surface resulting from sweeping the\r\n * geometry around `axis` through a positive angle, using:\r\n * * the curve tangent stored in the linestring\r\n * * the axis of rotation\r\n * * a default V vector to be used when the linestring point is close to the axis\r\n * @param geometry profile curve (e.g., linestring, parity region). The orientation of the curve should be such that\r\n * the computed normal lies in the same half-space as the rotational sweep direction.\r\n * @param axis rotational axis\r\n * @param defaultVectorFromAxis default vector perpendicular to `axis` (e.g., sweepVector)\r\n */\r\n public static buildRotationalNormalsInLineStrings(geometry: AnyCurve, axis: Ray3d, defaultVectorFromAxis: Vector3d): void {\r\n if (geometry instanceof LineString3d) {\r\n const points = geometry.packedPoints;\r\n const derivatives = geometry.packedDerivatives;\r\n const normals = geometry.ensureEmptySurfaceNormals();\r\n if (derivatives && normals) {\r\n const vectorU = Vector3d.create();\r\n const vectorV = Vector3d.create();\r\n const xyz = Point3d.create();\r\n const n = points.length;\r\n for (let i = 0; i < n; i++) {\r\n points.getPoint3dAtUncheckedPointIndex(i, xyz);\r\n axis.perpendicularPartOfVectorToTarget(xyz, vectorU);\r\n // compute the positive sweep direction. ASSUME: the rotational sweep angle is positive!\r\n if (vectorU.isAlmostZero)\r\n axis.direction.crossProduct(defaultVectorFromAxis, vectorV);\r\n else\r\n axis.direction.crossProduct(vectorU, vectorV);\r\n // ASSUME: orientation-based profile normal is in the same half-space as vectorV\r\n geometry.packedDerivatives.getVector3dAtCheckedVectorIndex(i, vectorU); // reuse vectorU\r\n vectorU.crossProduct(vectorV, vectorV); // reuse vectorV\r\n vectorV.normalizeInPlace();\r\n normals.push(vectorV);\r\n }\r\n }\r\n } else if (geometry.children) {\r\n const children = geometry.children;\r\n for (const child of children) {\r\n this.buildRotationalNormalsInLineStrings(child as AnyCurve, axis, defaultVectorFromAxis);\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -23,7 +23,7 @@ import { Angle } from "../geometry3d/Angle";
23
23
  export declare class StrokeOptions {
24
24
  /** Distance from stroke to actual geometry */
25
25
  chordTol?: number;
26
- /** Turning angle between strokes. */
26
+ /** Turning angle between strokes. Larger value leads to fewer strokes. */
27
27
  angleTol?: Angle;
28
28
  /** Maximum length of a single stroke. */
29
29
  maxEdgeLength?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"StrokeOptions.d.ts","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,aAAa;IACxB,8CAA8C;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IACzB,qCAAqC;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC;IACxB,yCAAyC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACI,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAClC,qCAAqC;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACvC,qDAAqD;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IG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAlMD,sCAkMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\n\r\n/**\r\n * Tolerance blob for various stroking methods.\r\n *\r\n * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength\r\n * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.\r\n * * angle is the angle between two contiguous strokes or across a facet edge.\r\n * * maxEdgeLength is the length of a stroke or a edge of a facet.\r\n * * It is rare for all three to be active at once.\r\n * * Nearly all stroke and facet use cases will apply an angle tolerance.\r\n * * For curves, 15 degrees is typical\r\n * * For facets, 22.5 degrees is typical.\r\n * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.\r\n * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.\r\n * * When creating output for devices such as 3D printing will want a chord tolerance.\r\n * * For graphics display, use an angle tolerance of around 15 degrees and an chord tolerance which is the size of several pixels.\r\n * * Analysis meshes (e.g. Finite Elements) commonly need to apply maxEdgeLength.\r\n * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.\r\n * * Facet tolerances are, as the Pirates' Code, guidelines, not absolute rules. Facet and stroke code may ignore tolerances in awkward situations.\r\n * * If multiple tolerances are in effect, the actual count will usually be based on the one that demands the most strokes or facets, unless it is so high that it violates some upper limit on the number of facets on an arc or a section of a curve.\r\n * @public\r\n */\r\nexport class StrokeOptions {\r\n /** Distance from stroke to actual geometry */\r\n public chordTol?: number;\r\n /** Turning angle between strokes. */\r\n public angleTol?: Angle;\r\n /** Maximum length of a single stroke. */\r\n public maxEdgeLength?: number;\r\n /**\r\n * Caller expects convex facets.\r\n * @deprecated in 4.x - never used. See [[shouldTriangulate]] and [[maximizeConvexFacets]].\r\n */\r\n public needConvexFacets?: boolean;\r\n /** Minimum strokes on a primitive */\r\n public minStrokesPerPrimitive?: number;\r\n /** Whether or not to triangulate each added facet */\r\n public shouldTriangulate: boolean = false;\r\n private _needNormals?: boolean;\r\n private _needTwoSided?: boolean;\r\n private _needParams?: boolean;\r\n /** Whether params are requested. */\r\n public get needParams(): boolean {\r\n return this._needParams !== undefined ? this._needParams : false;\r\n }\r\n public set needParams(value: boolean) {\r\n this._needParams = value;\r\n }\r\n /** Whether normals are requested */\r\n public get needNormals(): boolean {\r\n return this._needNormals !== undefined ? this._needNormals : false;\r\n }\r\n public set needNormals(value: boolean) {\r\n this._needNormals = value;\r\n }\r\n /** Whether twoSided is requested. */\r\n public get needTwoSided(): boolean {\r\n return this._needTwoSided !== undefined ? this._needTwoSided : false;\r\n }\r\n public set needTwoSided(value: boolean) {\r\n this._needTwoSided = value;\r\n }\r\n /** Optional color request flag */\r\n public needColors?: boolean;\r\n /** Default number of strokes for a circle. */\r\n public defaultCircleStrokes = 16;\r\n /** Ask if angleTol is specified */\r\n public get hasAngleTol(): boolean {\r\n return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0;\r\n }\r\n /** Ask if chordTol is specified */\r\n public get hasChordTol(): boolean {\r\n return this.chordTol !== undefined && this.chordTol > 0.0;\r\n }\r\n /** Ask if maxEdgeLength is specified */\r\n public get hasMaxEdgeLength(): boolean {\r\n return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0;\r\n }\r\n private _maximizeConvexFacets?: boolean;\r\n /**\r\n * Whether to post-process a planar triangulation by removing edges to maximize the size of convex facets.\r\n * * Setting this to true also sets [[shouldTriangulate]] to true.\r\n */\r\n public get maximizeConvexFacets(): boolean {\r\n return this._maximizeConvexFacets ?? false;\r\n }\r\n public set maximizeConvexFacets(value: boolean) {\r\n this._maximizeConvexFacets = value;\r\n if (value)\r\n this.shouldTriangulate = value;\r\n }\r\n /** Return a deep clone */\r\n public clone(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.chordTol = this.chordTol;\r\n options.angleTol = this.angleTol?.clone();\r\n options.maxEdgeLength = this.maxEdgeLength;\r\n options.minStrokesPerPrimitive = this.minStrokesPerPrimitive;\r\n options.shouldTriangulate = this.shouldTriangulate;\r\n options._needNormals = this._needNormals;\r\n options._needTwoSided = this._needTwoSided;\r\n options._needParams = this._needParams;\r\n options.needColors = this.needColors;\r\n options.defaultCircleStrokes = this.defaultCircleStrokes;\r\n options._maximizeConvexFacets = this._maximizeConvexFacets;\r\n return options;\r\n }\r\n /** Return stroke count which is the larger of the minCount or count needed for edge length condition. */\r\n public applyMaxEdgeLength(minCount: number, totalLength: number): number {\r\n totalLength = Math.abs(totalLength);\r\n if (this.maxEdgeLength && this.maxEdgeLength > 0.0 && minCount * this.maxEdgeLength < totalLength) {\r\n minCount = Geometry.stepCount(this.maxEdgeLength, totalLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of the existing count or count needed for angle condition for given\r\n * sweepRadians.\r\n * * defaultStepRadians is assumed to be larger than zero.\r\n */\r\n public applyAngleTol(minCount: number, sweepRadians: number, defaultStepRadians: number): number {\r\n return StrokeOptions.applyAngleTol(this, minCount, sweepRadians, defaultStepRadians);\r\n }\r\n /**\r\n * Return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance\r\n * from the options.\r\n */\r\n public static applyAngleTol(\r\n options: StrokeOptions | undefined, minCount: number, sweepRadians: number, defaultStepRadians?: number,\r\n ): number {\r\n sweepRadians = Math.abs(sweepRadians);\r\n let stepRadians = defaultStepRadians ? defaultStepRadians : Math.PI / 8.0;\r\n if (options && options.angleTol && options.angleTol.radians > 0.0)\r\n stepRadians = options.angleTol.radians;\r\n if (minCount * stepRadians < sweepRadians)\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n return minCount;\r\n }\r\n /**\r\n * Return the number of strokes needed for given edgeLength curve.\r\n * @param options\r\n * @param minCount smallest allowed count\r\n * @param edgeLength\r\n */\r\n public static applyMaxEdgeLength(\r\n options: StrokeOptions | undefined, minCount: number, edgeLength: number,\r\n ): number {\r\n if (edgeLength < 0)\r\n edgeLength = - edgeLength;\r\n if (minCount < 1)\r\n minCount = 1;\r\n if (options && options.maxEdgeLength && options.maxEdgeLength * minCount < edgeLength) {\r\n minCount = Geometry.stepCount(options.maxEdgeLength, edgeLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,\r\n * chord, and minimum stroke.\r\n */\r\n public applyTolerancesToArc(radius: number, sweepRadians: number = Math.PI * 2): number {\r\n let numStrokes = 1;\r\n numStrokes = this.applyAngleTol(numStrokes, sweepRadians, Math.PI * 0.25);\r\n numStrokes = this.applyMaxEdgeLength(numStrokes, sweepRadians * radius);\r\n numStrokes = this.applyChordTol(numStrokes, radius, sweepRadians);\r\n numStrokes = this.applyMinStrokesPerPrimitive(numStrokes);\r\n return numStrokes;\r\n }\r\n /** Return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */\r\n public applyChordTol(minCount: number, radius: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0 && this.chordTol < radius) {\r\n const a = this.chordTol;\r\n const stepRadians = 2.0 * Math.acos((1.0 - a / radius));\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of existing count or count needed for circular arc chord tol with given\r\n * arc length and radians\r\n */\r\n public applyChordTolToLengthAndRadians(minCount: number, length: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0) {\r\n const radius = Geometry.conditionalDivideFraction(length, sweepRadians);\r\n if (radius !== undefined)\r\n return this.applyChordTol(minCount, radius, sweepRadians);\r\n }\r\n return minCount;\r\n }\r\n /** Return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */\r\n public applyMinStrokesPerPrimitive(minCount: number): number {\r\n if (this.minStrokesPerPrimitive !== undefined && Number.isFinite(this.minStrokesPerPrimitive)\r\n && this.minStrokesPerPrimitive > minCount)\r\n minCount = this.minStrokesPerPrimitive;\r\n return minCount;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for curves.\r\n * * angle tolerance of 15 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForCurves(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(15.0);\r\n return options;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for surfaces facets\r\n * * angle tolerance of 22.5 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForFacets(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(22.5);\r\n return options;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"StrokeOptions.js","sourceRoot":"","sources":["../../../src/curve/StrokeOptions.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,0CAAuC;AACvC,+CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,aAAa;IAA1B;QAcE,qDAAqD;QAC9C,sBAAiB,GAAY,KAAK,CAAC;QA2B1C,8CAA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AE,CAAC;YACzC,MAAM,MAAM,GAAG,mBAAQ,CAAC,yBAAyB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YACxE,IAAI,MAAM,KAAK,SAAS;gBACtB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,iGAAiG;IAC1F,2BAA2B,CAAC,QAAgB;QACjD,IAAI,IAAI,CAAC,sBAAsB,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,sBAAsB,CAAC;eACxF,IAAI,CAAC,sBAAsB,GAAG,QAAQ;YACzC,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC;QACzC,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,aAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAlMD,sCAkMC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\n/** @packageDocumentation\r\n * @module Curve\r\n */\r\n\r\nimport { Geometry } from \"../Geometry\";\r\nimport { Angle } from \"../geometry3d/Angle\";\r\n\r\n/**\r\n * Tolerance blob for various stroking methods.\r\n *\r\n * * Across many applications, the critical concepts are: chordTol, angleTol, maxEdgeLength\r\n * * Chord error is an distance measured from a curve or facet to its approximating stroke or facet.\r\n * * angle is the angle between two contiguous strokes or across a facet edge.\r\n * * maxEdgeLength is the length of a stroke or a edge of a facet.\r\n * * It is rare for all three to be active at once.\r\n * * Nearly all stroke and facet use cases will apply an angle tolerance.\r\n * * For curves, 15 degrees is typical\r\n * * For facets, 22.5 degrees is typical.\r\n * * Halving the angle tolerance will (roughly) make curves get twice as many strokes, and surfaces get 4 times as many facets.\r\n * * The angle tolerance has the useful property that its effect is independent of scale of that data. If data is suddenly scaled into millimeters rather than meters, the facet counts remain the same.\r\n * * When creating output for devices such as 3D printing will want a chord tolerance.\r\n * * For graphics display, use an angle tolerance of around 15 degrees and an chord tolerance which is the size of several pixels.\r\n * * Analysis meshes (e.g. Finite Elements) commonly need to apply maxEdgeLength.\r\n * * Using maxEdgeLength for graphics probably produces too many facets. For example, it causes long cylinders to get many nearly-square facets instead of the small number of long quads usually used for graphics.\r\n * * Facet tolerances are, as the Pirates' Code, guidelines, not absolute rules. Facet and stroke code may ignore tolerances in awkward situations.\r\n * * If multiple tolerances are in effect, the actual count will usually be based on the one that demands the most strokes or facets, unless it is so high that it violates some upper limit on the number of facets on an arc or a section of a curve.\r\n * @public\r\n */\r\nexport class StrokeOptions {\r\n /** Distance from stroke to actual geometry */\r\n public chordTol?: number;\r\n /** Turning angle between strokes. Larger value leads to fewer strokes. */\r\n public angleTol?: Angle;\r\n /** Maximum length of a single stroke. */\r\n public maxEdgeLength?: number;\r\n /**\r\n * Caller expects convex facets.\r\n * @deprecated in 4.x - never used. See [[shouldTriangulate]] and [[maximizeConvexFacets]].\r\n */\r\n public needConvexFacets?: boolean;\r\n /** Minimum strokes on a primitive */\r\n public minStrokesPerPrimitive?: number;\r\n /** Whether or not to triangulate each added facet */\r\n public shouldTriangulate: boolean = false;\r\n private _needNormals?: boolean;\r\n private _needTwoSided?: boolean;\r\n private _needParams?: boolean;\r\n /** Whether params are requested. */\r\n public get needParams(): boolean {\r\n return this._needParams !== undefined ? this._needParams : false;\r\n }\r\n public set needParams(value: boolean) {\r\n this._needParams = value;\r\n }\r\n /** Whether normals are requested */\r\n public get needNormals(): boolean {\r\n return this._needNormals !== undefined ? this._needNormals : false;\r\n }\r\n public set needNormals(value: boolean) {\r\n this._needNormals = value;\r\n }\r\n /** Whether twoSided is requested. */\r\n public get needTwoSided(): boolean {\r\n return this._needTwoSided !== undefined ? this._needTwoSided : false;\r\n }\r\n public set needTwoSided(value: boolean) {\r\n this._needTwoSided = value;\r\n }\r\n /** Optional color request flag */\r\n public needColors?: boolean;\r\n /** Default number of strokes for a circle. */\r\n public defaultCircleStrokes = 16;\r\n /** Ask if angleTol is specified */\r\n public get hasAngleTol(): boolean {\r\n return this.angleTol !== undefined && Math.abs(this.angleTol.radians) > 0.0;\r\n }\r\n /** Ask if chordTol is specified */\r\n public get hasChordTol(): boolean {\r\n return this.chordTol !== undefined && this.chordTol > 0.0;\r\n }\r\n /** Ask if maxEdgeLength is specified */\r\n public get hasMaxEdgeLength(): boolean {\r\n return this.maxEdgeLength !== undefined && this.maxEdgeLength > 0.0;\r\n }\r\n private _maximizeConvexFacets?: boolean;\r\n /**\r\n * Whether to post-process a planar triangulation by removing edges to maximize the size of convex facets.\r\n * * Setting this to true also sets [[shouldTriangulate]] to true.\r\n */\r\n public get maximizeConvexFacets(): boolean {\r\n return this._maximizeConvexFacets ?? false;\r\n }\r\n public set maximizeConvexFacets(value: boolean) {\r\n this._maximizeConvexFacets = value;\r\n if (value)\r\n this.shouldTriangulate = value;\r\n }\r\n /** Return a deep clone */\r\n public clone(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.chordTol = this.chordTol;\r\n options.angleTol = this.angleTol?.clone();\r\n options.maxEdgeLength = this.maxEdgeLength;\r\n options.minStrokesPerPrimitive = this.minStrokesPerPrimitive;\r\n options.shouldTriangulate = this.shouldTriangulate;\r\n options._needNormals = this._needNormals;\r\n options._needTwoSided = this._needTwoSided;\r\n options._needParams = this._needParams;\r\n options.needColors = this.needColors;\r\n options.defaultCircleStrokes = this.defaultCircleStrokes;\r\n options._maximizeConvexFacets = this._maximizeConvexFacets;\r\n return options;\r\n }\r\n /** Return stroke count which is the larger of the minCount or count needed for edge length condition. */\r\n public applyMaxEdgeLength(minCount: number, totalLength: number): number {\r\n totalLength = Math.abs(totalLength);\r\n if (this.maxEdgeLength && this.maxEdgeLength > 0.0 && minCount * this.maxEdgeLength < totalLength) {\r\n minCount = Geometry.stepCount(this.maxEdgeLength, totalLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of the existing count or count needed for angle condition for given\r\n * sweepRadians.\r\n * * defaultStepRadians is assumed to be larger than zero.\r\n */\r\n public applyAngleTol(minCount: number, sweepRadians: number, defaultStepRadians: number): number {\r\n return StrokeOptions.applyAngleTol(this, minCount, sweepRadians, defaultStepRadians);\r\n }\r\n /**\r\n * Return stroke count which is the larger of minCount and the count required to turn sweepRadians, using tolerance\r\n * from the options.\r\n */\r\n public static applyAngleTol(\r\n options: StrokeOptions | undefined, minCount: number, sweepRadians: number, defaultStepRadians?: number,\r\n ): number {\r\n sweepRadians = Math.abs(sweepRadians);\r\n let stepRadians = defaultStepRadians ? defaultStepRadians : Math.PI / 8.0;\r\n if (options && options.angleTol && options.angleTol.radians > 0.0)\r\n stepRadians = options.angleTol.radians;\r\n if (minCount * stepRadians < sweepRadians)\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n return minCount;\r\n }\r\n /**\r\n * Return the number of strokes needed for given edgeLength curve.\r\n * @param options\r\n * @param minCount smallest allowed count\r\n * @param edgeLength\r\n */\r\n public static applyMaxEdgeLength(\r\n options: StrokeOptions | undefined, minCount: number, edgeLength: number,\r\n ): number {\r\n if (edgeLength < 0)\r\n edgeLength = - edgeLength;\r\n if (minCount < 1)\r\n minCount = 1;\r\n if (options && options.maxEdgeLength && options.maxEdgeLength * minCount < edgeLength) {\r\n minCount = Geometry.stepCount(options.maxEdgeLength, edgeLength, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Determine a stroke count for a (partial) circular arc of given radius. This considers angle, maxEdgeLength,\r\n * chord, and minimum stroke.\r\n */\r\n public applyTolerancesToArc(radius: number, sweepRadians: number = Math.PI * 2): number {\r\n let numStrokes = 1;\r\n numStrokes = this.applyAngleTol(numStrokes, sweepRadians, Math.PI * 0.25);\r\n numStrokes = this.applyMaxEdgeLength(numStrokes, sweepRadians * radius);\r\n numStrokes = this.applyChordTol(numStrokes, radius, sweepRadians);\r\n numStrokes = this.applyMinStrokesPerPrimitive(numStrokes);\r\n return numStrokes;\r\n }\r\n /** Return stroke count which is the larger of existing count or count needed for circular arc chord tolerance condition. */\r\n public applyChordTol(minCount: number, radius: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0 && this.chordTol < radius) {\r\n const a = this.chordTol;\r\n const stepRadians = 2.0 * Math.acos((1.0 - a / radius));\r\n minCount = Geometry.stepCount(stepRadians, sweepRadians, minCount);\r\n }\r\n return minCount;\r\n }\r\n /**\r\n * Return stroke count which is the larger of existing count or count needed for circular arc chord tol with given\r\n * arc length and radians\r\n */\r\n public applyChordTolToLengthAndRadians(minCount: number, length: number, sweepRadians: number): number {\r\n if (this.chordTol && this.chordTol > 0.0) {\r\n const radius = Geometry.conditionalDivideFraction(length, sweepRadians);\r\n if (radius !== undefined)\r\n return this.applyChordTol(minCount, radius, sweepRadians);\r\n }\r\n return minCount;\r\n }\r\n /** Return stroke count which is the larger of existing count or `this.minStrokesPerPrimitive` */\r\n public applyMinStrokesPerPrimitive(minCount: number): number {\r\n if (this.minStrokesPerPrimitive !== undefined && Number.isFinite(this.minStrokesPerPrimitive)\r\n && this.minStrokesPerPrimitive > minCount)\r\n minCount = this.minStrokesPerPrimitive;\r\n return minCount;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for curves.\r\n * * angle tolerance of 15 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForCurves(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(15.0);\r\n return options;\r\n }\r\n /**\r\n * Create `StrokeOptions` with defaults appropriate for surfaces facets\r\n * * angle tolerance of 22.5 degrees.\r\n * * all others inactive.\r\n */\r\n public static createForFacets(): StrokeOptions {\r\n const options = new StrokeOptions();\r\n options.angleTol = Angle.createDegrees(22.5);\r\n return options;\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"EllipticalArcApproximationContext.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/EllipticalArcApproximationContext.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,iCAAiC,EAA6B,MAAM,UAAU,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AA4BjE;;;EAGE;AACF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,UAAU,CAAW;IAC7B,OAAO,CAAC,wBAAwB,CAAU;IAC1C,OAAO,CAAC,sBAAsB,CAAU;IACxC,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO;IASP,uCAAuC;WACzB,MAAM,CAClB,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EACvB,SAAS,GAAE,MAAM,EAAO,EACxB,uBAAuB,GAAE,OAAc,EACvC,qBAAqB,GAAE,OAAc,GACpC,iBAAiB;IAGpB;;;;;;OAMG;IACH,IAAW,QAAQ,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAEnC;IACD,0FAA0F;IAC1F,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;;GAOG;AACH,qBAAa,iCAAiC;IAC5C,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,qBAAqB,CAAU;IACvC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAwB;IAC9C,OAAO,CAAC,MAAM,CAAC,OAAO,CAAwB;IAC9C,OAAO,CAAC,MAAM,CAAC,OAAO,CAAwB;IAC9C,OAAO,CAAC,MAAM,CAAC,OAAO,CAAsB;IAE5C,mCAAmC;IACnC,OAAO;IAmBP,iCAAiC;WACnB,MAAM,CAAC,aAAa,EAAE,KAAK;IAGzC;;;;OAIG;IACH,IAAW,aAAa,IAAI,KAAK,CAEhC;IACD;;;;OAIG;IACH,IAAW,YAAY,IAAI,SAAS,CAEnC;IACD;;;OAGG;IACH,IAAW,oBAAoB,IAAI,OAAO,CAEzC;IACD;;;;OAIG;IACI,aAAa,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS;IAe5D;;;;;;;;;;;MAWE;WACY,wBAAwB,CACpC,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,SAAS,EAAE,0BAA0B,GAC1F,IAAI;IAmGP;;;;;;;;;;OAUG;IACI,yBAAyB,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,uBAAuB,GAAG,SAAS;IASnG;;;;;;;;;;;;;;;;;;;;OAoBG;IACI,sBAAsB,CAC3B,OAAO,EAAE,iCAAiC,EAAE,gBAAgB,GAAE,OAAe,GAC5E,iBAAiB,EAAE,GAAG,MAAM,EAAE;IA2IjC,0EAA0E;IACnE,sCAAsC,CAAC,OAAO,CAAC,EAAE,iCAAiC,GAAG,UAAU,GAAG,SAAS;CAUnH"}
1
+ {"version":3,"file":"EllipticalArcApproximationContext.d.ts","sourceRoot":"","sources":["../../../../src/curve/internalContexts/EllipticalArcApproximationContext.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,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;;;;OAIG;IACH,IAAW,YAAY,IAAI,SAAS,CAEnC;IACD;;;OAGG;IACH,IAAW,oBAAoB,IAAI,OAAO,CAEzC;IACD;;;;OAIG;IACI,aAAa,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS;IAe5D;;;;;;;;;;;MAWE;WACY,wBAAwB,CACpC,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,SAAS,EAAE,0BAA0B,GAC1F,IAAI;IAmGP;;;;;;;;;;OAUG;IACI,yBAAyB,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,uBAAuB,GAAG,SAAS;IASnG;;;;;;;;;;;;;;;;;;;;OAoBG;IACI,sBAAsB,CAC3B,OAAO,EAAE,iCAAiC,EAAE,gBAAgB,GAAE,OAAe,GAC5E,iBAAiB,EAAE,GAAG,MAAM,EAAE;IA2IjC,0EAA0E;IACnE,sCAAsC,CAAC,OAAO,CAAC,EAAE,iCAAiC,GAAG,UAAU,GAAG,SAAS;CAUnH"}
@@ -266,16 +266,19 @@ class ArcChainErrorProcessor extends QuadrantFractionsProcessor {
266
266
  }
267
267
  }
268
268
  /**
269
- * Processor for refining a single Q1 ordered interval [f0,f1] by perturbing an interior fraction f.
270
- * * This processor expects to repeatedly process a QuadrantFractions `q` with `q.quadrant` = 1 and fractions array
271
- * [fPrev, f0, f, f1], where fPrev is from the previously processed (possibly refined) adjacent interval; however, if
272
- * `q.interpolateStartTangent === true`, then no fPrev is necessary and [f0, f, f1] is expected.
273
- * * This is enough info to compute the two circular arcs spanning [f0,f] and [f,f1] and compare their approximation
274
- * errors.
275
- * * The basic idea is to perturb f so that the difference in the two arcs' errors is minimized.
276
- * * This processor keeps track of a bracket containing f so that when the caller repeatedly processes `q` via
277
- * [[EllipticalArcApproximationContext.processQuadrantFractions]], a bisection algorithm plays out, informed by the
278
- * heuristic that moving f toward one end of its bracket decreases the error of the approximating arc on that side of f.
269
+ * Processor for computing an optimal refinement of a single Q1 ordered interval [f0,f1] by perturbing an interior
270
+ * seed fraction f.
271
+ * * Typically the caller (cf. [[AdaptiveSubdivisionQ1ErrorProcessor.announceArc]] processes a
272
+ * QuadrantFractions `q` with `q.quadrant` = 1 until convergence. The `q.fractions` array is expected to have
273
+ * one of two forms:
274
+ * * [fPrev, f0, f, f1], where fPrev is from the adjacent interval (possibly just refined), or
275
+ * * [f0, f, f1], if `q.interpolateStartTangent === true`.
276
+ * * This processor implements a bisection algorithm that iteratively shrinks a sub-interval that brackets f,
277
+ * starting with [f0,f1]:
278
+ * * During processing, `announceArc` will be called twice to compute the approximation errors of the circular
279
+ * arcs on either side of f in the current bracket.
280
+ * * In `announceQuadrantEnd` if these two errors are almost equal, we are done refining [f0,f1]. Otherwise,
281
+ * we move f halfway to the endpoint of the bracket that decreases the error delta, and shrink our bracket.
279
282
  * @internal
280
283
  */
281
284
  class AdaptiveSubdivisionQ1IntervalErrorProcessor extends QuadrantFractionsProcessor {
@@ -347,14 +350,17 @@ class AdaptiveSubdivisionQ1IntervalErrorProcessor extends QuadrantFractionsProce
347
350
  /**
348
351
  * Processor for computing samples in Q1 for a subdivision-based arc chain approximation.
349
352
  * * The basic idea is to build a refinement of `q.fractions` for a QuadrantFractions q with q.quadrant = 1.
350
- * * Start off the refinement with a copy of `q.fractions`.
351
- * * When an announced arc exceeds a given maximum approximation error, compute a fraction f in the span
352
- * such that the error of arcs on either side of f would be almost equal, then add f to the refinement.
353
- * * If the announced arc does not exceed the maxError, its associated fraction span remains unchanged---no
354
- * additional samples are needed to decrease approximation error.
355
- * * After `q` processing completes, `q.fractions` is updated in place with the computed refinement.
356
- * * The caller typically re-processes `q` until `isRefined` returns false, at which point construction of an
357
- * approximation that is guaranteed not to exceed the desired error can commence.
353
+ * * In `announceQuadrantBegin` we start off the refinement with a copy of `q.fractions`.
354
+ * * In `announceArc` we are called to process the interval [f0,f1] in `q.fractions`. First we test if the
355
+ * announced arc's approximation error over [f0,f1] exceeds maxError.
356
+ * * If so, we employ [[AdaptiveSubdivisionQ1IntervalErrorProcessor]] to compute an interior fraction f
357
+ * that best refines the interval, which becomes [f0,f,f1].
358
+ * * Otherwise, the fraction span [f0,f1] is unchanged---no additional samples are needed to decrease the
359
+ * approximation error.
360
+ * * In `announceQuadrantEnd`, `q.fractions` is updated in place with the computed refinement.
361
+ * * The caller (e.g., [[AdaptiveSubdivisionSampler.computeRadiansStrictlyInsideQuadrant1]]) typically
362
+ * re-processes `q` until `isRefined` returns false, at which point construction of an approximation that is
363
+ * guaranteed not to exceed the desired error can commence.
358
364
  * @internal
359
365
  */
360
366
  class AdaptiveSubdivisionQ1ErrorProcessor extends QuadrantFractionsProcessor {