@itwin/core-geometry 5.5.0-dev.4 → 5.5.0-dev.6

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 (611) hide show
  1. package/lib/cjs/Geometry.d.ts +7 -0
  2. package/lib/cjs/Geometry.d.ts.map +1 -1
  3. package/lib/cjs/Geometry.js +9 -0
  4. package/lib/cjs/Geometry.js.map +1 -1
  5. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  6. package/lib/cjs/bspline/BSplineCurve.js +2 -1
  7. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  8. package/lib/cjs/bspline/BSplineCurveOps.d.ts.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurveOps.js +4 -1
  10. package/lib/cjs/bspline/BSplineCurveOps.js.map +1 -1
  11. package/lib/cjs/bspline/BezierCurve3d.d.ts.map +1 -1
  12. package/lib/cjs/bspline/BezierCurve3d.js +14 -4
  13. package/lib/cjs/bspline/BezierCurve3d.js.map +1 -1
  14. package/lib/cjs/bspline/BezierCurve3dH.d.ts +2 -0
  15. package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
  16. package/lib/cjs/bspline/BezierCurve3dH.js +19 -3
  17. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  18. package/lib/cjs/bspline/BezierCurveBase.d.ts +8 -2
  19. package/lib/cjs/bspline/BezierCurveBase.d.ts.map +1 -1
  20. package/lib/cjs/bspline/BezierCurveBase.js +10 -4
  21. package/lib/cjs/bspline/BezierCurveBase.js.map +1 -1
  22. package/lib/cjs/clipping/AlternatingConvexClipTree.js +4 -4
  23. package/lib/cjs/clipping/AlternatingConvexClipTree.js.map +1 -1
  24. package/lib/cjs/clipping/ClipPlane.d.ts +0 -3
  25. package/lib/cjs/clipping/ClipPlane.d.ts.map +1 -1
  26. package/lib/cjs/clipping/ClipPlane.js +9 -2
  27. package/lib/cjs/clipping/ClipPlane.js.map +1 -1
  28. package/lib/cjs/clipping/ClipPrimitive.d.ts +59 -9
  29. package/lib/cjs/clipping/ClipPrimitive.d.ts.map +1 -1
  30. package/lib/cjs/clipping/ClipPrimitive.js +124 -55
  31. package/lib/cjs/clipping/ClipPrimitive.js.map +1 -1
  32. package/lib/cjs/clipping/ClipUtils.js +1 -1
  33. package/lib/cjs/clipping/ClipUtils.js.map +1 -1
  34. package/lib/cjs/clipping/ClipVector.d.ts.map +1 -1
  35. package/lib/cjs/clipping/ClipVector.js +12 -8
  36. package/lib/cjs/clipping/ClipVector.js.map +1 -1
  37. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts +0 -2
  38. package/lib/cjs/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  39. package/lib/cjs/clipping/ConvexClipPlaneSet.js +19 -18
  40. package/lib/cjs/clipping/ConvexClipPlaneSet.js.map +1 -1
  41. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.d.ts +1 -1
  42. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.d.ts.map +1 -1
  43. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js +4 -5
  44. package/lib/cjs/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  45. package/lib/cjs/core-geometry.d.ts +0 -1
  46. package/lib/cjs/core-geometry.d.ts.map +1 -1
  47. package/lib/cjs/core-geometry.js +0 -1
  48. package/lib/cjs/core-geometry.js.map +1 -1
  49. package/lib/cjs/curve/Arc3d.js +2 -2
  50. package/lib/cjs/curve/Arc3d.js.map +1 -1
  51. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts +12 -4
  52. package/lib/cjs/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  53. package/lib/cjs/curve/CurveChainWithDistanceIndex.js +52 -33
  54. package/lib/cjs/curve/CurveChainWithDistanceIndex.js.map +1 -1
  55. package/lib/cjs/curve/CurveCollection.d.ts.map +1 -1
  56. package/lib/cjs/curve/CurveCollection.js +13 -6
  57. package/lib/cjs/curve/CurveCollection.js.map +1 -1
  58. package/lib/cjs/curve/CurveCurve.js +1 -1
  59. package/lib/cjs/curve/CurveCurve.js.map +1 -1
  60. package/lib/cjs/curve/CurveFactory.d.ts.map +1 -1
  61. package/lib/cjs/curve/CurveFactory.js +13 -1
  62. package/lib/cjs/curve/CurveFactory.js.map +1 -1
  63. package/lib/cjs/curve/CurveLocationDetail.d.ts +12 -4
  64. package/lib/cjs/curve/CurveLocationDetail.d.ts.map +1 -1
  65. package/lib/cjs/curve/CurveLocationDetail.js +14 -5
  66. package/lib/cjs/curve/CurveLocationDetail.js.map +1 -1
  67. package/lib/cjs/curve/CurvePrimitive.d.ts +5 -4
  68. package/lib/cjs/curve/CurvePrimitive.d.ts.map +1 -1
  69. package/lib/cjs/curve/CurvePrimitive.js +7 -4
  70. package/lib/cjs/curve/CurvePrimitive.js.map +1 -1
  71. package/lib/cjs/curve/LineString3d.d.ts +25 -16
  72. package/lib/cjs/curve/LineString3d.d.ts.map +1 -1
  73. package/lib/cjs/curve/LineString3d.js +90 -72
  74. package/lib/cjs/curve/LineString3d.js.map +1 -1
  75. package/lib/cjs/curve/Path.d.ts +0 -3
  76. package/lib/cjs/curve/Path.d.ts.map +1 -1
  77. package/lib/cjs/curve/Path.js +9 -2
  78. package/lib/cjs/curve/Path.js.map +1 -1
  79. package/lib/cjs/curve/Query/InOutTests.js.map +1 -1
  80. package/lib/cjs/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  81. package/lib/cjs/curve/Query/PlanarSubdivision.js +25 -31
  82. package/lib/cjs/curve/Query/PlanarSubdivision.js.map +1 -1
  83. package/lib/cjs/curve/Query/StrokeCountChain.d.ts +7 -1
  84. package/lib/cjs/curve/Query/StrokeCountChain.d.ts.map +1 -1
  85. package/lib/cjs/curve/Query/StrokeCountChain.js +27 -36
  86. package/lib/cjs/curve/Query/StrokeCountChain.js.map +1 -1
  87. package/lib/cjs/curve/RegionMomentsXY.d.ts.map +1 -1
  88. package/lib/cjs/curve/RegionMomentsXY.js +7 -1
  89. package/lib/cjs/curve/RegionMomentsXY.js.map +1 -1
  90. package/lib/cjs/curve/RegionOps.d.ts.map +1 -1
  91. package/lib/cjs/curve/RegionOps.js +8 -5
  92. package/lib/cjs/curve/RegionOps.js.map +1 -1
  93. package/lib/cjs/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  94. package/lib/cjs/curve/RegionOpsClassificationSweeps.js +6 -6
  95. package/lib/cjs/curve/RegionOpsClassificationSweeps.js.map +1 -1
  96. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts.map +1 -1
  97. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js +4 -1
  98. package/lib/cjs/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  99. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  100. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js +6 -1
  101. package/lib/cjs/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  102. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +5 -21
  103. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  104. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js +29 -73
  105. package/lib/cjs/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  106. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts +55 -13
  107. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  108. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js +238 -110
  109. package/lib/cjs/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  110. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js +1 -1
  111. package/lib/cjs/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  112. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts +1 -4
  113. package/lib/cjs/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  114. package/lib/cjs/curve/spiral/DirectSpiral3d.js +9 -9
  115. package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
  116. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts +11 -14
  117. package/lib/cjs/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  118. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js +18 -18
  119. package/lib/cjs/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  120. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts +7 -1
  121. package/lib/cjs/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  122. package/lib/cjs/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  123. package/lib/cjs/geometry3d/Ellipsoid.d.ts +19 -7
  124. package/lib/cjs/geometry3d/Ellipsoid.d.ts.map +1 -1
  125. package/lib/cjs/geometry3d/Ellipsoid.js +26 -11
  126. package/lib/cjs/geometry3d/Ellipsoid.js.map +1 -1
  127. package/lib/cjs/geometry3d/FrustumAnimation.d.ts.map +1 -1
  128. package/lib/cjs/geometry3d/FrustumAnimation.js +11 -1
  129. package/lib/cjs/geometry3d/FrustumAnimation.js.map +1 -1
  130. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts +5 -1
  131. package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  132. package/lib/cjs/geometry3d/GrowableFloat64Array.js +11 -1
  133. package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
  134. package/lib/cjs/geometry3d/GrowableXYArray.d.ts +1 -1
  135. package/lib/cjs/geometry3d/GrowableXYArray.js +1 -1
  136. package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
  137. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +49 -8
  138. package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  139. package/lib/cjs/geometry3d/GrowableXYZArray.js +90 -37
  140. package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
  141. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts +100 -3
  142. package/lib/cjs/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  143. package/lib/cjs/geometry3d/IndexedXYZCollection.js +125 -0
  144. package/lib/cjs/geometry3d/IndexedXYZCollection.js.map +1 -1
  145. package/lib/cjs/geometry3d/Matrix3d.d.ts +10 -1
  146. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  147. package/lib/cjs/geometry3d/Matrix3d.js +53 -34
  148. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  149. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js +1 -1
  150. package/lib/cjs/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  151. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts +49 -2
  152. package/lib/cjs/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  153. package/lib/cjs/geometry3d/Point3dArrayCarrier.js +67 -9
  154. package/lib/cjs/geometry3d/Point3dArrayCarrier.js.map +1 -1
  155. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +1 -1
  156. package/lib/cjs/geometry3d/Point3dVector3d.js +1 -1
  157. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  158. package/lib/cjs/geometry3d/PointStreaming.js +1 -1
  159. package/lib/cjs/geometry3d/PointStreaming.js.map +1 -1
  160. package/lib/cjs/geometry3d/PolygonOps.d.ts +24 -32
  161. package/lib/cjs/geometry3d/PolygonOps.d.ts.map +1 -1
  162. package/lib/cjs/geometry3d/PolygonOps.js +147 -180
  163. package/lib/cjs/geometry3d/PolygonOps.js.map +1 -1
  164. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js +5 -5
  165. package/lib/cjs/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  166. package/lib/cjs/geometry3d/PolylineOps.d.ts.map +1 -1
  167. package/lib/cjs/geometry3d/PolylineOps.js +13 -3
  168. package/lib/cjs/geometry3d/PolylineOps.js.map +1 -1
  169. package/lib/cjs/geometry3d/Range.js.map +1 -1
  170. package/lib/cjs/geometry3d/Ray3d.d.ts +0 -3
  171. package/lib/cjs/geometry3d/Ray3d.d.ts.map +1 -1
  172. package/lib/cjs/geometry3d/Ray3d.js +5 -1
  173. package/lib/cjs/geometry3d/Ray3d.js.map +1 -1
  174. package/lib/cjs/geometry3d/SortablePolygon.d.ts +2 -2
  175. package/lib/cjs/geometry3d/SortablePolygon.d.ts.map +1 -1
  176. package/lib/cjs/geometry3d/SortablePolygon.js +14 -18
  177. package/lib/cjs/geometry3d/SortablePolygon.js.map +1 -1
  178. package/lib/cjs/geometry3d/Transform.d.ts +8 -0
  179. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  180. package/lib/cjs/geometry3d/Transform.js +15 -9
  181. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  182. package/lib/cjs/numerics/ClusterableArray.d.ts +4 -2
  183. package/lib/cjs/numerics/ClusterableArray.d.ts.map +1 -1
  184. package/lib/cjs/numerics/ClusterableArray.js +6 -4
  185. package/lib/cjs/numerics/ClusterableArray.js.map +1 -1
  186. package/lib/cjs/numerics/Newton.d.ts +3 -1
  187. package/lib/cjs/numerics/Newton.d.ts.map +1 -1
  188. package/lib/cjs/numerics/Newton.js +5 -1
  189. package/lib/cjs/numerics/Newton.js.map +1 -1
  190. package/lib/cjs/polyface/AuxData.d.ts +1 -4
  191. package/lib/cjs/polyface/AuxData.d.ts.map +1 -1
  192. package/lib/cjs/polyface/AuxData.js +5 -1
  193. package/lib/cjs/polyface/AuxData.js.map +1 -1
  194. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js +3 -3
  195. package/lib/cjs/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  196. package/lib/cjs/polyface/Polyface.d.ts.map +1 -1
  197. package/lib/cjs/polyface/Polyface.js +14 -16
  198. package/lib/cjs/polyface/Polyface.js.map +1 -1
  199. package/lib/cjs/polyface/PolyfaceBuilder.d.ts +84 -28
  200. package/lib/cjs/polyface/PolyfaceBuilder.d.ts.map +1 -1
  201. package/lib/cjs/polyface/PolyfaceBuilder.js +277 -217
  202. package/lib/cjs/polyface/PolyfaceBuilder.js.map +1 -1
  203. package/lib/cjs/polyface/PolyfaceClip.d.ts +4 -3
  204. package/lib/cjs/polyface/PolyfaceClip.d.ts.map +1 -1
  205. package/lib/cjs/polyface/PolyfaceClip.js +11 -4
  206. package/lib/cjs/polyface/PolyfaceClip.js.map +1 -1
  207. package/lib/cjs/polyface/PolyfaceData.js.map +1 -1
  208. package/lib/cjs/polyface/PolyfaceQuery.d.ts.map +1 -1
  209. package/lib/cjs/polyface/PolyfaceQuery.js +9 -7
  210. package/lib/cjs/polyface/PolyfaceQuery.js.map +1 -1
  211. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.d.ts.map +1 -1
  212. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js +3 -2
  213. package/lib/cjs/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  214. package/lib/cjs/polyface/RangeTree/RangeTreeNode.d.ts +1 -1
  215. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js +2 -2
  216. package/lib/cjs/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  217. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  218. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js +14 -12
  219. package/lib/cjs/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  220. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.d.ts +1 -1
  221. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.d.ts.map +1 -1
  222. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js +10 -6
  223. package/lib/cjs/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  224. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js +4 -3
  225. package/lib/cjs/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  226. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  227. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js +3 -5
  228. package/lib/cjs/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  229. package/lib/cjs/polyface/multiclip/XYPointBuckets.d.ts +1 -1
  230. package/lib/cjs/polyface/multiclip/XYPointBuckets.d.ts.map +1 -1
  231. package/lib/cjs/polyface/multiclip/XYPointBuckets.js +4 -8
  232. package/lib/cjs/polyface/multiclip/XYPointBuckets.js.map +1 -1
  233. package/lib/cjs/serialization/BGFBAccessors.d.ts.map +1 -1
  234. package/lib/cjs/serialization/BGFBAccessors.js +1 -0
  235. package/lib/cjs/serialization/BGFBAccessors.js.map +1 -1
  236. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  237. package/lib/cjs/serialization/BGFBReader.js +37 -7
  238. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  239. package/lib/cjs/serialization/BGFBWriter.d.ts +4 -4
  240. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  241. package/lib/cjs/serialization/BGFBWriter.js +24 -40
  242. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  243. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  244. package/lib/cjs/serialization/IModelJsonSchema.js +9 -3
  245. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  246. package/lib/cjs/serialization/SerializationHelpers.d.ts +0 -3
  247. package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -1
  248. package/lib/cjs/serialization/SerializationHelpers.js +16 -7
  249. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -1
  250. package/lib/cjs/solid/Box.d.ts +2 -2
  251. package/lib/cjs/solid/Box.d.ts.map +1 -1
  252. package/lib/cjs/solid/Box.js.map +1 -1
  253. package/lib/cjs/solid/Cone.d.ts +3 -2
  254. package/lib/cjs/solid/Cone.d.ts.map +1 -1
  255. package/lib/cjs/solid/Cone.js +4 -1
  256. package/lib/cjs/solid/Cone.js.map +1 -1
  257. package/lib/cjs/solid/LinearSweep.d.ts +1 -1
  258. package/lib/cjs/solid/LinearSweep.d.ts.map +1 -1
  259. package/lib/cjs/solid/LinearSweep.js +1 -1
  260. package/lib/cjs/solid/LinearSweep.js.map +1 -1
  261. package/lib/cjs/solid/RotationalSweep.d.ts.map +1 -1
  262. package/lib/cjs/solid/RotationalSweep.js +1 -3
  263. package/lib/cjs/solid/RotationalSweep.js.map +1 -1
  264. package/lib/cjs/solid/TorusPipe.d.ts +4 -3
  265. package/lib/cjs/solid/TorusPipe.d.ts.map +1 -1
  266. package/lib/cjs/solid/TorusPipe.js.map +1 -1
  267. package/lib/cjs/topology/ChainMerge.d.ts +4 -4
  268. package/lib/cjs/topology/ChainMerge.d.ts.map +1 -1
  269. package/lib/cjs/topology/ChainMerge.js +11 -1
  270. package/lib/cjs/topology/ChainMerge.js.map +1 -1
  271. package/lib/cjs/topology/Graph.d.ts +2 -0
  272. package/lib/cjs/topology/Graph.d.ts.map +1 -1
  273. package/lib/cjs/topology/Graph.js +5 -0
  274. package/lib/cjs/topology/Graph.js.map +1 -1
  275. package/lib/cjs/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  276. package/lib/cjs/topology/HalfEdgeGraphSearch.js +2 -0
  277. package/lib/cjs/topology/HalfEdgeGraphSearch.js.map +1 -1
  278. package/lib/cjs/topology/HalfEdgePointInGraphSearch.d.ts.map +1 -1
  279. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js +23 -16
  280. package/lib/cjs/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  281. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts +20 -9
  282. package/lib/cjs/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  283. package/lib/cjs/topology/HalfEdgePositionDetail.js +17 -13
  284. package/lib/cjs/topology/HalfEdgePositionDetail.js.map +1 -1
  285. package/lib/cjs/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
  286. package/lib/cjs/topology/HalfEdgePriorityQueue.js +3 -1
  287. package/lib/cjs/topology/HalfEdgePriorityQueue.js.map +1 -1
  288. package/lib/cjs/topology/InsertAndRetriangulateContext.d.ts +6 -2
  289. package/lib/cjs/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  290. package/lib/cjs/topology/InsertAndRetriangulateContext.js +41 -35
  291. package/lib/cjs/topology/InsertAndRetriangulateContext.js.map +1 -1
  292. package/lib/cjs/topology/MaskManager.d.ts +7 -3
  293. package/lib/cjs/topology/MaskManager.d.ts.map +1 -1
  294. package/lib/cjs/topology/MaskManager.js +10 -4
  295. package/lib/cjs/topology/MaskManager.js.map +1 -1
  296. package/lib/cjs/topology/RegularizeFace.d.ts.map +1 -1
  297. package/lib/cjs/topology/RegularizeFace.js.map +1 -1
  298. package/lib/cjs/topology/Triangulation.d.ts +2 -1
  299. package/lib/cjs/topology/Triangulation.d.ts.map +1 -1
  300. package/lib/cjs/topology/Triangulation.js +12 -7
  301. package/lib/cjs/topology/Triangulation.js.map +1 -1
  302. package/lib/esm/Geometry.d.ts +7 -0
  303. package/lib/esm/Geometry.d.ts.map +1 -1
  304. package/lib/esm/Geometry.js +9 -0
  305. package/lib/esm/Geometry.js.map +1 -1
  306. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  307. package/lib/esm/bspline/BSplineCurve.js +2 -1
  308. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  309. package/lib/esm/bspline/BSplineCurveOps.d.ts.map +1 -1
  310. package/lib/esm/bspline/BSplineCurveOps.js +4 -1
  311. package/lib/esm/bspline/BSplineCurveOps.js.map +1 -1
  312. package/lib/esm/bspline/BezierCurve3d.d.ts.map +1 -1
  313. package/lib/esm/bspline/BezierCurve3d.js +14 -4
  314. package/lib/esm/bspline/BezierCurve3d.js.map +1 -1
  315. package/lib/esm/bspline/BezierCurve3dH.d.ts +2 -0
  316. package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
  317. package/lib/esm/bspline/BezierCurve3dH.js +19 -3
  318. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  319. package/lib/esm/bspline/BezierCurveBase.d.ts +8 -2
  320. package/lib/esm/bspline/BezierCurveBase.d.ts.map +1 -1
  321. package/lib/esm/bspline/BezierCurveBase.js +10 -4
  322. package/lib/esm/bspline/BezierCurveBase.js.map +1 -1
  323. package/lib/esm/clipping/AlternatingConvexClipTree.js +4 -4
  324. package/lib/esm/clipping/AlternatingConvexClipTree.js.map +1 -1
  325. package/lib/esm/clipping/ClipPlane.d.ts +0 -3
  326. package/lib/esm/clipping/ClipPlane.d.ts.map +1 -1
  327. package/lib/esm/clipping/ClipPlane.js +9 -2
  328. package/lib/esm/clipping/ClipPlane.js.map +1 -1
  329. package/lib/esm/clipping/ClipPrimitive.d.ts +59 -9
  330. package/lib/esm/clipping/ClipPrimitive.d.ts.map +1 -1
  331. package/lib/esm/clipping/ClipPrimitive.js +124 -55
  332. package/lib/esm/clipping/ClipPrimitive.js.map +1 -1
  333. package/lib/esm/clipping/ClipUtils.js +1 -1
  334. package/lib/esm/clipping/ClipUtils.js.map +1 -1
  335. package/lib/esm/clipping/ClipVector.d.ts.map +1 -1
  336. package/lib/esm/clipping/ClipVector.js +12 -8
  337. package/lib/esm/clipping/ClipVector.js.map +1 -1
  338. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts +0 -2
  339. package/lib/esm/clipping/ConvexClipPlaneSet.d.ts.map +1 -1
  340. package/lib/esm/clipping/ConvexClipPlaneSet.js +20 -19
  341. package/lib/esm/clipping/ConvexClipPlaneSet.js.map +1 -1
  342. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.d.ts +1 -1
  343. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.d.ts.map +1 -1
  344. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js +4 -5
  345. package/lib/esm/clipping/internalContexts/LineStringOffsetClipperContext.js.map +1 -1
  346. package/lib/esm/core-geometry.d.ts +0 -1
  347. package/lib/esm/core-geometry.d.ts.map +1 -1
  348. package/lib/esm/core-geometry.js +0 -1
  349. package/lib/esm/core-geometry.js.map +1 -1
  350. package/lib/esm/curve/Arc3d.js +2 -2
  351. package/lib/esm/curve/Arc3d.js.map +1 -1
  352. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts +12 -4
  353. package/lib/esm/curve/CurveChainWithDistanceIndex.d.ts.map +1 -1
  354. package/lib/esm/curve/CurveChainWithDistanceIndex.js +53 -34
  355. package/lib/esm/curve/CurveChainWithDistanceIndex.js.map +1 -1
  356. package/lib/esm/curve/CurveCollection.d.ts.map +1 -1
  357. package/lib/esm/curve/CurveCollection.js +13 -6
  358. package/lib/esm/curve/CurveCollection.js.map +1 -1
  359. package/lib/esm/curve/CurveCurve.js +1 -1
  360. package/lib/esm/curve/CurveCurve.js.map +1 -1
  361. package/lib/esm/curve/CurveFactory.d.ts.map +1 -1
  362. package/lib/esm/curve/CurveFactory.js +13 -1
  363. package/lib/esm/curve/CurveFactory.js.map +1 -1
  364. package/lib/esm/curve/CurveLocationDetail.d.ts +12 -4
  365. package/lib/esm/curve/CurveLocationDetail.d.ts.map +1 -1
  366. package/lib/esm/curve/CurveLocationDetail.js +14 -5
  367. package/lib/esm/curve/CurveLocationDetail.js.map +1 -1
  368. package/lib/esm/curve/CurvePrimitive.d.ts +5 -4
  369. package/lib/esm/curve/CurvePrimitive.d.ts.map +1 -1
  370. package/lib/esm/curve/CurvePrimitive.js +7 -4
  371. package/lib/esm/curve/CurvePrimitive.js.map +1 -1
  372. package/lib/esm/curve/LineString3d.d.ts +25 -16
  373. package/lib/esm/curve/LineString3d.d.ts.map +1 -1
  374. package/lib/esm/curve/LineString3d.js +90 -72
  375. package/lib/esm/curve/LineString3d.js.map +1 -1
  376. package/lib/esm/curve/Path.d.ts +0 -3
  377. package/lib/esm/curve/Path.d.ts.map +1 -1
  378. package/lib/esm/curve/Path.js +9 -2
  379. package/lib/esm/curve/Path.js.map +1 -1
  380. package/lib/esm/curve/Query/InOutTests.js.map +1 -1
  381. package/lib/esm/curve/Query/PlanarSubdivision.d.ts.map +1 -1
  382. package/lib/esm/curve/Query/PlanarSubdivision.js +25 -31
  383. package/lib/esm/curve/Query/PlanarSubdivision.js.map +1 -1
  384. package/lib/esm/curve/Query/StrokeCountChain.d.ts +7 -1
  385. package/lib/esm/curve/Query/StrokeCountChain.d.ts.map +1 -1
  386. package/lib/esm/curve/Query/StrokeCountChain.js +27 -36
  387. package/lib/esm/curve/Query/StrokeCountChain.js.map +1 -1
  388. package/lib/esm/curve/RegionMomentsXY.d.ts.map +1 -1
  389. package/lib/esm/curve/RegionMomentsXY.js +7 -1
  390. package/lib/esm/curve/RegionMomentsXY.js.map +1 -1
  391. package/lib/esm/curve/RegionOps.d.ts.map +1 -1
  392. package/lib/esm/curve/RegionOps.js +8 -5
  393. package/lib/esm/curve/RegionOps.js.map +1 -1
  394. package/lib/esm/curve/RegionOpsClassificationSweeps.d.ts.map +1 -1
  395. package/lib/esm/curve/RegionOpsClassificationSweeps.js +6 -6
  396. package/lib/esm/curve/RegionOpsClassificationSweeps.js.map +1 -1
  397. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.d.ts.map +1 -1
  398. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js +4 -1
  399. package/lib/esm/curve/internalContexts/AnnounceTangentStrokeHandler.js.map +1 -1
  400. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.d.ts.map +1 -1
  401. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js +6 -1
  402. package/lib/esm/curve/internalContexts/ClosestPointStrokeHandler.js.map +1 -1
  403. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts +5 -21
  404. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.d.ts.map +1 -1
  405. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js +29 -73
  406. package/lib/esm/curve/internalContexts/CurveCurveCloseApproachXY.js.map +1 -1
  407. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts +55 -13
  408. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.d.ts.map +1 -1
  409. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js +239 -111
  410. package/lib/esm/curve/internalContexts/CurveCurveIntersectXY.js.map +1 -1
  411. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js +1 -1
  412. package/lib/esm/curve/internalContexts/PolygonOffsetContext.js.map +1 -1
  413. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts +1 -4
  414. package/lib/esm/curve/spiral/DirectSpiral3d.d.ts.map +1 -1
  415. package/lib/esm/curve/spiral/DirectSpiral3d.js +9 -9
  416. package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
  417. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts +11 -14
  418. package/lib/esm/curve/spiral/IntegratedSpiral3d.d.ts.map +1 -1
  419. package/lib/esm/curve/spiral/IntegratedSpiral3d.js +18 -18
  420. package/lib/esm/curve/spiral/IntegratedSpiral3d.js.map +1 -1
  421. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts +7 -1
  422. package/lib/esm/curve/spiral/TransitionConditionalProperties.d.ts.map +1 -1
  423. package/lib/esm/curve/spiral/TransitionConditionalProperties.js.map +1 -1
  424. package/lib/esm/geometry3d/Ellipsoid.d.ts +19 -7
  425. package/lib/esm/geometry3d/Ellipsoid.d.ts.map +1 -1
  426. package/lib/esm/geometry3d/Ellipsoid.js +26 -11
  427. package/lib/esm/geometry3d/Ellipsoid.js.map +1 -1
  428. package/lib/esm/geometry3d/FrustumAnimation.d.ts.map +1 -1
  429. package/lib/esm/geometry3d/FrustumAnimation.js +11 -1
  430. package/lib/esm/geometry3d/FrustumAnimation.js.map +1 -1
  431. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts +5 -1
  432. package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
  433. package/lib/esm/geometry3d/GrowableFloat64Array.js +11 -1
  434. package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
  435. package/lib/esm/geometry3d/GrowableXYArray.d.ts +1 -1
  436. package/lib/esm/geometry3d/GrowableXYArray.js +1 -1
  437. package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
  438. package/lib/esm/geometry3d/GrowableXYZArray.d.ts +49 -8
  439. package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
  440. package/lib/esm/geometry3d/GrowableXYZArray.js +90 -37
  441. package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
  442. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts +100 -3
  443. package/lib/esm/geometry3d/IndexedXYZCollection.d.ts.map +1 -1
  444. package/lib/esm/geometry3d/IndexedXYZCollection.js +125 -0
  445. package/lib/esm/geometry3d/IndexedXYZCollection.js.map +1 -1
  446. package/lib/esm/geometry3d/Matrix3d.d.ts +10 -1
  447. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  448. package/lib/esm/geometry3d/Matrix3d.js +53 -34
  449. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  450. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js +1 -1
  451. package/lib/esm/geometry3d/Plane3dByOriginAndUnitNormal.js.map +1 -1
  452. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts +49 -2
  453. package/lib/esm/geometry3d/Point3dArrayCarrier.d.ts.map +1 -1
  454. package/lib/esm/geometry3d/Point3dArrayCarrier.js +67 -9
  455. package/lib/esm/geometry3d/Point3dArrayCarrier.js.map +1 -1
  456. package/lib/esm/geometry3d/Point3dVector3d.d.ts +1 -1
  457. package/lib/esm/geometry3d/Point3dVector3d.js +1 -1
  458. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  459. package/lib/esm/geometry3d/PointStreaming.js +1 -1
  460. package/lib/esm/geometry3d/PointStreaming.js.map +1 -1
  461. package/lib/esm/geometry3d/PolygonOps.d.ts +24 -32
  462. package/lib/esm/geometry3d/PolygonOps.d.ts.map +1 -1
  463. package/lib/esm/geometry3d/PolygonOps.js +147 -180
  464. package/lib/esm/geometry3d/PolygonOps.js.map +1 -1
  465. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js +5 -5
  466. package/lib/esm/geometry3d/PolylineCompressionByEdgeOffset.js.map +1 -1
  467. package/lib/esm/geometry3d/PolylineOps.d.ts.map +1 -1
  468. package/lib/esm/geometry3d/PolylineOps.js +13 -3
  469. package/lib/esm/geometry3d/PolylineOps.js.map +1 -1
  470. package/lib/esm/geometry3d/Range.js.map +1 -1
  471. package/lib/esm/geometry3d/Ray3d.d.ts +0 -3
  472. package/lib/esm/geometry3d/Ray3d.d.ts.map +1 -1
  473. package/lib/esm/geometry3d/Ray3d.js +5 -1
  474. package/lib/esm/geometry3d/Ray3d.js.map +1 -1
  475. package/lib/esm/geometry3d/SortablePolygon.d.ts +2 -2
  476. package/lib/esm/geometry3d/SortablePolygon.d.ts.map +1 -1
  477. package/lib/esm/geometry3d/SortablePolygon.js +14 -18
  478. package/lib/esm/geometry3d/SortablePolygon.js.map +1 -1
  479. package/lib/esm/geometry3d/Transform.d.ts +8 -0
  480. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  481. package/lib/esm/geometry3d/Transform.js +15 -9
  482. package/lib/esm/geometry3d/Transform.js.map +1 -1
  483. package/lib/esm/numerics/ClusterableArray.d.ts +4 -2
  484. package/lib/esm/numerics/ClusterableArray.d.ts.map +1 -1
  485. package/lib/esm/numerics/ClusterableArray.js +6 -4
  486. package/lib/esm/numerics/ClusterableArray.js.map +1 -1
  487. package/lib/esm/numerics/Newton.d.ts +3 -1
  488. package/lib/esm/numerics/Newton.d.ts.map +1 -1
  489. package/lib/esm/numerics/Newton.js +5 -1
  490. package/lib/esm/numerics/Newton.js.map +1 -1
  491. package/lib/esm/polyface/AuxData.d.ts +1 -4
  492. package/lib/esm/polyface/AuxData.d.ts.map +1 -1
  493. package/lib/esm/polyface/AuxData.js +5 -1
  494. package/lib/esm/polyface/AuxData.js.map +1 -1
  495. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js +3 -3
  496. package/lib/esm/polyface/GreedyTriangulationBetweenLineStrings.js.map +1 -1
  497. package/lib/esm/polyface/Polyface.d.ts.map +1 -1
  498. package/lib/esm/polyface/Polyface.js +14 -16
  499. package/lib/esm/polyface/Polyface.js.map +1 -1
  500. package/lib/esm/polyface/PolyfaceBuilder.d.ts +84 -28
  501. package/lib/esm/polyface/PolyfaceBuilder.d.ts.map +1 -1
  502. package/lib/esm/polyface/PolyfaceBuilder.js +277 -217
  503. package/lib/esm/polyface/PolyfaceBuilder.js.map +1 -1
  504. package/lib/esm/polyface/PolyfaceClip.d.ts +4 -3
  505. package/lib/esm/polyface/PolyfaceClip.d.ts.map +1 -1
  506. package/lib/esm/polyface/PolyfaceClip.js +11 -4
  507. package/lib/esm/polyface/PolyfaceClip.js.map +1 -1
  508. package/lib/esm/polyface/PolyfaceData.js.map +1 -1
  509. package/lib/esm/polyface/PolyfaceQuery.d.ts.map +1 -1
  510. package/lib/esm/polyface/PolyfaceQuery.js +9 -7
  511. package/lib/esm/polyface/PolyfaceQuery.js.map +1 -1
  512. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.d.ts.map +1 -1
  513. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js +3 -2
  514. package/lib/esm/polyface/RangeTree/LineString3dRangeTreeContext.js.map +1 -1
  515. package/lib/esm/polyface/RangeTree/RangeTreeNode.d.ts +1 -1
  516. package/lib/esm/polyface/RangeTree/RangeTreeNode.js +2 -2
  517. package/lib/esm/polyface/RangeTree/RangeTreeNode.js.map +1 -1
  518. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.d.ts.map +1 -1
  519. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js +14 -12
  520. package/lib/esm/polyface/RangeTree/RangeTreeSearchHandlers.js.map +1 -1
  521. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.d.ts +1 -1
  522. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.d.ts.map +1 -1
  523. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js +10 -6
  524. package/lib/esm/polyface/multiclip/BuildAverageNormalsContext.js.map +1 -1
  525. package/lib/esm/polyface/multiclip/OffsetMeshContext.js +4 -3
  526. package/lib/esm/polyface/multiclip/OffsetMeshContext.js.map +1 -1
  527. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.d.ts.map +1 -1
  528. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js +3 -5
  529. package/lib/esm/polyface/multiclip/SweepLineStringToFacetContext.js.map +1 -1
  530. package/lib/esm/polyface/multiclip/XYPointBuckets.d.ts +1 -1
  531. package/lib/esm/polyface/multiclip/XYPointBuckets.d.ts.map +1 -1
  532. package/lib/esm/polyface/multiclip/XYPointBuckets.js +4 -8
  533. package/lib/esm/polyface/multiclip/XYPointBuckets.js.map +1 -1
  534. package/lib/esm/serialization/BGFBAccessors.d.ts.map +1 -1
  535. package/lib/esm/serialization/BGFBAccessors.js +1 -0
  536. package/lib/esm/serialization/BGFBAccessors.js.map +1 -1
  537. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  538. package/lib/esm/serialization/BGFBReader.js +37 -7
  539. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  540. package/lib/esm/serialization/BGFBWriter.d.ts +4 -4
  541. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  542. package/lib/esm/serialization/BGFBWriter.js +24 -40
  543. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  544. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  545. package/lib/esm/serialization/IModelJsonSchema.js +9 -3
  546. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  547. package/lib/esm/serialization/SerializationHelpers.d.ts +0 -3
  548. package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -1
  549. package/lib/esm/serialization/SerializationHelpers.js +16 -7
  550. package/lib/esm/serialization/SerializationHelpers.js.map +1 -1
  551. package/lib/esm/solid/Box.d.ts +2 -2
  552. package/lib/esm/solid/Box.d.ts.map +1 -1
  553. package/lib/esm/solid/Box.js.map +1 -1
  554. package/lib/esm/solid/Cone.d.ts +3 -2
  555. package/lib/esm/solid/Cone.d.ts.map +1 -1
  556. package/lib/esm/solid/Cone.js +4 -1
  557. package/lib/esm/solid/Cone.js.map +1 -1
  558. package/lib/esm/solid/LinearSweep.d.ts +1 -1
  559. package/lib/esm/solid/LinearSweep.d.ts.map +1 -1
  560. package/lib/esm/solid/LinearSweep.js +1 -1
  561. package/lib/esm/solid/LinearSweep.js.map +1 -1
  562. package/lib/esm/solid/RotationalSweep.d.ts.map +1 -1
  563. package/lib/esm/solid/RotationalSweep.js +1 -3
  564. package/lib/esm/solid/RotationalSweep.js.map +1 -1
  565. package/lib/esm/solid/TorusPipe.d.ts +4 -3
  566. package/lib/esm/solid/TorusPipe.d.ts.map +1 -1
  567. package/lib/esm/solid/TorusPipe.js.map +1 -1
  568. package/lib/esm/topology/ChainMerge.d.ts +4 -4
  569. package/lib/esm/topology/ChainMerge.d.ts.map +1 -1
  570. package/lib/esm/topology/ChainMerge.js +11 -1
  571. package/lib/esm/topology/ChainMerge.js.map +1 -1
  572. package/lib/esm/topology/Graph.d.ts +2 -0
  573. package/lib/esm/topology/Graph.d.ts.map +1 -1
  574. package/lib/esm/topology/Graph.js +5 -0
  575. package/lib/esm/topology/Graph.js.map +1 -1
  576. package/lib/esm/topology/HalfEdgeGraphSearch.d.ts.map +1 -1
  577. package/lib/esm/topology/HalfEdgeGraphSearch.js +2 -0
  578. package/lib/esm/topology/HalfEdgeGraphSearch.js.map +1 -1
  579. package/lib/esm/topology/HalfEdgePointInGraphSearch.d.ts.map +1 -1
  580. package/lib/esm/topology/HalfEdgePointInGraphSearch.js +23 -16
  581. package/lib/esm/topology/HalfEdgePointInGraphSearch.js.map +1 -1
  582. package/lib/esm/topology/HalfEdgePositionDetail.d.ts +20 -9
  583. package/lib/esm/topology/HalfEdgePositionDetail.d.ts.map +1 -1
  584. package/lib/esm/topology/HalfEdgePositionDetail.js +17 -13
  585. package/lib/esm/topology/HalfEdgePositionDetail.js.map +1 -1
  586. package/lib/esm/topology/HalfEdgePriorityQueue.d.ts.map +1 -1
  587. package/lib/esm/topology/HalfEdgePriorityQueue.js +4 -2
  588. package/lib/esm/topology/HalfEdgePriorityQueue.js.map +1 -1
  589. package/lib/esm/topology/InsertAndRetriangulateContext.d.ts +6 -2
  590. package/lib/esm/topology/InsertAndRetriangulateContext.d.ts.map +1 -1
  591. package/lib/esm/topology/InsertAndRetriangulateContext.js +41 -35
  592. package/lib/esm/topology/InsertAndRetriangulateContext.js.map +1 -1
  593. package/lib/esm/topology/MaskManager.d.ts +7 -3
  594. package/lib/esm/topology/MaskManager.d.ts.map +1 -1
  595. package/lib/esm/topology/MaskManager.js +10 -4
  596. package/lib/esm/topology/MaskManager.js.map +1 -1
  597. package/lib/esm/topology/RegularizeFace.d.ts.map +1 -1
  598. package/lib/esm/topology/RegularizeFace.js.map +1 -1
  599. package/lib/esm/topology/Triangulation.d.ts +2 -1
  600. package/lib/esm/topology/Triangulation.d.ts.map +1 -1
  601. package/lib/esm/topology/Triangulation.js +12 -7
  602. package/lib/esm/topology/Triangulation.js.map +1 -1
  603. package/package.json +3 -3
  604. package/lib/cjs/serialization/GeometrySamples.d.ts +0 -705
  605. package/lib/cjs/serialization/GeometrySamples.d.ts.map +0 -1
  606. package/lib/cjs/serialization/GeometrySamples.js +0 -2433
  607. package/lib/cjs/serialization/GeometrySamples.js.map +0 -1
  608. package/lib/esm/serialization/GeometrySamples.d.ts +0 -705
  609. package/lib/esm/serialization/GeometrySamples.d.ts.map +0 -1
  610. package/lib/esm/serialization/GeometrySamples.js +0 -2428
  611. package/lib/esm/serialization/GeometrySamples.js.map +0 -1
@@ -1,2428 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module Serialization
7
- */
8
- import { BezierCurve3d } from "../bspline/BezierCurve3d";
9
- import { BezierCurve3dH } from "../bspline/BezierCurve3dH";
10
- import { BSplineCurve3d } from "../bspline/BSplineCurve";
11
- import { BSplineCurve3dH } from "../bspline/BSplineCurve3dH";
12
- import { BSplineSurface3d, BSplineSurface3dH, UVSelect, WeightStyle } from "../bspline/BSplineSurface";
13
- import { InterpolationCurve3d, InterpolationCurve3dOptions } from "../bspline/InterpolationCurve3d";
14
- import { BSplineWrapMode, KnotVector } from "../bspline/KnotVector";
15
- import { ClipPlane } from "../clipping/ClipPlane";
16
- import { ConvexClipPlaneSet } from "../clipping/ConvexClipPlaneSet";
17
- import { UnionOfConvexClipPlaneSets } from "../clipping/UnionOfConvexClipPlaneSets";
18
- import { Arc3d } from "../curve/Arc3d";
19
- import { CoordinateXYZ } from "../curve/CoordinateXYZ";
20
- import { CurveChainWithDistanceIndex } from "../curve/CurveChainWithDistanceIndex";
21
- import { BagOfCurves } from "../curve/CurveCollection";
22
- import { LineSegment3d } from "../curve/LineSegment3d";
23
- import { LineString3d } from "../curve/LineString3d";
24
- import { Loop } from "../curve/Loop";
25
- import { ParityRegion } from "../curve/ParityRegion";
26
- import { Path } from "../curve/Path";
27
- import { PointString3d } from "../curve/PointString3d";
28
- import { DirectSpiral3d } from "../curve/spiral/DirectSpiral3d";
29
- import { IntegratedSpiral3d } from "../curve/spiral/IntegratedSpiral3d";
30
- import { UnionRegion } from "../curve/UnionRegion";
31
- import { AxisOrder, Geometry } from "../Geometry";
32
- import { Angle } from "../geometry3d/Angle";
33
- import { AngleSweep } from "../geometry3d/AngleSweep";
34
- import { GrowableFloat64Array } from "../geometry3d/GrowableFloat64Array";
35
- import { GrowableXYZArray } from "../geometry3d/GrowableXYZArray";
36
- import { Matrix3d } from "../geometry3d/Matrix3d";
37
- import { Plane3dByOriginAndUnitNormal } from "../geometry3d/Plane3dByOriginAndUnitNormal";
38
- import { Plane3dByOriginAndVectors } from "../geometry3d/Plane3dByOriginAndVectors";
39
- import { Point2d, Vector2d } from "../geometry3d/Point2dVector2d";
40
- import { Point3d, Vector3d } from "../geometry3d/Point3dVector3d";
41
- import { Range1d, Range2d, Range3d } from "../geometry3d/Range";
42
- import { Ray3d } from "../geometry3d/Ray3d";
43
- import { Segment1d } from "../geometry3d/Segment1d";
44
- import { Transform } from "../geometry3d/Transform";
45
- import { Map4d } from "../geometry4d/Map4d";
46
- import { Matrix4d } from "../geometry4d/Matrix4d";
47
- import { Point4d } from "../geometry4d/Point4d";
48
- import { AuxChannel, AuxChannelData, PolyfaceAuxData } from "../polyface/AuxData";
49
- import { IndexedPolyface } from "../polyface/Polyface";
50
- import { PolyfaceBuilder } from "../polyface/PolyfaceBuilder";
51
- import { Box } from "../solid/Box";
52
- import { Cone } from "../solid/Cone";
53
- import { LinearSweep } from "../solid/LinearSweep";
54
- import { RotationalSweep } from "../solid/RotationalSweep";
55
- import { RuledSweep } from "../solid/RuledSweep";
56
- import { Sphere } from "../solid/Sphere";
57
- import { TorusPipe } from "../solid/TorusPipe";
58
- /**
59
- * Static methods to create functions of type SteppedIndexFunction
60
- * * Convention: constant value is optional last argument, with default value 0
61
- * @alpha
62
- */
63
- export class SteppedIndexFunctionFactory {
64
- /** Returns a callable function that returns a constant value. */
65
- static createConstant(value = 0) {
66
- return (_i, _n) => value;
67
- }
68
- /**
69
- * Return a function that steps linearly
70
- * * f(i,n) = y0 + (i/n) * a
71
- */
72
- static createLinear(a, f0 = 0) {
73
- return (i, n) => (f0 + a * (i / n));
74
- }
75
- /**
76
- * Return a function that steps with cosine of angles in sweep
77
- * * f(i,n) = y0 + amplitude * cos(i/n)
78
- */
79
- static createCosine(amplitude, sweep = AngleSweep.create360(), f0 = 0) {
80
- return (i, n) => (f0 + amplitude * Math.cos(sweep.fractionToRadians(i / n)));
81
- }
82
- /**
83
- * Return a function that steps with cosine of angles in sweep.
84
- * * f(i,n) = y0 + amplitude * sin(i/n)
85
- */
86
- static createSine(amplitude, sweep = AngleSweep.create360(), f0 = 0) {
87
- return (i, n) => (f0 + amplitude * Math.sin(sweep.fractionToRadians(i / n)));
88
- }
89
- }
90
- // cspell:word Franke bivariate
91
- /**
92
- * Implement Franke's function, a smooth bivariate real-valued function with interesting features over [0,1]x[0,1].
93
- * * This surface is commonly used to test interpolation algorithms. See https://www.sfu.ca/~ssurjano/franke2d.html
94
- * @internal
95
- */
96
- class FrankeSurface {
97
- scales;
98
- constructor(scales) {
99
- this.scales = scales;
100
- }
101
- exp0(u, v) {
102
- return Math.exp(-0.25 * (u * u + v * v) + u + v - 2);
103
- }
104
- exp1(u, v) {
105
- return Math.exp(-(((u + 1) * (u + 1)) / 49 + 0.1 * (v + 1)));
106
- }
107
- exp2(u, v) {
108
- return Math.exp(-0.25 * ((u - 7) * (u - 7) + (v - 3) * (v - 3)));
109
- }
110
- exp3(u, v) {
111
- return Math.exp(-((u - 4) * (u - 4) + (v - 7) * (v - 7)));
112
- }
113
- f(u, v) {
114
- const f0 = 0.75 * this.exp0(u, v);
115
- const f1 = 0.75 * this.exp1(u, v);
116
- const f2 = 0.5 * this.exp2(u, v);
117
- const f3 = -0.2 * this.exp3(u, v);
118
- if (this.scales !== undefined) {
119
- const numScale = this.scales.length;
120
- let f = 0;
121
- if (numScale >= 1)
122
- f += this.scales[0] * f0;
123
- if (numScale >= 2)
124
- f += this.scales[1] * f1;
125
- if (numScale >= 3)
126
- f += this.scales[2] * f2;
127
- if (numScale >= 4)
128
- f += this.scales[3] * f3;
129
- return f;
130
- }
131
- else
132
- return f0 + f1 + f2 + f3;
133
- }
134
- du(u, v) {
135
- const du0 = -3.375 * (u - 2) * this.exp0(u, v);
136
- const du1 = -(27 / 98) * (u + 1) * this.exp1(u, v);
137
- const du2 = -2.25 * (u - 7) * this.exp2(u, v);
138
- const du3 = 3.6 * (u - 4) * this.exp3(u, v);
139
- return du0 + du1 + du2 + du3;
140
- }
141
- dv(u, v) {
142
- const dv0 = -3.375 * (v - 2) * this.exp0(u, v);
143
- const dv1 = -0.675 * this.exp1(u, v);
144
- const dv2 = -2.25 * (v - 3) * this.exp2(u, v);
145
- const dv3 = 3.6 * (v - 7) * this.exp3(u, v);
146
- return dv0 + dv1 + dv2 + dv3;
147
- }
148
- uvFractionToPoint(uFraction, vFraction, result) {
149
- const u = 9 * uFraction;
150
- const v = 9 * vFraction;
151
- return Point3d.create(uFraction, vFraction, this.f(u, v), result);
152
- }
153
- uvFractionToPointAndTangents(uFraction, vFraction, result) {
154
- const u = 9 * uFraction;
155
- const v = 9 * vFraction;
156
- return Plane3dByOriginAndVectors.createOriginAndVectorsXYZ(uFraction, vFraction, this.f(u, v), 1, 0, this.du(u, v), 0, 1, this.dv(u, v), result);
157
- }
158
- }
159
- /**
160
- * `Sample` has static methods to create a variety of geometry samples useful in testing.
161
- * @alpha
162
- */
163
- export class Sample {
164
- /** Array with assorted Point2d samples */
165
- static point2d = [
166
- Point2d.create(0, 0),
167
- Point2d.create(1, 0),
168
- Point2d.create(0, 1),
169
- Point2d.create(2, 3)
170
- ];
171
- /** Array with assorted Point3d samples */
172
- static point3d = [
173
- Point3d.create(0, 0, 0),
174
- Point3d.create(1, 0, 0),
175
- Point3d.create(0, 1, 0),
176
- Point3d.create(0, 1, 0),
177
- Point3d.create(0, 0, 1),
178
- Point3d.create(2, 3, 0),
179
- Point3d.create(0, 2, 5),
180
- Point3d.create(-3, 0, 5),
181
- Point3d.create(4, 3, -2)
182
- ];
183
- /**
184
- * Return an array of Point3d, with x,y,z all stepping through a range of values.
185
- * x varies fastest, then y then z
186
- */
187
- static createPoint3dLattice(low, step, high) {
188
- const points = [];
189
- for (let z = low; z <= high; z += step)
190
- for (let y = low; y <= high; y += step)
191
- for (let x = low; x <= high; x += step)
192
- points.push(Point3d.create(x, y, z));
193
- return points;
194
- }
195
- /**
196
- * Return an array of Point2d, with x,y all stepping through a range of values.
197
- * x varies fastest, then y
198
- */
199
- static createPoint2dLattice(low, step, high) {
200
- const points = [];
201
- for (let y = low; y <= high; y += step)
202
- for (let x = low; x <= high; x += step)
203
- points.push(Point2d.create(x, y));
204
- return points;
205
- }
206
- /** Array with assorted Point4d samples */
207
- static point4d = [
208
- Point4d.create(0, 0, 0, 1),
209
- Point4d.create(1, 0, 0, 1),
210
- Point4d.create(0, 1, 0, 1),
211
- Point4d.create(0, 1, 0, 1),
212
- Point4d.create(0, 0, 1, 1),
213
- Point4d.create(2, 3, 0, 1),
214
- Point4d.create(0, 2, 5, 1),
215
- Point4d.create(-3, 0, 5, 1),
216
- Point4d.create(-3, 0, 5, 0.3),
217
- Point4d.create(-3, 0, 5, -0.2),
218
- Point4d.create(4, 3, -2, 1)
219
- ];
220
- /** Array with assorted nonzero vector samples. */
221
- static createNonZeroVectors() {
222
- return [
223
- Vector3d.create(1, 0, 0),
224
- Vector3d.create(0, 1, 0),
225
- Vector3d.create(0, 0, 1),
226
- Vector3d.create(-1, 0, 0),
227
- Vector3d.create(0, -1, 0),
228
- Vector3d.create(0, 0, -1),
229
- Vector3d.createPolar(1.0, Angle.createDegrees(20)),
230
- Vector3d.createSpherical(1.0, Angle.createDegrees(20), Angle.createDegrees(10)),
231
- Vector3d.createPolar(2.0, Angle.createDegrees(20)),
232
- Vector3d.createSpherical(2.0, Angle.createDegrees(20), Angle.createDegrees(10)),
233
- Vector3d.create(2, 3, 0),
234
- ];
235
- }
236
- /** Array with assorted nonzero Vector2d samples */
237
- static vector2d = [
238
- Vector2d.create(1, 0),
239
- Vector2d.create(0, 1),
240
- Vector2d.create(0, 0),
241
- Vector2d.create(-1, 0),
242
- Vector2d.create(0, -1),
243
- Vector2d.create(0, 0),
244
- Vector2d.createPolar(1.0, Angle.createDegrees(20)),
245
- Vector2d.createPolar(2.0, Angle.createDegrees(20)),
246
- Vector2d.create(2, 3),
247
- ];
248
- /** Return an array with assorted Range3d samples */
249
- static createRange3ds() {
250
- return [
251
- Range3d.createXYZXYZ(0, 0, 0, 1, 1, 1),
252
- Range3d.createXYZ(1, 2, 3),
253
- Range3d.createXYZXYZ(-2, -3, 1, 200, 301, 8),
254
- ];
255
- }
256
- /** Create 5 points of a (axis aligned) rectangle with corners (x0,y0) and (x0+ax, y0 + ay) */
257
- static createRectangleXY(x0, y0, ax, ay, z = 0) {
258
- return [
259
- Point3d.create(x0, y0, z),
260
- Point3d.create(x0 + ax, y0, z),
261
- Point3d.create(x0 + ax, y0 + ay, z),
262
- Point3d.create(x0, y0 + ay, z),
263
- Point3d.create(x0, y0, z),
264
- ];
265
- }
266
- /** Create 5 points of a (axis aligned) rectangle with corners (cx-ax,cy-ay) and (cx+ax,cy+ay) */
267
- static createCenteredRectangleXY(cx, cy, ax, ay, z = 0) {
268
- return this.createRectangleXY(cx - ax, cy - ay, 2 * ax, 2 * ay, z);
269
- }
270
- /**
271
- * Access the last point in the array. push another shifted by dx,dy,dz.
272
- * * No push if all are 0.
273
- * * If array is empty, push a leading 000
274
- */
275
- static pushMove(data, dx, dy, dz = 0.0) {
276
- if (data.length === 0)
277
- data.push(Point3d.create(0, 0, 0));
278
- const back = data[data.length - 1];
279
- if (dx !== 0 || dy !== 0 || dz !== 0)
280
- data.push(Point3d.create(back.x + dx, back.y + dy, back.z + dz));
281
- }
282
- /** Return an array with numPoints on the unit circle (counting closure) */
283
- static createUnitCircle(numPoints) {
284
- const points = [];
285
- const dTheta = Geometry.safeDivideFraction(Math.PI * 2, numPoints - 1, 0.0);
286
- for (let i = 0; i + 1 < numPoints; i++) {
287
- const theta = i * dTheta;
288
- points.push(Point3d.create(Math.cos(theta), Math.sin(theta), 0.0));
289
- }
290
- points.push(points[0].clone());
291
- return points;
292
- }
293
- /**
294
- * Create points for an L shaped polygon
295
- * * lower left at x0,y0.
296
- * * ax,ay are larger side lengths (lower left to corners along x and y directions)
297
- * * bx,by are smaller side lengths (inner corner to points along x and y directions)
298
- */
299
- static createLShapedPolygon(x0, y0, ax, ay, bx, by, z = 0) {
300
- return [
301
- Point3d.create(x0, y0, z),
302
- Point3d.create(x0 + ax, y0, z),
303
- Point3d.create(x0 + ax, y0 + by),
304
- Point3d.create(x0 + bx, y0 + by),
305
- Point3d.create(x0 + bx, y0 + ay, z),
306
- Point3d.create(x0, y0 + ay, z),
307
- Point3d.create(x0, y0, z),
308
- ];
309
- }
310
- /** Create assorted clip planes. */
311
- static createClipPlanes() {
312
- const plane0 = ClipPlane.createNormalAndDistance(Vector3d.create(1, 0, 0), 2.0);
313
- const plane1 = plane0.cloneNegated();
314
- const plane2 = plane1.clone();
315
- plane2.setFlags(true, true);
316
- return [
317
- plane0, plane1, plane2,
318
- ClipPlane.createNormalAndDistance(Vector3d.create(3, 4, 0), 2.0),
319
- ClipPlane.createEdgeXY(Point3d.create(1, 0, 0), Point3d.create(24, 32, 0)),
320
- ];
321
- }
322
- /**
323
- * * A first-quadrant unit square
324
- * * Two squares -- first and fourth quadrant unit squares
325
- * * Three squares -- first, second and fourth quadrant unit squares
326
- */
327
- static createClipPlaneSets() {
328
- const result = [];
329
- const quadrant1 = ConvexClipPlaneSet.createXYBox(0, 0, 1, 1);
330
- result.push(UnionOfConvexClipPlaneSets.createConvexSets([quadrant1.clone()]));
331
- const quadrant2 = ConvexClipPlaneSet.createXYBox(-1, 0, 0, 1);
332
- const quadrant4 = ConvexClipPlaneSet.createXYBox(0, -1, 1, 0);
333
- result.push(UnionOfConvexClipPlaneSets.createConvexSets([
334
- quadrant1.clone(),
335
- quadrant4.clone(),
336
- ]));
337
- result.push(UnionOfConvexClipPlaneSets.createConvexSets([
338
- quadrant1.clone(),
339
- quadrant2.clone(),
340
- quadrant4.clone(),
341
- ]));
342
- return result;
343
- }
344
- /**
345
- * Create (unweighted) bspline curves.
346
- * order varies from 2 to 5
347
- */
348
- static createBsplineCurves(includeMultipleKnots = false) {
349
- const result = [];
350
- const yScale = 0.1;
351
- for (const order of [2, 3, 4, 5]) {
352
- const points = [];
353
- for (const x of [0, 1, 2, 3, 4, 5, 7]) {
354
- points.push(Point3d.create(x, yScale * (1 + x * x), 0.0));
355
- }
356
- const curve = BSplineCurve3d.createUniformKnots(points, order);
357
- result.push(curve);
358
- }
359
- if (includeMultipleKnots) {
360
- const interiorKnotCandidates = [1, 2, 2, 3, 4, 5, 5, 6, 7, 7, 8];
361
- for (const order of [3, 4]) {
362
- const numPoints = 8;
363
- const points = [];
364
- for (let i = 0; i < numPoints; i++)
365
- points.push(Point3d.create(i, i * i, 0));
366
- const knots = [];
367
- for (let i = 0; i < order - 1; i++)
368
- knots.push(0);
369
- const numInteriorNeeded = numPoints - order;
370
- for (let i = 0; i < numInteriorNeeded; i++)
371
- knots.push(interiorKnotCandidates[i]);
372
- const lastKnot = knots[knots.length - 1] + 1;
373
- for (let i = 0; i < order - 1; i++)
374
- knots.push(lastKnot);
375
- const curve = BSplineCurve3d.create(points, knots, order);
376
- if (curve)
377
- result.push(curve);
378
- }
379
- }
380
- return result;
381
- }
382
- /**
383
- * Create weighted bspline curves.
384
- * order varies from 2 to 5
385
- */
386
- static createBspline3dHCurves() {
387
- const result = [];
388
- const yScale = 0.1;
389
- for (const weightVariation of [0, 0.125]) {
390
- for (const order of [2, 3, 4, 5]) {
391
- const points = [];
392
- for (const x of [0, 1, 2, 3, 4, 5, 7]) {
393
- points.push(Point4d.create(x, yScale * (1 + x * x), 0.0, 1.0 + weightVariation * Math.sin(x * Math.PI * 0.25)));
394
- }
395
- const curve = BSplineCurve3dH.createUniformKnots(points, order);
396
- result.push(curve);
397
- }
398
- }
399
- return result;
400
- }
401
- /** Create various orders of non-rational B-spline curves with helical poles. */
402
- static createBsplineCurveHelices(radius, height, numTurns, numSamplesPerTurn) {
403
- const pts = [];
404
- const zDelta = (height / numTurns) / numSamplesPerTurn;
405
- const aDelta = 2 * Math.PI / numSamplesPerTurn;
406
- for (let iTurn = 0; iTurn < numTurns; ++iTurn) {
407
- for (let iSample = 0; iSample < numSamplesPerTurn; iSample++) {
408
- pts.push(Point3d.create(radius * Math.cos(iSample * aDelta), radius * Math.sin(iSample * aDelta), pts.length * zDelta));
409
- }
410
- }
411
- const result = [];
412
- for (const order of [2, 3, 4, 9, 16, 25]) {
413
- if (order > pts.length)
414
- continue;
415
- const curve = BSplineCurve3d.createUniformKnots(pts, order);
416
- if (curve !== undefined)
417
- result.push(curve);
418
- }
419
- return result;
420
- }
421
- /** Create weighted bsplines for circular arcs. */
422
- static createBspline3dHArcs() {
423
- const result = [];
424
- const halfRadians = Angle.degreesToRadians(60.0);
425
- const c = Math.cos(halfRadians);
426
- const s = Math.sin(halfRadians);
427
- // const sec = 1.0 / c;
428
- // const t = s / c;
429
- const points = [
430
- Point4d.create(1, 0, 0, 1),
431
- Point4d.create(c, s, 0, c),
432
- Point4d.create(-c, s, 0, 1),
433
- Point4d.create(-1, 0, 0, c),
434
- Point4d.create(-c, -s, 0, 1),
435
- Point4d.create(c, -s, 0, c),
436
- Point4d.create(1, 0, 0, 1),
437
- ];
438
- const knots = [0, 0, 1, 1, 2, 2, 3, 3];
439
- const curve = BSplineCurve3dH.create(points, knots, 3);
440
- result.push(curve);
441
- return result;
442
- }
443
- /**
444
- * Return array [x,y,z,w] bspline control points for an arc in 90 degree bspline spans.
445
- * @param points array of [x,y,z,w]
446
- * @param center center of arc
447
- * @param axes matrix with 0 and 90 degree axes
448
- * @param radius0 radius multiplier for x direction.
449
- * @param radius90 radius multiplier for y direction.
450
- * @param applyWeightsToXYZ
451
- */
452
- static createBsplineArc90SectionToXYZWArrays(center, axes, radius0, radius90, applyWeightsToXYZ) {
453
- const a = Math.sqrt(0.5);
454
- const xyz = Point3d.create();
455
- Matrix3d.xyzPlusMatrixTimesCoordinates(center, axes, radius0, 0.0, 0, xyz);
456
- const controlPoints = [];
457
- controlPoints.push([xyz.x, xyz.y, xyz.z, 1.0]);
458
- const cornerTrig = [1, 1, -1, -1, 1];
459
- const axisTrig = [1, 0, -1, 0, 1];
460
- for (let i = 0; i < 4; i++) {
461
- Matrix3d.xyzPlusMatrixTimesCoordinates(center, axes, radius0 * cornerTrig[i + 1], radius90 * cornerTrig[i], 0, xyz);
462
- controlPoints.push([xyz.x, xyz.y, xyz.z, a]);
463
- Matrix3d.xyzPlusMatrixTimesCoordinates(center, axes, radius0 * axisTrig[i + 1], radius90 * axisTrig[i], 0, xyz);
464
- controlPoints.push([xyz.x, xyz.y, xyz.z, 1.0]);
465
- }
466
- if (applyWeightsToXYZ) {
467
- for (const xyzw of controlPoints) {
468
- const b = xyzw[3];
469
- xyzw[0] *= b;
470
- xyzw[1] *= b;
471
- xyzw[2] *= b;
472
- }
473
- }
474
- return controlPoints;
475
- }
476
- /**
477
- * Create both unweighted and weighted bspline curves.
478
- * (This is the combined results from createBsplineCurves and createBspline3dHCurves)
479
- */
480
- static createMixedBsplineCurves() {
481
- const arrayA = Sample.createBsplineCurves();
482
- const arrayB = Sample.createBspline3dHCurves();
483
- const result = [];
484
- for (const a of arrayA)
485
- result.push(a);
486
- for (const b of arrayB)
487
- result.push(b);
488
- return result;
489
- }
490
- /** Create a plane from origin and normal coordinates -- default to 001 normal if needed. */
491
- static createPlane(x, y, z, u, v, w) {
492
- const point = Point3d.create(x, y, z);
493
- const vector = Vector3d.create(u, v, w).normalize();
494
- if (vector) {
495
- const plane = Plane3dByOriginAndUnitNormal.create(point, vector);
496
- if (plane)
497
- return plane;
498
- }
499
- return Sample.createPlane(x, y, z, u, v, 1);
500
- }
501
- /** Create ray from (x,y,z) and direction components. (Normalize the direction) */
502
- static createRay(x, y, z, u, v, w) {
503
- return Ray3d.create(Point3d.create(x, y, z), Vector3d.create(u, v, w).normalize());
504
- }
505
- /** Assorted Plane3dBYOriginAndUnitNormal */
506
- static plane3dByOriginAndUnitNormal = [
507
- Plane3dByOriginAndUnitNormal.createXYPlane(),
508
- Plane3dByOriginAndUnitNormal.createYZPlane(),
509
- Plane3dByOriginAndUnitNormal.createZXPlane(),
510
- Sample.createPlane(0, 0, 0, 3, 0, 1),
511
- Sample.createPlane(1, 2, 3, 2, 4, -1),
512
- ];
513
- /** Assorted Ray3d, not all unit direction vectors. */
514
- static ray3d = [
515
- Sample.createRay(0, 0, 0, 1, 0, 0),
516
- Sample.createRay(0, 0, 0, 0, 1, 0),
517
- Sample.createRay(0, 0, 0, 0, 0, 1),
518
- Sample.createRay(0, 0, 0, 1, 2, 0),
519
- Sample.createRay(1, 2, 3, 4, 2, -1),
520
- ];
521
- /** Assorted angles. All principal directions, some others included. */
522
- static angle = [
523
- Angle.createDegrees(0),
524
- Angle.createDegrees(90),
525
- Angle.createDegrees(180),
526
- Angle.createDegrees(-90),
527
- Angle.createDegrees(30),
528
- Angle.createDegrees(-105),
529
- ];
530
- /** Assorted angle sweeps */
531
- static angleSweep = [
532
- AngleSweep.createStartEndDegrees(0, 90),
533
- AngleSweep.createStartEndDegrees(0, 180),
534
- AngleSweep.createStartEndDegrees(-90, 0),
535
- AngleSweep.createStartEndDegrees(0, -90),
536
- AngleSweep.createStartEndDegrees(0, 30),
537
- AngleSweep.createStartEndDegrees(45, 110),
538
- ];
539
- /** Assorted line segments */
540
- static lineSegment3d = [
541
- LineSegment3d.create(Point3d.create(0, 0, 0), Point3d.create(1, 0, 0)),
542
- LineSegment3d.create(Point3d.create(0, 0, 0), Point3d.create(0, 1, 0)),
543
- LineSegment3d.create(Point3d.create(0, 0, 0), Point3d.create(0, 0, 1)),
544
- LineSegment3d.create(Point3d.create(1, 2, 3), Point3d.create(-2, -3, 0.5)),
545
- ];
546
- /** Assorted lines strings */
547
- static createLineStrings() {
548
- return [
549
- LineString3d.createPoints([
550
- Point3d.create(0, 0, 0),
551
- Point3d.create(1, 0, 0),
552
- ]),
553
- LineString3d.createPoints([
554
- Point3d.create(0, 0, 0),
555
- Point3d.create(1, 0, 0),
556
- Point3d.create(1, 1, 0),
557
- ]),
558
- LineString3d.createPoints([
559
- Point3d.create(0, 0, 0),
560
- Point3d.create(1, 0, 0),
561
- Point3d.create(1, 1, 0),
562
- Point3d.create(2, 2, 0),
563
- ]),
564
- ];
565
- }
566
- /** Assorted Range1d: single point, null, simple forward, simple reverse */
567
- static range1d = [
568
- Range1d.createX(1),
569
- Range1d.createNull(),
570
- Range1d.createXX(1, 2),
571
- Range1d.createXX(2, 1),
572
- ];
573
- /** Assorted range2d: single point, null, 2 point with various creation orders. */
574
- static range2d = [
575
- Range2d.createXY(1, 2),
576
- Range2d.createNull(),
577
- Range2d.createXYXY(1, 2, 0, 3),
578
- Range2d.createXYXY(1, 2, 3, 4),
579
- ];
580
- /** Assorted range2d: single point, null, 2 point with various creation orders. */
581
- static range3d = [
582
- Range3d.createXYZ(1, 2, 3),
583
- Range3d.createNull(),
584
- Range3d.createXYZXYZ(1, 2, 0, 3, 4, 7),
585
- Range3d.createXYZXYZ(1, 2, 3, -2, -4, -1),
586
- ];
587
- /**
588
- * Assorted Matrix3d:
589
- * * identity
590
- * * rotation around x
591
- * * rotation around general vector
592
- * * uniform scale
593
- * * nonuniform scale (including negative scales!)
594
- */
595
- static createMatrix3dArray() {
596
- return [
597
- Matrix3d.createIdentity(),
598
- Matrix3d.createRotationAroundVector(Vector3d.create(1, 0, 0), Angle.createDegrees(10)),
599
- Matrix3d.createRotationAroundVector(Vector3d.create(1, -2, 5), Angle.createDegrees(-6.0)),
600
- Matrix3d.createRotationAroundVector(Vector3d.create(1, 2, 3), Angle.createDegrees(49.0)),
601
- Matrix3d.createUniformScale(2.0),
602
- Matrix3d.createScale(1, 1, -1),
603
- Matrix3d.createScale(2, 3, 4),
604
- ];
605
- }
606
- /** Assorted invertible transforms. */
607
- static createInvertibleTransforms() {
608
- return [
609
- Transform.createIdentity(),
610
- Transform.createTranslationXYZ(1, 2, 0),
611
- Transform.createTranslationXYZ(1, 2, 3),
612
- Transform.createFixedPointAndMatrix(Point3d.create(4, 1, -2), Matrix3d.createUniformScale(2.0)),
613
- Transform.createFixedPointAndMatrix(Point3d.create(4, 1, -2), Matrix3d.createRotationAroundVector(Vector3d.create(1, 2, 3), Angle.createRadians(10))),
614
- ];
615
- }
616
- /**
617
- * Return an array of Matrix3d with various skew and scale. This includes at least:
618
- * * identity
619
- * * 3 distinct diagonals.
620
- * * The distinct diagonal base with smaller value added to other 6 spots in succession.
621
- * * the distinct diagonals with all others also smaller non-zeros.
622
- */
623
- static createScaleSkewMatrix3d() {
624
- return [
625
- Matrix3d.createRowValues(1, 0, 0, 0, 1, 0, 0, 0, 1),
626
- Matrix3d.createRowValues(5, 0, 0, 0, 6, 0, 0, 0, 7),
627
- Matrix3d.createRowValues(5, 2, 0, 0, 6, 0, 0, 0, 7),
628
- Matrix3d.createRowValues(5, 0, 2, 0, 6, 0, 0, 0, 7),
629
- Matrix3d.createRowValues(5, 0, 0, 1, 6, 0, 0, 0, 7),
630
- Matrix3d.createRowValues(5, 0, 0, 0, 6, 1, 0, 0, 7),
631
- Matrix3d.createRowValues(5, 0, 0, 0, 6, 0, 1, 0, 7),
632
- Matrix3d.createRowValues(5, 0, 0, 0, 6, 0, 0, 1, 7),
633
- Matrix3d.createRowValues(5, 2, 3, 2, 6, 1, -1, 2, 7),
634
- ];
635
- }
636
- /**
637
- * Return an array of singular Matrix3d. This includes at least:
638
- * * all zeros
639
- * * one non-zero column
640
- * * two independent columns, third is zero
641
- * * two independent columns, third is sum of those
642
- * * two independent columns, third is copy of one
643
- */
644
- static createSingularMatrix3d() {
645
- const vectorU = Vector3d.create(2, 3, 6);
646
- const vectorV = Vector3d.create(-1, 5, 2);
647
- const vectorUPlusV = vectorU.plus(vectorV);
648
- const vector0 = Vector3d.createZero();
649
- return [
650
- Matrix3d.createZero(),
651
- // one non-zero column
652
- Matrix3d.createColumns(vectorU, vector0, vector0),
653
- Matrix3d.createColumns(vector0, vectorU, vector0),
654
- Matrix3d.createColumns(vector0, vector0, vectorU),
655
- // two independent non-zero columns with one zero column
656
- Matrix3d.createColumns(vectorU, vectorV, vector0),
657
- Matrix3d.createColumns(vector0, vectorU, vectorV),
658
- Matrix3d.createColumns(vectorU, vector0, vectorV),
659
- // two independent columns with one dependent column
660
- Matrix3d.createColumns(vectorU, vectorV, vectorUPlusV),
661
- Matrix3d.createColumns(vectorU, vectorUPlusV, vectorV),
662
- Matrix3d.createColumns(vectorUPlusV, vectorU, vectorV),
663
- // two independent with columns with one duplicate column
664
- Matrix3d.createColumns(vectorU, vectorU, vectorV),
665
- Matrix3d.createColumns(vectorU, vectorV, vectorU),
666
- Matrix3d.createColumns(vectorV, vectorU, vectorU),
667
- ];
668
- }
669
- /**
670
- * Return an array of rigid transforms. This includes (at least)
671
- * * Identity
672
- * * translation with identity matrix
673
- * * rotation around origin and arbitrary vector
674
- * * rotation around space point and arbitrary vector
675
- * * use given refDistance is crude distance of translation and distance to fixed point.
676
- */
677
- static createRigidTransforms(distanceScale = 4.0) {
678
- const distanceScale3 = distanceScale / 3.0;
679
- const distanceScale4 = distanceScale / 4.0;
680
- return [
681
- Transform.createIdentity(),
682
- Transform.createTranslationXYZ(distanceScale3 * 1, distanceScale3 * 2, distanceScale3 * 3),
683
- Transform.createFixedPointAndMatrix(Point3d.create(0, 0, 0), Matrix3d.createRotationAroundVector(Vector3d.unitY(), Angle.createDegrees(10))),
684
- Transform.createFixedPointAndMatrix(Point3d.create(distanceScale4 * 4, distanceScale4 * 1, -distanceScale4 * 2), Matrix3d.createRotationAroundVector(Vector3d.create(1, 2, 3), Angle.createDegrees(10))),
685
- Transform.createFixedPointAndMatrix(Point3d.create(distanceScale4 * 4, distanceScale4 * 1, -distanceScale4 * 2), Matrix3d.createRotationAroundVector(Vector3d.create(-2, 1, 4), Angle.createDegrees(35))),
686
- ];
687
- }
688
- /** Return a single rigid transform with all terms nonzero. */
689
- static createMessyRigidTransform(fixedPoint) {
690
- return Transform.createFixedPointAndMatrix(fixedPoint ? fixedPoint : Point3d.create(1, 2, 3), Matrix3d.createRotationAroundVector(Vector3d.create(0.3, -0.2, 1.2), Angle.createDegrees(15.7)));
691
- }
692
- /**
693
- * Return various rigid matrices:
694
- * * identity
695
- * * small rotations around x, y, z
696
- * * small rotation around (1,2,3)
697
- */
698
- static createRigidAxes() {
699
- return [
700
- Matrix3d.createIdentity(),
701
- Matrix3d.createRotationAroundVector(Vector3d.unitX(), Angle.createDegrees(10)),
702
- Matrix3d.createRotationAroundVector(Vector3d.unitY(), Angle.createDegrees(10)),
703
- Matrix3d.createRotationAroundVector(Vector3d.unitZ(), Angle.createDegrees(10)),
704
- Matrix3d.createRotationAroundVector(Vector3d.create(1, 2, 3), Angle.createDegrees(10)),
705
- ];
706
- }
707
- /**
708
- * Return various Matrix4d
709
- * * Simple promotion of each Sample.createInvertibleTransforms ()
710
- * * optional nasty [1,2,3,4...15] row order
711
- * @param includeIrregular if true, include [1,2,..15] row major
712
- */ // promote each transform[] to a Matrix4d.
713
- static createMatrix4ds(includeIrregular = false) {
714
- const result = [];
715
- let transform;
716
- for (transform of Sample.createInvertibleTransforms())
717
- result.push(Matrix4d.createTransform(transform));
718
- if (includeIrregular) {
719
- result.push(Matrix4d.createRowValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16));
720
- }
721
- return result;
722
- }
723
- /** Create full Map4d for each `Sample.createInvertibleTransforms()` */
724
- static createMap4ds() {
725
- const result = [];
726
- let transform;
727
- for (transform of Sample.createInvertibleTransforms()) {
728
- const inverse = transform.inverse();
729
- if (inverse) {
730
- const map = Map4d.createTransform(transform, inverse);
731
- if (map)
732
- result.push(map);
733
- }
734
- }
735
- return result;
736
- }
737
- /** Assorted simple `Path` objects. */
738
- static createSimplePaths(withGaps = false) {
739
- const point0 = Point3d.create(0, 0, 0);
740
- const point1 = Point3d.create(10, 0, 0);
741
- const p1 = [
742
- point1, Point3d.create(0, 10, 0),
743
- Point3d.create(6, 10, 0),
744
- Point3d.create(6, 10, 0),
745
- Point3d.create(0, 10, 0),
746
- ];
747
- const segment1 = LineSegment3d.create(point0, point1);
748
- const vectorU = Vector3d.unitX(3);
749
- const vectorV = Vector3d.unitY(3);
750
- const arc2 = Arc3d.create(point1.minus(vectorU), vectorU, vectorV, AngleSweep.createStartEndDegrees(0, 90));
751
- const simplePaths = [
752
- Path.create(segment1),
753
- Path.create(segment1, arc2),
754
- Path.create(LineSegment3d.create(point0, point1), LineString3d.create(p1)),
755
- Sample.createCappedArcPath(4, 0, 180),
756
- ];
757
- if (withGaps)
758
- simplePaths.push(Path.create(LineSegment3d.create(Point3d.create(0, 0, 0), Point3d.create(10, 0, 0)), LineSegment3d.create(Point3d.create(10, 10, 0), Point3d.create(5, 0, 0))));
759
- return simplePaths;
760
- }
761
- /**
762
- * Assorted `Path` with lines and arcs.
763
- * Specifically useful for offset tests.
764
- */
765
- static createLineArcPaths() {
766
- const paths = [];
767
- const x1 = 10.0;
768
- const y2 = 5.0;
769
- const y3 = 10.0;
770
- for (const y0 of [0, -1, 1]) {
771
- for (const x2 of [15, 11, 20, 9, 7]) {
772
- const point0 = Point3d.create(0, y0, 0);
773
- const point1 = Point3d.create(x1, 0, 0);
774
- const point2 = Point3d.create(x2, y2, 0);
775
- const point3 = Point3d.create(x1, y3, 0);
776
- const point4 = Point3d.create(0, y3 + y0, 0);
777
- const path0 = Path.create();
778
- path0.tryAddChild(LineString3d.create(point0, point1, point2, point3, point4));
779
- paths.push(path0);
780
- const path1 = Path.create();
781
- path1.tryAddChild(LineSegment3d.create(point0, point1));
782
- path1.tryAddChild(Arc3d.createCircularStartMiddleEnd(point1, Point3d.create(x2, y2, 0), point3));
783
- path1.tryAddChild(LineSegment3d.create(point3, point4));
784
- paths.push(path1);
785
- }
786
- }
787
- return paths;
788
- }
789
- /** Assorted `PointString3d` objects. */
790
- static createSimplePointStrings() {
791
- const p1 = [
792
- [Point3d.create(0, 10, 0)],
793
- [Point3d.create(6, 10, 0)],
794
- [Point3d.create(6, 10, 0), [Point3d.create(6, 10, 0)]],
795
- ];
796
- const simplePaths = [
797
- PointString3d.create(Point3d.create(1, 2, 0)),
798
- PointString3d.create(Point3d.create(0, 0, 0), Point3d.create(10, 0, 0)),
799
- PointString3d.create(Point3d.create(10, 0, 0), Point3d.create(10, 5, 0)),
800
- PointString3d.create(p1),
801
- ];
802
- return simplePaths;
803
- }
804
- /** Assorted `Loop` objects */
805
- static createSimpleLoops() {
806
- const point0 = Point3d.create(0, 0, 0);
807
- const point1 = Point3d.create(10, 0, 0);
808
- const point2 = Point3d.create(10, 5, 0);
809
- const point3 = Point3d.create(0, 5, 0);
810
- const result = [
811
- // rectangle with single linestring
812
- Loop.create(LineString3d.create(point0, point1, point2, point3, point0)),
813
- // unit circle
814
- Loop.create(Arc3d.createUnitCircle()),
815
- // rectangle, but with individual line segments
816
- Loop.create(LineSegment3d.create(point0, point1), LineSegment3d.create(point1, point2), LineSegment3d.create(point2, point3), LineSegment3d.create(point3, point0)),
817
- // Semicircle
818
- Sample.createCappedArcLoop(4, -90, 90),
819
- ];
820
- return result;
821
- }
822
- /**
823
- * Create a square wave along x direction
824
- * @param dx0 distance along x axis at y=0
825
- * @param dy vertical rise
826
- * @param dx1 distance along x axis at y=dy
827
- * @param numPhase number of phases of the jump.
828
- * @param dyReturn y value for return to origin. If 0, the wave ends at y=0 after then final "down" with one extra horizontal dx0
829
- * If nonzero, rise to that y value, return to x=0, and return down to origin.
830
- */
831
- static createSquareWave(origin, dx0, dy, dx1, numPhase, dyReturn) {
832
- const result = [origin.clone()];
833
- for (let i = 0; i < numPhase; i++) {
834
- this.pushMove(result, dx0, 0);
835
- this.pushMove(result, 0, dy);
836
- this.pushMove(result, dx1, 0);
837
- this.pushMove(result, 0, -dy);
838
- }
839
- this.pushMove(result, dx0, 0);
840
- if (dyReturn !== 0.0) {
841
- this.pushMove(result, 0, dyReturn);
842
- result.push(Point3d.create(origin.x, origin.y + dyReturn));
843
- result.push(result[0].clone());
844
- }
845
- return result;
846
- }
847
- /**
848
- * Create multiple interpolated points between two points
849
- * @param point0 start point (at fraction0)
850
- * @param point1 end point (at fraction1)
851
- * @param numPoints total number of points. This is force to at least 2.
852
- * @param result optional existing array to receive points.
853
- * @param index0 optional index of first point. Default is 0.
854
- * @param index1 optional index of final point. Default is numPoints
855
- */
856
- static createInterpolatedPoints(point0, point1, numPoints, result, index0, index1) {
857
- if (numPoints < 2)
858
- numPoints = 2;
859
- if (result === undefined)
860
- result = [];
861
- if (index0 === undefined)
862
- index0 = 0;
863
- if (index1 === undefined)
864
- index1 = numPoints;
865
- for (let i = index0; i <= index1; i++) {
866
- result.push(point0.interpolate(i / numPoints, point1));
867
- }
868
- return result;
869
- }
870
- /**
871
- * Append numPhase teeth. Each tooth starts with dxLow dwell at initial y, then sloped rise, then dwell at top, then sloped fall
872
- * * If no points are present, start with 000. (this happens in pushMove) Otherwise start from final point.
873
- * * return points array reference.
874
- * @param points point array to receive points
875
- * @param dxLow starting step along x direction
876
- * @param riseX width of rising and falling parts
877
- * @param riseY height of rise
878
- * @param dxHigh width at top
879
- * @param numPhase number of phases.
880
- */
881
- static appendSawTooth(points, dxLow, riseX, riseY, dxHigh, numPhase) {
882
- for (let i = 0; i < numPhase; i++) {
883
- this.pushMove(points, dxLow, 0, 0);
884
- this.pushMove(points, riseX, riseY, 0);
885
- this.pushMove(points, dxHigh, 0, 0);
886
- this.pushMove(points, riseX, -riseY, 0);
887
- }
888
- return points;
889
- }
890
- /** Append sawtooth with x distances successively scaled by xFactor */
891
- static appendVariableSawTooth(points, dxLow, riseX, riseY, dxHigh, numPhase, xFactor) {
892
- let factor = 1.0;
893
- for (let i = 0; i < numPhase; i++) {
894
- this.appendSawTooth(points, factor * dxLow, factor * riseX, riseY, factor * dxHigh, 1);
895
- factor *= xFactor;
896
- }
897
- return points;
898
- }
899
- /**
900
- * Create a pair of sawtooth patterns, one (nominally) outbound and up, the other inbound and down.
901
- * * return phase count adjusted to end at start x
902
- * * enter return dx values as lengths -- sign will be negated in construction.
903
- * @param origin start of entire path.
904
- * @param dxLow low outbound dwell
905
- * @param riseX x part of outbound rise and fall
906
- * @param riseY y part of outbound rise and fall
907
- * @param dxHigh high outbound dwell
908
- * @param numPhaseOutbound number of phases outbound. Final phase followed by dxLow dwell.
909
- * @param dyFinal rise after final dwell.
910
- * @param dxLowReturn dwell at return high
911
- * @param riseXReturn rise x part of return
912
- * @param riseYReturn rise y part of return
913
- * @param dxHighReturn dwell at return high
914
- */
915
- static createBidirectionalSawtooth(origin, dxLow, riseX, riseY, dxHigh, numPhaseOutbound, dyFinal, dxLowReturn, riseXReturn, riseYReturn, dxHighReturn) {
916
- const data = [origin.clone()];
917
- const x0 = data[0].x;
918
- this.appendSawTooth(data, dxLow, riseX, riseY, dxHigh, numPhaseOutbound);
919
- this.pushMove(data, dxLow, 0, 0);
920
- this.pushMove(data, 0, dyFinal);
921
- const x1 = data[data.length - 1].x;
922
- const returnPhase = Math.abs(dxLowReturn + 2 * riseXReturn + dxHighReturn);
923
- const totalDX = Math.abs(x1 - x0);
924
- const numReturnPhase = Math.floor(Math.abs(totalDX / returnPhase));
925
- this.appendSawTooth(data, -dxLowReturn, -riseXReturn, riseYReturn, -dxHighReturn, numReturnPhase);
926
- const x2 = data[data.length - 1].x;
927
- this.pushMove(data, x0 - x2, 0, 0);
928
- data.push(data[0].clone());
929
- return data;
930
- }
931
- /**
932
- * Append to a linestring, taking steps along given vector directions
933
- * If the linestring is empty, a 000 point is added.
934
- * @param linestring LineString3d to receive points.
935
- * @param numPhase number of phases of the sawtooth
936
- * @param vectors any number of vector steps.
937
- */
938
- static appendPhases(linestring, numPhase, ...vectors) {
939
- const tailPoint = linestring.endPoint(); // and this defaults to 000 . ..
940
- if (linestring.numPoints() === 0)
941
- linestring.addPoint(tailPoint);
942
- for (let i = 0; i < numPhase; i++) {
943
- for (const v of vectors) {
944
- tailPoint.addInPlace(v);
945
- linestring.addPoint(tailPoint);
946
- }
947
- }
948
- }
949
- /**
950
- * Assorted regions with arc boundaries
951
- * * full circle
952
- * * with varying sweep:
953
- * * partial arc with single chord closure
954
- * * partial arc with 2-edge closure via center
955
- */
956
- static createArcRegions() {
957
- const result = [];
958
- const center = Point3d.create(0, 0, 0);
959
- for (const sweep of [
960
- AngleSweep.createStartEndDegrees(0, 360),
961
- AngleSweep.createStartEndDegrees(-20, 20),
962
- AngleSweep.createStartEndDegrees(0, 90),
963
- AngleSweep.createStartEndDegrees(0, 180),
964
- ]) {
965
- const arc0 = Arc3d.createXY(Point3d.create(0, 0), 2.0, sweep);
966
- if (arc0.sweep.isFullCircle) {
967
- result.push(Loop.create(arc0));
968
- }
969
- else {
970
- const chord = LineSegment3d.create(arc0.endPoint(), arc0.startPoint());
971
- result.push(Loop.create(arc0, chord));
972
- result.push(Loop.create(arc0, LineString3d.create(arc0.endPoint(), center, arc0.startPoint())));
973
- }
974
- }
975
- return result;
976
- }
977
- /**
978
- * Assorted loops in xy plane:
979
- * * unit square
980
- * * rectangle
981
- * * L shape
982
- */
983
- static createSimpleXYPointLoops() {
984
- const result = [];
985
- result.push(Sample.createRectangleXY(0, 0, 1, 1));
986
- result.push(Sample.createRectangleXY(0, 0, 4, 3));
987
- result.push(Sample.createLShapedPolygon(0, 0, 5, 4, 1, 2));
988
- return result;
989
- }
990
- /** Assorted `ParityRegion` objects */
991
- static createSimpleParityRegions(includeBCurves = false) {
992
- const pointC = Point3d.create(-5, 0, 0);
993
- const point0 = Point3d.create(0, 0, 0);
994
- const point1 = Point3d.create(4, 2, 0);
995
- const point2 = Point3d.create(6, 4, 0);
996
- const point3 = Point3d.create(5, 5, 0);
997
- const point4 = Point3d.create(8, 3, 0);
998
- const reverseSweep = AngleSweep.createStartEndDegrees(0, -360);
999
- const ax = 10.0;
1000
- const ay = 8.0;
1001
- const bx = -3.0;
1002
- const by = 2.0;
1003
- const r2 = 0.5;
1004
- const r2A = 2.5;
1005
- const pointA = point0.plusXYZ(ax, 0, 0);
1006
- const pointB = pointA.plusXYZ(0, ay, 0);
1007
- const pointC1 = point0.plusXYZ(0, ay);
1008
- const result = [
1009
- ParityRegion.create(Loop.create(LineString3d.create(point0, pointA, pointB), Arc3d.createCircularStartMiddleEnd(pointB, pointC1, point0)), Loop.create(LineString3d.createRectangleXY(point1, bx, by))),
1010
- ParityRegion.create(Loop.create(Arc3d.createXY(pointC, 2.0)), Loop.create(Arc3d.createXY(pointC, 1.0, reverseSweep))),
1011
- ParityRegion.create(Loop.create(LineString3d.createRectangleXY(point0, ax, ay)), Loop.create(LineString3d.createRectangleXY(point1, bx, by))),
1012
- ParityRegion.create(Loop.create(LineString3d.createRectangleXY(point0, ax, ay)), Loop.create(LineString3d.createRectangleXY(point1, bx, by)), Loop.create(Arc3d.createXY(point2, r2, reverseSweep))),
1013
- ParityRegion.create(Loop.create(LineString3d.createRectangleXY(point0, ax, ay)), Loop.create(LineString3d.createRectangleXY(point1, bx, by)), Loop.create(Arc3d.createXY(point2, r2, reverseSweep)), Loop.create(LineString3d.createRectangleXY(point3, bx, by))),
1014
- ParityRegion.create(Loop.create(LineString3d.create(point0, pointA, pointB), Arc3d.createCircularStartMiddleEnd(pointB, pointC1, point0)), Loop.create(LineString3d.createRectangleXY(point1, bx, by)), Loop.create(Arc3d.create(point4, Vector3d.create(-r2, 0), Vector3d.create(0, r2A))), Loop.create(LineString3d.createRectangleXY(point3, bx, by))),
1015
- ];
1016
- if (includeBCurves) {
1017
- const ey = 1.0;
1018
- result.push(ParityRegion.create(Loop.create(LineSegment3d.create(point0, pointA), BSplineCurve3d.createUniformKnots([
1019
- pointA,
1020
- Point3d.create(ax + 1, ey),
1021
- Point3d.create(ax + 1, 2 * ey),
1022
- Point3d.create(ax + 2, 3 * ey),
1023
- Point3d.create(ax + 1, 4 * ey),
1024
- pointB,
1025
- ], 3), Arc3d.createCircularStartMiddleEnd(pointB, pointC1, point0))));
1026
- }
1027
- return result;
1028
- }
1029
- /** Union region. */
1030
- static createSimpleUnions() {
1031
- const parityRegions = Sample.createSimpleParityRegions();
1032
- const parityRange = parityRegions[0].range();
1033
- const ax = 3.0;
1034
- const ay = 1.0;
1035
- const bx = 4.0;
1036
- const by = 2.0;
1037
- const result = [
1038
- UnionRegion.create(Loop.create(LineString3d.createRectangleXY(Point3d.create(0, 0, 0), ax, ay)), Loop.create(LineString3d.createRectangleXY(Point3d.create(0, 2 * ay, 0), bx, by))),
1039
- UnionRegion.create(Loop.create(LineString3d.create(Sample.createRectangleXY(parityRange.low.x, parityRange.high.y + 0.5, parityRange.xLength(), parityRange.yLength()))), parityRegions[0]),
1040
- ];
1041
- return result;
1042
- }
1043
- /** Assorted unstructured curve sets. */
1044
- static createBagOfCurves() {
1045
- const parityRegions = Sample.createSimpleParityRegions();
1046
- const loops = Sample.createSimpleLoops();
1047
- const result = [
1048
- BagOfCurves.create(loops[0], parityRegions[0], LineSegment3d.createXYXY(0, 1, 4, 2, 1)),
1049
- // a bag with just an arc
1050
- BagOfCurves.create(Arc3d.createUnitCircle()),
1051
- // a bag with just a line segment
1052
- BagOfCurves.create(LineSegment3d.create(Point3d.create(0, 0, 0), Point3d.create(1, 1, 0))),
1053
- // a bag with just a linestring
1054
- BagOfCurves.create(LineString3d.create(Point3d.create(0, 0, 0), Point3d.create(1, 1, 0), Point3d.create(2, 1, 0))),
1055
- ];
1056
- return result;
1057
- }
1058
- /**
1059
- * Assorted smooth curve primitives:
1060
- * * line segments
1061
- * * arcs
1062
- */
1063
- static createSmoothCurvePrimitives(size = 1.0) {
1064
- const alpha = 0.1;
1065
- const beta = 0.3;
1066
- return [
1067
- LineSegment3d.create(Point3d.create(0, 0, 0), Point3d.create(size, 0, 0)),
1068
- LineSegment3d.create(Point3d.create(0, 0, 0), Point3d.create(size, size, 0)),
1069
- Arc3d.create(Point3d.create(0, 0, 0), Vector3d.create(size, 0, 0), Vector3d.create(0, size, 0), AngleSweep.createStartEndDegrees(0, 90)),
1070
- Arc3d.create(Point3d.create(0, 0, 0), Vector3d.create(size, 0, 0), Vector3d.create(0, size, 0), AngleSweep.createStartEndDegrees(-40, 270)),
1071
- Arc3d.create(Point3d.create(0, 0, 0), Vector3d.create(size, alpha * size, 0), Vector3d.create(-alpha * beta * size, beta * size, 0), AngleSweep.createStartEndDegrees(-40, 270)),
1072
- ];
1073
- }
1074
- /** Assorted small polyface grids, possibly expanded by gridMultiplier */
1075
- static createSimpleIndexedPolyfaces(gridMultiplier) {
1076
- const meshes = [
1077
- Sample.createTriangularUnitGridPolyface(Point3d.create(), Vector3d.unitX(), Vector3d.unitY(), gridMultiplier * 3, 2 * gridMultiplier, false, false, false),
1078
- Sample.createTriangularUnitGridPolyface(Point3d.create(), Vector3d.unitX(), Vector3d.unitY(), 3 * gridMultiplier, 2 * gridMultiplier, true, false, false),
1079
- Sample.createTriangularUnitGridPolyface(Point3d.create(), Vector3d.unitX(), Vector3d.unitY(), 3 * gridMultiplier, 2 * gridMultiplier, false, true, false),
1080
- Sample.createTriangularUnitGridPolyface(Point3d.create(), Vector3d.unitX(), Vector3d.unitY(), 3 * gridMultiplier, 2 * gridMultiplier, false, false, true),
1081
- Sample.createTriangularUnitGridPolyface(Point3d.create(), Vector3d.unitX(), Vector3d.unitY(), 3 * gridMultiplier, 2 * gridMultiplier, true, true, true),
1082
- ];
1083
- for (const m of meshes)
1084
- m.expectedClosure = 1;
1085
- return meshes;
1086
- }
1087
- /**
1088
- * Build a mesh that is a (possibly skewed) grid in a plane.
1089
- * @param origin "lower left" coordinate
1090
- * @param vectorX step in "X" direction
1091
- * @param vectorY step in "Y" direction
1092
- * @param numXVertices number of vertices in X direction
1093
- * @param numYVertices number of vertices in y direction
1094
- * @param createParams true to create parameters, with parameter value `(i,j)` for point at (0 based) vertex in x,y directions
1095
- * @param createNormals true to create a (single) normal indexed from all facets
1096
- * @param createColors true to create a single color on each quad (shared between both triangles in quad if triangulating)
1097
- * @param triangulate whether to triangulate the quads (default true)
1098
- * @note edgeVisible is false only on the diagonals
1099
- */
1100
- static createTriangularUnitGridPolyface(origin, vectorX, vectorY, numXVertices, numYVertices, createParams = false, createNormals = false, createColors = false, triangulate = true) {
1101
- const mesh = IndexedPolyface.create(createNormals, createParams, createColors);
1102
- const normal = vectorX.crossProduct(vectorY);
1103
- if (createNormals) {
1104
- normal.normalizeInPlace();
1105
- mesh.addNormalXYZ(normal.x, normal.y, normal.z); // use XYZ to help coverage count!!
1106
- }
1107
- // Push to coordinate arrays
1108
- for (let j = 0; j < numYVertices; j++) {
1109
- for (let i = 0; i < numXVertices; i++) {
1110
- mesh.addPoint(origin.plus2Scaled(vectorX, i, vectorY, j));
1111
- if (createParams)
1112
- mesh.addParamUV(i, j);
1113
- }
1114
- }
1115
- let color = 0xFF5CE51A; // arbitrary color so colorIndex is different from color.
1116
- const colorDiff = 0x12345;
1117
- // Push elements to index array (vertices are calculated using i and j positioning for each point)
1118
- let thisColorIndex = 0;
1119
- for (let j = 0; j + 1 < numYVertices; j++) {
1120
- for (let i = 0; i + 1 < numXVertices; i++) {
1121
- const vertex00 = numXVertices * j + i;
1122
- const vertex10 = vertex00 + 1;
1123
- const vertex01 = vertex00 + numXVertices;
1124
- const vertex11 = vertex01 + 1;
1125
- if (triangulate) {
1126
- // Push lower triangle
1127
- mesh.addPointIndex(vertex00, true);
1128
- mesh.addPointIndex(vertex10, true);
1129
- mesh.addPointIndex(vertex11, false);
1130
- // make color === faceIndex
1131
- if (createColors) {
1132
- thisColorIndex = mesh.addColor(color += colorDiff);
1133
- mesh.addColorIndex(thisColorIndex);
1134
- mesh.addColorIndex(thisColorIndex);
1135
- mesh.addColorIndex(thisColorIndex);
1136
- }
1137
- // param indexing matches points . .
1138
- if (createParams) {
1139
- mesh.addParamIndex(vertex00);
1140
- mesh.addParamIndex(vertex10);
1141
- mesh.addParamIndex(vertex11);
1142
- }
1143
- if (createNormals) {
1144
- mesh.addNormalIndex(0);
1145
- mesh.addNormalIndex(0);
1146
- mesh.addNormalIndex(0);
1147
- }
1148
- mesh.terminateFacet(false);
1149
- // upper triangle
1150
- mesh.addPointIndex(vertex11, true);
1151
- mesh.addPointIndex(vertex01, true);
1152
- mesh.addPointIndex(vertex00, false);
1153
- // make color === faceIndex
1154
- if (createColors) {
1155
- mesh.addColorIndex(thisColorIndex);
1156
- mesh.addColorIndex(thisColorIndex);
1157
- mesh.addColorIndex(thisColorIndex);
1158
- }
1159
- // param indexing matches points.
1160
- if (createParams) {
1161
- mesh.addParamIndex(vertex11);
1162
- mesh.addParamIndex(vertex01);
1163
- mesh.addParamIndex(vertex00);
1164
- }
1165
- if (createNormals) {
1166
- mesh.addNormalIndex(0);
1167
- mesh.addNormalIndex(0);
1168
- mesh.addNormalIndex(0);
1169
- }
1170
- mesh.terminateFacet(false);
1171
- }
1172
- else {
1173
- // Push quad
1174
- mesh.addPointIndex(vertex00, true);
1175
- mesh.addPointIndex(vertex10, true);
1176
- mesh.addPointIndex(vertex11, true);
1177
- mesh.addPointIndex(vertex01, true);
1178
- // make color === faceIndex
1179
- if (createColors) {
1180
- thisColorIndex = mesh.addColor(color += colorDiff);
1181
- mesh.addColorIndex(thisColorIndex);
1182
- mesh.addColorIndex(thisColorIndex);
1183
- mesh.addColorIndex(thisColorIndex);
1184
- mesh.addColorIndex(thisColorIndex);
1185
- }
1186
- // param indexing matches points . .
1187
- if (createParams) {
1188
- mesh.addParamIndex(vertex00);
1189
- mesh.addParamIndex(vertex10);
1190
- mesh.addParamIndex(vertex11);
1191
- mesh.addParamIndex(vertex01);
1192
- }
1193
- if (createNormals) {
1194
- mesh.addNormalIndex(0);
1195
- mesh.addNormalIndex(0);
1196
- mesh.addNormalIndex(0);
1197
- mesh.addNormalIndex(0);
1198
- }
1199
- mesh.terminateFacet(false);
1200
- }
1201
- }
1202
- }
1203
- return mesh;
1204
- }
1205
- /** Create an xy grid of points in single array with x varying fastest. */
1206
- static createXYGrid(numU, numV, dX = 1.0, dY = 1.0) {
1207
- const points = [];
1208
- for (let j = 0; j < numV; j++) {
1209
- for (let i = 0; i < numU; i++) {
1210
- points.push(Point3d.create(i * dX, j * dY, 0));
1211
- }
1212
- }
1213
- return points;
1214
- }
1215
- /** Create simple bspline surface on xy plane grid. */
1216
- static createXYGridBsplineSurface(numU, numV, orderU, orderV) {
1217
- return BSplineSurface3d.create(Sample.createXYGrid(numU, numV, 1.0, 1.0), numU, orderU, undefined, numV, orderV, undefined);
1218
- }
1219
- /**
1220
- * Create a bspline surface whose poles area on circular paths.
1221
- * * (BUT not weighted bspline, therefore although u and v isolines "go around" they are not true circles.)
1222
- * @param radiusU major radius
1223
- * @param radiusV minor radius
1224
- * @param numU number of facets around major hoop
1225
- * @param numV number of facets around minor hoop
1226
- * @param orderU major hoop order
1227
- * @param orderV minor hoop order
1228
- */
1229
- static createPseudoTorusBsplineSurface(radiusU, radiusV, numU, numV, orderU, orderV) {
1230
- const points = [];
1231
- const numUPole = numU + orderU - 1; // degreeU wrap-around poles
1232
- const numVPole = numV + orderV - 1; // degreeV wrap-around poles
1233
- const uKnots = KnotVector.createUniformWrapped(numU, orderU - 1, 0, 1);
1234
- const vKnots = KnotVector.createUniformWrapped(numV, orderV - 1, 0, 1);
1235
- const dURadians = 2.0 * Math.PI / numU;
1236
- const dVRadians = 2.0 * Math.PI / numV;
1237
- for (let iV = 0; iV < numVPole; iV++) {
1238
- const vRadians = iV * dVRadians;
1239
- const cV = Math.cos(vRadians);
1240
- const sV = Math.sin(vRadians);
1241
- for (let iU = 0; iU < numUPole; iU++) {
1242
- const uRadians = iU * dURadians;
1243
- const cU = Math.cos(uRadians);
1244
- const sU = Math.sin(uRadians);
1245
- const rho = radiusU + cV * radiusV;
1246
- points.push(Point3d.create(rho * cU, rho * sU, sV * radiusV));
1247
- }
1248
- }
1249
- const result = BSplineSurface3d.create(points, numUPole, orderU, uKnots.knots, numVPole, orderV, vKnots.knots);
1250
- if (result) {
1251
- result.setWrappable(UVSelect.uDirection, BSplineWrapMode.OpenByAddingControlPoints);
1252
- result.setWrappable(UVSelect.vDirection, BSplineWrapMode.OpenByAddingControlPoints);
1253
- }
1254
- return result;
1255
- }
1256
- /**
1257
- * Create a Bspline surface for a cone.
1258
- * @param centerA center at section A
1259
- * @param centerB center at section B
1260
- * @param radiusA radius at point A
1261
- * @param radiusB radius at point B
1262
- */
1263
- static createConeBsplineSurface(centerA, centerB, radiusA, radiusB, numSection) {
1264
- if (numSection < 2)
1265
- numSection = 2;
1266
- const controlPoints = [];
1267
- const numVPole = numSection;
1268
- const q1 = 0.25;
1269
- const q2 = 0.5;
1270
- const q3 = 0.75;
1271
- const uKnots = [0, 0, q1, q1, q2, q2, q3, q3, 1, 1];
1272
- const vKnots = [];
1273
- const dv = 1.0 / (numSection - 1);
1274
- for (let i = 0; i < numSection; i++) {
1275
- vKnots.push(i * dv);
1276
- }
1277
- const center = Point3d.create();
1278
- const vectorAB = Vector3d.createStartEnd(centerA, centerB);
1279
- const axes = Matrix3d.createRigidHeadsUp(vectorAB, AxisOrder.ZXY);
1280
- let r0, r90, v;
1281
- for (let iV = 0; iV < numVPole; iV++) {
1282
- v = iV * dv;
1283
- centerA.interpolate(v, centerB, center);
1284
- r0 = r90 = Geometry.interpolate(radiusA, v, radiusB);
1285
- controlPoints.push(Sample.createBsplineArc90SectionToXYZWArrays(center, axes, r0, r90, false));
1286
- }
1287
- const result = BSplineSurface3dH.createGrid(controlPoints, WeightStyle.WeightsSeparateFromCoordinates, 3, uKnots, 2, vKnots);
1288
- if (result)
1289
- result.setWrappable(UVSelect.uDirection, BSplineWrapMode.OpenByRemovingKnots);
1290
- return result;
1291
- }
1292
- /** Create bspline surface on xy grid with weights. */
1293
- static createWeightedXYGridBsplineSurface(numU, numV, orderU, orderV, weight00 = 1.0, weight10 = 1.0, weight01 = 1.0, weight11 = 1.0) {
1294
- const xyzPoles = Sample.createXYGrid(numU, numV, 1.0, 1.0);
1295
- const weights = [];
1296
- for (let i = 0; i < numU; i++)
1297
- for (let j = 0; j < numV; j++) {
1298
- const wu0 = Geometry.interpolate(weight00, i / (numU - 1), weight10);
1299
- const wu1 = Geometry.interpolate(weight01, i / (numU - 1), weight11);
1300
- weights.push(Geometry.interpolate(wu0, j / (numV - 1), wu1));
1301
- }
1302
- return BSplineSurface3dH.create(xyzPoles, weights, numU, orderU, undefined, numV, orderV, undefined);
1303
- }
1304
- /** Assorted linear sweeps */
1305
- static createSimpleLinearSweeps() {
1306
- const result = [];
1307
- const base = Loop.create(LineString3d.createRectangleXY(Point3d.create(), 2, 3));
1308
- const vectorZ = Vector3d.create(0, 0, 1.234);
1309
- const vectorQ = Vector3d.create(0.1, 0.21, 1.234);
1310
- result.push(LinearSweep.create(base, vectorZ, false));
1311
- result.push(LinearSweep.create(base, vectorZ, true));
1312
- result.push(LinearSweep.create(base, vectorQ, false));
1313
- result.push(LinearSweep.create(base, vectorQ, true));
1314
- result.push(LinearSweep.create(Sample.createCappedArcLoop(5, -45, 90), vectorQ, true));
1315
- for (const curve of Sample.createSmoothCurvePrimitives()) {
1316
- const path = Path.create(curve);
1317
- result.push(LinearSweep.create(path, vectorZ, false));
1318
- }
1319
- // coordinates for a clearly unclosed linestring ....
1320
- const xyPoints = [
1321
- Point2d.create(0, 0),
1322
- Point2d.create(1, 0),
1323
- Point2d.create(1, 1),
1324
- ];
1325
- result.push(LinearSweep.createZSweep(xyPoints, 1, 3, false));
1326
- // this forces artificial closure point . . .
1327
- result.push(LinearSweep.createZSweep(xyPoints, 1, 3, true));
1328
- // add a not-quite-exact closure point ...
1329
- const e = 1.0e-11;
1330
- xyPoints.push(Point2d.create(e, e));
1331
- result.push(LinearSweep.createZSweep(xyPoints, 1, 3, false));
1332
- result.push(LinearSweep.createZSweep(xyPoints, 1, 3, true));
1333
- // make it a better closure
1334
- xyPoints.pop();
1335
- xyPoints.push(xyPoints[0]);
1336
- result.push(LinearSweep.createZSweep(xyPoints, 1, 3, false));
1337
- result.push(LinearSweep.createZSweep(xyPoints, 1, 3, true));
1338
- // negative sweep ...
1339
- result.push(LinearSweep.createZSweep(xyPoints, 1, -3, true));
1340
- return result;
1341
- }
1342
- /**
1343
- * Create an array of primitives with an arc centered at origin and a line segment closing back to the arc start.
1344
- * This can be bundled into Path or Loop by caller.
1345
- */
1346
- static createCappedArcPrimitives(radius, startDegrees, endDegrees) {
1347
- const arc = Arc3d.create(Point3d.create(0, 0, 0), Vector3d.unitX(radius), Vector3d.unitY(radius), AngleSweep.createStartEndDegrees(startDegrees, endDegrees));
1348
- return [arc, LineSegment3d.create(arc.fractionToPoint(1.0), arc.fractionToPoint(0.0))];
1349
- }
1350
- /** Return a Path structure for a segment of arc, with closure segment */
1351
- static createCappedArcPath(radius, startDegrees, endDegrees) {
1352
- return Path.createArray(Sample.createCappedArcPrimitives(radius, startDegrees, endDegrees));
1353
- }
1354
- /** Return a Loop structure for a segment of arc, with closure segment */
1355
- static createCappedArcLoop(radius, startDegrees, endDegrees) {
1356
- return Loop.createArray(Sample.createCappedArcPrimitives(radius, startDegrees, endDegrees));
1357
- }
1358
- /** Create assorted rotational sweeps. */
1359
- static createSimpleRotationalSweeps() {
1360
- const result = [];
1361
- // rectangle in xy plane
1362
- const base = Loop.create(LineString3d.createRectangleXY(Point3d.create(1, 0, 0), 2, 3));
1363
- // rotate around the y axis
1364
- for (const axis of [
1365
- Ray3d.createXYZUVW(0, 0, 0, 0, 1, 0),
1366
- Ray3d.createXYZUVW(5, 0, 0, 0, 1, 0),
1367
- Ray3d.createXYZUVW(-1, 0, 0, -1, 1, 0),
1368
- ]) {
1369
- result.push(RotationalSweep.create(base, axis, Angle.createDegrees(45.0), false));
1370
- result.push(RotationalSweep.create(base, axis, Angle.createDegrees(150.0), true));
1371
- }
1372
- return result;
1373
- }
1374
- /** Create assorted spheres */
1375
- static createSpheres(includeEllipsoidal = false) {
1376
- const result = [];
1377
- result.push(Sphere.createCenterRadius(Point3d.create(0, 0, 0), 1.0));
1378
- result.push(Sphere.createCenterRadius(Point3d.create(1, 2, 3), 3.0));
1379
- const s1 = Sphere.createCenterRadius(Point3d.create(1, 2, 3), 2.0, AngleSweep.createStartEndDegrees(-45, 80));
1380
- s1.capped = true;
1381
- result.push(s1);
1382
- // still a sphere, but with axes KIJ . .
1383
- const s2 = Sphere.createFromAxesAndScales(Point3d.create(1, 2, 3), Matrix3d.createRowValues(0, 1, 0, 0, 0, 1, 1, 0, 0), 4, 4, 4, AngleSweep.createStartEndDegrees(-45, 45), true);
1384
- result.push(s2);
1385
- if (includeEllipsoidal)
1386
- result.push(Sphere.createDgnSphere(Point3d.create(1, 2, 3), Vector3d.unitX(), Vector3d.unitZ(), 3, 2, AngleSweep.createFullLatitude(), false));
1387
- return result;
1388
- }
1389
- /** Create true (non-spherical) ellipsoids. */
1390
- static createEllipsoids() {
1391
- return [
1392
- Sphere.createEllipsoid(Transform.createOriginAndMatrix(Point3d.create(0, 0, 0), Matrix3d.createRowValues(4, 1, 1, 1, 4, 1, 0.5, 0.2, 5)), AngleSweep.createFullLatitude(), true),
1393
- ];
1394
- }
1395
- /** Create assorted cones. */
1396
- static createCones() {
1397
- const result = [];
1398
- const origin = Point3d.create(0, 0, 0);
1399
- const topZ = Point3d.create(0, 0, 5);
1400
- const centerA = Point3d.create(1, 2, 1);
1401
- const centerB = Point3d.create(2, 3, 8);
1402
- result.push(Cone.createAxisPoints(Point3d.create(0, 0, 0), Point3d.create(0, 0, 1), 0.5, 0.5, false));
1403
- result.push(Cone.createAxisPoints(centerA, centerB, 0.5, 0.5, false));
1404
- result.push(Cone.createAxisPoints(origin, topZ, 1.0, 0.2, true));
1405
- result.push(Cone.createAxisPoints(centerA, centerB, 0.2, 0.5, false));
1406
- result.push(Cone.createAxisPoints(origin, centerB, 1.0, 0.0, false));
1407
- result.push(Cone.createAxisPoints(topZ, origin, 0.0, 1.0, true));
1408
- return result;
1409
- }
1410
- /** Return a TorusPipe with swept circle in xz plane rotating through an angle range around the Z axis. */
1411
- static createPartialTorusAroundZ(majorRadius, majorSweep, minorRadius, minorStart, minorEnd) {
1412
- const arc = Arc3d.createXYZXYZXYZ(majorRadius, 0, 0, minorRadius, 0, 0, 0, minorRadius, 0, AngleSweep.createStartEnd(minorStart, minorEnd));
1413
- const contour = Path.create(arc);
1414
- return RotationalSweep.create(contour, Ray3d.createZAxis(), majorSweep, false);
1415
- }
1416
- /** Create assorted Torus Pipes */
1417
- static createTorusPipes() {
1418
- const result = [];
1419
- const center = Point3d.create(1, 2, 3);
1420
- const frame = Matrix3d.createRotationAroundVector(Vector3d.create(1, 2, 3), Angle.createRadians(10));
1421
- const vectorX = frame.columnX();
1422
- const vectorY = frame.columnY();
1423
- const vectorZ = frame.columnZ();
1424
- result.push(TorusPipe.createInFrame(Transform.createIdentity(), 5.0, 0.8, Angle.create360(), false));
1425
- result.push(TorusPipe.createInFrame(Transform.createIdentity(), 5.0, 1.0, Angle.createDegrees(90), true));
1426
- result.push(TorusPipe.createDgnTorusPipe(center, vectorX, vectorY, 10, 1, Angle.createDegrees(180), true));
1427
- result.push(TorusPipe.createDgnTorusPipe(center, vectorY, vectorZ, 10, 1, Angle.createDegrees(45), true));
1428
- return result;
1429
- }
1430
- /** Create assorted boxes. */
1431
- static createBoxes(capped = true) {
1432
- const result = [];
1433
- const cornerA = Point3d.create(1, 2, 3);
1434
- const aX = 3.0;
1435
- const aY = 2.0;
1436
- const bX = 1.5;
1437
- const bY = 1.0;
1438
- const h = 5.0;
1439
- const frame = Matrix3d.createRotationAroundVector(Vector3d.create(0, 0, 1), Angle.createDegrees(10));
1440
- const vectorX = frame.columnX();
1441
- const vectorY = frame.columnY();
1442
- const cornerB = Matrix3d.xyzPlusMatrixTimesCoordinates(cornerA, frame, 0, 0, h);
1443
- result.push(Box.createDgnBox(cornerA, Vector3d.unitX(), Vector3d.unitY(), cornerB, aX, aY, aX, aY, capped));
1444
- result.push(Box.createDgnBox(cornerA, Vector3d.unitX(), Vector3d.unitY(), cornerB, aX, aY, bX, bY, capped));
1445
- result.push(Box.createDgnBox(cornerA, vectorX, vectorY, cornerB, aX, aY, bX, bY, capped));
1446
- const frameY = Matrix3d.createRotationAroundVector(Vector3d.create(0, 1, 0), Angle.createDegrees(10));
1447
- result.push(Box.createDgnBox(cornerA, frameY.columnX(), frameY.columnY(), cornerA.plusScaled(frameY.columnZ(), h), aX, aY, bX, bY, capped));
1448
- return result;
1449
- }
1450
- /** Create an array of points for a rectangle with corners (x0,y0,z) and (x1,y1,z) */
1451
- static createRectangle(x0, y0, x1, y1, z = 0.0, closed = false) {
1452
- const points = [
1453
- Point3d.create(x0, y0, z),
1454
- Point3d.create(x1, y0, z),
1455
- Point3d.create(x1, y1, z),
1456
- Point3d.create(x0, y1, z),
1457
- ];
1458
- if (closed)
1459
- points.push(Point3d.create(x0, y0, z));
1460
- return points;
1461
- }
1462
- /** Create an array of points for a rectangle with corners of a Range2d. */
1463
- static createRectangleInRange2d(range, z = 0.0, closed = false) {
1464
- const x0 = range.low.x;
1465
- const x1 = range.high.x;
1466
- const y0 = range.low.y;
1467
- const y1 = range.high.y;
1468
- return this.createRectangle(x0, y0, x1, y1, z, closed);
1469
- }
1470
- /** Create assorted ruled sweeps */
1471
- static createRuledSweeps(includeParityRegion = false, includeBagOfCurves = false) {
1472
- const allSweeps = [];
1473
- const contour0 = Loop.create(LineString3d.create(this.createRectangleXY(0, 0, 3, 2, 0)));
1474
- const contour1 = Loop.create(LineString3d.create(this.createRectangleXY(0, 0, 3, 2.5, 2)));
1475
- const contour2 = Loop.create(LineString3d.create(this.createRectangleXY(0, 0, 4, 3.5, 4)));
1476
- const contour3 = Loop.create(LineString3d.create(this.createRectangleXY(0, 0, 2, 1, 7)));
1477
- const allContours = [contour0, contour1, contour2];
1478
- allSweeps.push(RuledSweep.create([contour0, contour1], true));
1479
- allSweeps.push(RuledSweep.create([contour0, contour1, contour2], true));
1480
- allSweeps.push(RuledSweep.create([contour0, contour1, contour2, contour3], true));
1481
- allSweeps.push(RuledSweep.create(allContours, false));
1482
- const curves = Sample.createSmoothCurvePrimitives();
1483
- for (const c of curves) {
1484
- const frame = c.fractionToFrenetFrame(0.0);
1485
- if (frame) {
1486
- const perpVector = frame.matrix.columnZ();
1487
- perpVector.scaleInPlace(10.0);
1488
- const c1 = c.cloneTransformed(Transform.createTranslation(perpVector));
1489
- allSweeps.push(RuledSweep.create([Path.create(c), Path.create(c1)], false));
1490
- }
1491
- }
1492
- if (includeParityRegion) {
1493
- const outer = Loop.create(LineString3d.create(this.createRectangleXY(0, 0, 5, 6, 0)));
1494
- const inner = Loop.create(LineString3d.create(this.createRectangleXY(1, 1, 2, 3, 0)));
1495
- const contourA = ParityRegion.create(outer, inner);
1496
- const contourB = contourA.clone();
1497
- contourB.tryTranslateInPlace(0, 0, 2);
1498
- allSweeps.push(RuledSweep.create([contourA, contourB], false));
1499
- }
1500
- if (includeBagOfCurves) {
1501
- const contourA = BagOfCurves.create(LineSegment3d.createXYZXYZ(1, 1, 0, 3, 1, 0));
1502
- const contourB = BagOfCurves.create(LineSegment3d.createXYZXYZ(1, 1, 1, 3, 1, 1));
1503
- allSweeps.push(RuledSweep.create([contourA, contourB], false));
1504
- }
1505
- return allSweeps;
1506
- }
1507
- /**
1508
- * Uniformly spaced numbers
1509
- * @param a0 first entry
1510
- * @param delta step between entries
1511
- * @param n number of entries
1512
- */
1513
- static createGrowableArrayCountedSteps(a0, delta, n) {
1514
- const data = new GrowableFloat64Array(n);
1515
- for (let i = 0; i < n; i++)
1516
- data.push(a0 + i * delta);
1517
- return data;
1518
- }
1519
- /**
1520
- * Create points on a unit circle
1521
- * @param radius first entry
1522
- * @param numEdge number of edges of chorded circle. Angle step is 2PI/numEdge (whether or not closed)
1523
- * @param closed true to include final point (i.e. return numEdge+1 points)
1524
- */
1525
- static createGrowableArrayCirclePoints(radius, numEdge, closed = false, centerX = 0, centerY = 0, data) {
1526
- if (!data)
1527
- data = new GrowableXYZArray();
1528
- data.ensureCapacity(numEdge + (closed ? 1 : 0));
1529
- const delta = 2.0 * Math.PI / numEdge;
1530
- for (let i = 0; i < numEdge; i++) {
1531
- const radians = i * delta;
1532
- data.push(Point3d.create(centerX + radius * Math.cos(radians), centerY + radius * Math.sin(radians)));
1533
- }
1534
- return data;
1535
- }
1536
- static pushIfDistinct(points, xyz, tol = 1.0e-12) {
1537
- if (points.length === 0 || points[points.length - 1].distanceXY(xyz) > tol)
1538
- points.push(xyz);
1539
- }
1540
- static appendToFractalEval(points, pointA, pointB, pattern, numRecursion, perpendicularFactor) {
1541
- const point0 = pointA.clone();
1542
- Sample.pushIfDistinct(points, pointA);
1543
- for (const uv of pattern) {
1544
- const point1 = pointA.interpolatePerpendicularXY(uv.x, pointB, perpendicularFactor * uv.y);
1545
- if (numRecursion > 0)
1546
- Sample.appendToFractalEval(points, point0, point1, pattern, numRecursion - 1, perpendicularFactor);
1547
- Sample.pushIfDistinct(points, point1);
1548
- point0.setFrom(point1);
1549
- }
1550
- Sample.pushIfDistinct(points, pointB);
1551
- }
1552
- /**
1553
- * For each edge of points, construct a transform (with scale, rotate, and translate) that spreads the patter out along the edge.
1554
- * Repeat recursively for each edge
1555
- * @returns Returns an array of recursively generated fractal points
1556
- * @param poles level-0 (coarse) polygon whose edges are to be replaced by recursive fractals
1557
- * @param pattern pattern to map to each edge of poles (and to edges of the recursion)
1558
- * @param numRecursion number of recursions
1559
- * @param perpendicularFactor factor to apply to perpendicular sizing.
1560
- */
1561
- static createRecursiveFractalPolygon(poles, pattern, numRecursion, perpendicularFactor) {
1562
- const points = [];
1563
- Sample.pushIfDistinct(points, poles[0]);
1564
- for (let i = 0; i + 1 < poles.length; i++) {
1565
- if (numRecursion > 0)
1566
- Sample.appendToFractalEval(points, poles[i], poles[i + 1], pattern, numRecursion - 1, perpendicularFactor);
1567
- Sample.pushIfDistinct(points, poles[i + 1]);
1568
- }
1569
- return points;
1570
- }
1571
- /**
1572
- * Primary shape is a "triangle" with lower edge pushed in so it becomes a mild nonconvex quad.
1573
- * Fractal effects are gentle.
1574
- */
1575
- static nonConvexQuadSimpleFractal(numRecursion, perpendicularFactor) {
1576
- const pattern = [
1577
- Point2d.create(),
1578
- Point2d.create(0.5, 0.1),
1579
- Point2d.create(1.0, 0.0),
1580
- ];
1581
- const poles = [
1582
- Point3d.create(0, 0, 0),
1583
- Point3d.create(0.6, 0.1, 0),
1584
- Point3d.create(1, 0.1, 0),
1585
- Point3d.create(0.6, 1, 0),
1586
- Point3d.create(),
1587
- ];
1588
- return Sample.createRecursiveFractalPolygon(poles, pattern, numRecursion, perpendicularFactor);
1589
- }
1590
- /** Create a diamond with convex fractal */
1591
- static createFractalDiamondConvexPattern(numRecursion, perpendicularFactor) {
1592
- const pattern = [
1593
- Point2d.create(),
1594
- Point2d.create(0.3, 0.05),
1595
- Point2d.create(0.5, 0.10),
1596
- Point2d.create(0.7, 0.04),
1597
- Point2d.create(1.0, 0.0),
1598
- ];
1599
- const poles = [
1600
- Point3d.create(0, -1, 0),
1601
- Point3d.create(1, 0, 0),
1602
- Point3d.create(0, 1, 0),
1603
- Point3d.create(-1, 0, 0),
1604
- Point3d.create(0, -1, 0),
1605
- ];
1606
- return Sample.createRecursiveFractalPolygon(poles, pattern, numRecursion, perpendicularFactor);
1607
- }
1608
- /** Create l on a square, with pattern shift to both directions. */
1609
- static createFractalSquareReversingPattern(numRecursion, perpendicularFactor) {
1610
- const pattern = [
1611
- Point2d.create(),
1612
- Point2d.create(0.25, 0),
1613
- Point2d.create(0.5, 0.2),
1614
- Point2d.create(0.75, -0.1),
1615
- Point2d.create(1.0, 0.0),
1616
- ];
1617
- const poles = [
1618
- Point3d.create(),
1619
- Point3d.create(1, 0, 0),
1620
- Point3d.create(1, 1, 0),
1621
- Point3d.create(0, 1, 0),
1622
- Point3d.create(0, 0, 0),
1623
- ];
1624
- return Sample.createRecursiveFractalPolygon(poles, pattern, numRecursion, perpendicularFactor);
1625
- }
1626
- /** Create a fractal on a non-convex base and reversing pattern */
1627
- static createFractalHatReversingPattern(numRecursion, perpendicularFactor) {
1628
- const pattern = [
1629
- Point2d.create(),
1630
- Point2d.create(0.25, 0),
1631
- Point2d.create(0.25, 0.1),
1632
- Point2d.create(0.50, 0.1),
1633
- Point2d.create(0.50, -0.1),
1634
- Point2d.create(0.75, -0.1),
1635
- Point2d.create(0.75, 0),
1636
- Point2d.create(1.0, 0.0),
1637
- ];
1638
- const poles = [
1639
- Point3d.create(),
1640
- Point3d.create(1, 0, 0),
1641
- Point3d.create(1, 1, 0),
1642
- Point3d.create(0, 1, 0),
1643
- Point3d.create(0, 0, 0),
1644
- ];
1645
- return Sample.createRecursiveFractalPolygon(poles, pattern, numRecursion, perpendicularFactor);
1646
- }
1647
- /** Create a fractal on a primary L shape with a reversing pattern */
1648
- static createFractalLReversingPattern(numRecursion, perpendicularFactor) {
1649
- const pattern = [
1650
- Point2d.create(),
1651
- Point2d.create(0.25, 0),
1652
- Point2d.create(0.5, 0.2),
1653
- Point2d.create(0.75, -0.1),
1654
- Point2d.create(1.0, 0.0),
1655
- ];
1656
- const poles = [
1657
- Point3d.create(),
1658
- Point3d.create(1, 0, 0),
1659
- Point3d.create(1, 1, 0),
1660
- Point3d.create(2, 2, 0),
1661
- Point3d.create(2, 3, 0),
1662
- Point3d.create(0, 3, 0),
1663
- Point3d.create(),
1664
- ];
1665
- return Sample.createRecursiveFractalPolygon(poles, pattern, numRecursion, perpendicularFactor);
1666
- }
1667
- /** Fractal with fewer concavity changes.... */
1668
- static createFractalLMildConcavePatter(numRecursion, perpendicularFactor) {
1669
- const pattern = [
1670
- Point2d.create(),
1671
- Point2d.create(0.25, 0.05),
1672
- Point2d.create(0.5, 0.15),
1673
- Point2d.create(0.75, 0.05),
1674
- Point2d.create(1.0, 0.0),
1675
- ];
1676
- const poles = [
1677
- Point3d.create(),
1678
- Point3d.create(1, 0, 0),
1679
- Point3d.create(1, 1, 0),
1680
- Point3d.create(2, 2, 0),
1681
- Point3d.create(1.5, 3, 0),
1682
- Point3d.create(0, 3, 0),
1683
- Point3d.create(),
1684
- ];
1685
- return Sample.createRecursiveFractalPolygon(poles, pattern, numRecursion, perpendicularFactor);
1686
- }
1687
- /** Append interpolated points from the array tail to the target. */
1688
- static appendSplits(points, target, numSplit, includeTarget) {
1689
- const pointA = points[points.length - 1];
1690
- for (let i = 0; i < numSplit; i++)
1691
- points.push(pointA.interpolate(i / numSplit, target));
1692
- if (includeTarget)
1693
- points.push(target);
1694
- }
1695
- /**
1696
- * Triangle with 3 given vertices, and indicated extra points on each each.
1697
- * @param numSplitAB number of extra points on edge AB
1698
- * @param numSplitBC number of extra points on edge BC
1699
- * @param numSplitCA number of extra points on edge CA
1700
- * @param wrap true to replicate vertexA at end
1701
- * @param xyzA vertexA
1702
- * @param xyzB vertexB
1703
- * @param xyzC vertexC
1704
- */
1705
- static createTriangleWithSplitEdges(numSplitAB, numSplitBC, numSplitCA, wrap = true, xyzA = Point3d.create(0, 0, 0), xyzB = Point3d.create(1, 0, 0), xyzC = Point3d.create(0, 1, 0)) {
1706
- const result = [xyzA.clone()];
1707
- Sample.appendSplits(result, xyzB, numSplitAB, true);
1708
- Sample.appendSplits(result, xyzC, numSplitBC, true);
1709
- Sample.appendSplits(result, xyzA, numSplitCA, wrap);
1710
- return result;
1711
- }
1712
- /** Create a box (xyz) from half-lengths and center. */
1713
- static createCenteredBoxEdges(ax = 1, ay = 1, az = 0, cx = 0, cy = 0, cz = 0, geometry) {
1714
- if (!geometry)
1715
- geometry = [];
1716
- const x0 = cx - ax;
1717
- const y0 = cy - ay;
1718
- const z0 = cz - az;
1719
- const x1 = cx + ax;
1720
- const y1 = cy + ay;
1721
- const z1 = cz + az;
1722
- for (const z of [z0, z1]) {
1723
- geometry.push(LineString3d.create(Point3d.create(x0, y0, z), Point3d.create(x1, y0, z), Point3d.create(x1, y1, z), Point3d.create(x0, y1, z), Point3d.create(x0, y0, z)));
1724
- }
1725
- geometry.push(LineSegment3d.createXYZXYZ(x0, y0, z0, x0, y0, z1));
1726
- geometry.push(LineSegment3d.createXYZXYZ(x1, y0, z0, x1, y0, z1));
1727
- geometry.push(LineSegment3d.createXYZXYZ(x1, y1, z0, x1, y1, z1));
1728
- geometry.push(LineSegment3d.createXYZXYZ(x0, y1, z0, x0, y1, z1));
1729
- return geometry;
1730
- }
1731
- /**
1732
- * Assorted transition spirals
1733
- * * (All combinations of bearing radius bearing radius length subsets.)
1734
- */
1735
- static createSimpleTransitionSpirals() {
1736
- // 5 spirals exercise the intricate "4 out of 5" input rules for spirals . ..
1737
- const r1 = 1000.0;
1738
- const r0 = 0.0;
1739
- const averageCurvature = IntegratedSpiral3d.averageCurvatureR0R1(r0, r1);
1740
- const arcLength = 100.0;
1741
- const dThetaRadians = arcLength * averageCurvature;
1742
- return [
1743
- IntegratedSpiral3d.createFrom4OutOf5("clothoid", r0, r1, Angle.createDegrees(0), Angle.createRadians(dThetaRadians), undefined, undefined, Transform.createIdentity()),
1744
- IntegratedSpiral3d.createFrom4OutOf5("bloss", r0, r1, Angle.createDegrees(0), undefined, arcLength, undefined, Transform.createIdentity()),
1745
- IntegratedSpiral3d.createFrom4OutOf5("clothoid", r0, r1, undefined, Angle.createRadians(dThetaRadians), arcLength, undefined, Transform.createIdentity()),
1746
- IntegratedSpiral3d.createFrom4OutOf5("biquadratic", r0, undefined, Angle.createDegrees(0), Angle.createRadians(dThetaRadians), arcLength, undefined, Transform.createIdentity()),
1747
- IntegratedSpiral3d.createFrom4OutOf5("sine", undefined, r1, Angle.createDegrees(0), Angle.createRadians(dThetaRadians), arcLength, undefined, Transform.createIdentity()),
1748
- IntegratedSpiral3d.createFrom4OutOf5("cosine", r0, r1, Angle.createDegrees(0), Angle.createRadians(dThetaRadians), undefined, Segment1d.create(0, 0.5), Transform.createOriginAndMatrix(Point3d.create(1, 2, 0), Matrix3d.createRotationAroundVector(Vector3d.unitZ(), Angle.createDegrees(15)))),
1749
- DirectSpiral3d.createFromLengthAndRadius("Arema", r0, r1, Angle.createDegrees(0), undefined, arcLength, undefined, Transform.createOriginAndMatrix(Point3d.create(1, 2, 0), Matrix3d.createRotationAroundVector(Vector3d.unitZ(), Angle.createDegrees(15)))),
1750
- DirectSpiral3d.createFromLengthAndRadius("ChineseCubic", r0, r1, Angle.createDegrees(0), undefined, arcLength, undefined, Transform.createOriginAndMatrix(Point3d.create(1, 2, 0), Matrix3d.createRotationAroundVector(Vector3d.unitZ(), Angle.createDegrees(15)))),
1751
- DirectSpiral3d.createFromLengthAndRadius("JapaneseCubic", r0, r1, Angle.createDegrees(0), undefined, arcLength, undefined, Transform.createOriginAndMatrix(Point3d.create(1, 2, 0), Matrix3d.createRotationAroundVector(Vector3d.unitZ(), Angle.createDegrees(15)))),
1752
- DirectSpiral3d.createFromLengthAndRadius("DirectHalfCosine", r0, r1, Angle.createDegrees(0), undefined, arcLength, undefined, Transform.createOriginAndMatrix(Point3d.create(1, 2, 0), Matrix3d.createRotationAroundVector(Vector3d.unitZ(), Angle.createDegrees(15)))),
1753
- DirectSpiral3d.createCzechCubic(Transform.createIdentity(), arcLength, r1),
1754
- ];
1755
- }
1756
- /**
1757
- * Create a Bezier curve with significant twist effects
1758
- * * r and theta are circle in xy plane at steps in thetaStepper
1759
- * * z varies with sin(phi) at steps in phiStepper.
1760
- */
1761
- static createTwistingBezier(order, x0, y0, r, thetaStepper, phiStepper, weightInterval) {
1762
- if (weightInterval !== undefined) {
1763
- const points = [];
1764
- for (let i = 0; i < order; i++) {
1765
- const theta = thetaStepper.fractionToRadians(i);
1766
- const phi = phiStepper.fractionToRadians(i);
1767
- const weight = weightInterval.fractionToPoint(i / (order - 1));
1768
- points.push(Point4d.create(weight * (x0 + r * Math.cos(theta)), weight * (y0 + r * Math.sin(theta)), weight * Math.sin(phi), weight));
1769
- }
1770
- return BezierCurve3dH.create(points);
1771
- }
1772
- else {
1773
- const points = [];
1774
- for (let i = 0; i < order; i++) {
1775
- const theta = thetaStepper.fractionToRadians(i);
1776
- const phi = phiStepper.fractionToRadians(i);
1777
- points.push(Point3d.create(x0 + r * Math.cos(theta), y0 + r * Math.sin(theta), Math.sin(phi)));
1778
- }
1779
- return BezierCurve3d.create(points);
1780
- }
1781
- }
1782
- /**
1783
- * Create various curve chains with distance indexing.
1784
- * * LineSegment
1785
- * * CircularArc
1786
- * * LineString
1787
- * * order 3 bspline
1788
- * * order 4 bspline
1789
- * * alternating lines and arcs
1790
- * * arc spline with corners
1791
- * * arc spline with smooth joins
1792
- * * interpolation curve 2 pts
1793
- * * interpolation curve 3 pts
1794
- * * interpolation curve >3 pts
1795
- * * integrated spiral (bloss)
1796
- * * direct spiral (half-cosine)
1797
- */
1798
- static createCurveChainWithDistanceIndex() {
1799
- const pointsA = [
1800
- Point3d.create(0, 0, 0),
1801
- Point3d.create(1, 3, 0),
1802
- Point3d.create(2, 4, 0),
1803
- Point3d.create(3, 3, 0),
1804
- Point3d.create(4, 0, 0),
1805
- ];
1806
- const result = [];
1807
- // one singleton per basic curve type ...
1808
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(LineSegment3d.create(Point3d.create(0, 0, 0), Point3d.create(5, 0, 0)))));
1809
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(Arc3d.createCircularStartMiddleEnd(Point3d.create(0, 0, 0), Point3d.create(3, 3, 0), Point3d.create(6, 0, 0)))));
1810
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(LineString3d.create(pointsA))));
1811
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(BSplineCurve3d.createUniformKnots(pointsA, 3))));
1812
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(BSplineCurve3d.createUniformKnots(pointsA, 4))));
1813
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(LineSegment3d.create(pointsA[0], pointsA[1]), Arc3d.createCircularStartMiddleEnd(pointsA[1], pointsA[2], pointsA[3]), LineSegment3d.create(pointsA[3], pointsA[4]))));
1814
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(// arc spline with corners
1815
- Arc3d.createXY(Point3d.create(5, 0), 5, AngleSweep.createStartEndDegrees(180, 0)), Arc3d.createXY(Point3d.create(15, 0), 5, AngleSweep.createStartEndDegrees(180, 0)), Arc3d.createXY(Point3d.create(25, 0), 5, AngleSweep.createStartEndDegrees(180, 0)))));
1816
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(// arc spline with smooth joins
1817
- Arc3d.createXY(Point3d.create(5, 0), 5, AngleSweep.createStartEndDegrees(180, 0)), Arc3d.createXY(Point3d.create(15, 0), 5, AngleSweep.createStartEndDegrees(180, 360)), Arc3d.createXY(Point3d.create(25, 0), 5, AngleSweep.createStartEndDegrees(180, 0)))));
1818
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(// 2-pt Interpolation Curve
1819
- InterpolationCurve3d.createCapture(InterpolationCurve3dOptions.create({ fitPoints: [pointsA[0], pointsA[1]] })))));
1820
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(// 3-pt Interpolation Curve
1821
- InterpolationCurve3d.createCapture(InterpolationCurve3dOptions.create({ fitPoints: [pointsA[0], pointsA[1], pointsA[2]] })))));
1822
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(InterpolationCurve3d.createCapture(InterpolationCurve3dOptions.create({ fitPoints: pointsA, startTangent: Point3d.create(1, -1), endTangent: Point3d.create(-1, -1) })))));
1823
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(IntegratedSpiral3d.createRadiusRadiusBearingBearing(Segment1d.create(0, 100), AngleSweep.createStartEndDegrees(10, 75), Segment1d.create(0, 1), Transform.createOriginAndMatrix(Point3d.createZero(), Matrix3d.createRotationAroundAxisIndex(2, Angle.createDegrees(30))), "bloss"))));
1824
- result.push(CurveChainWithDistanceIndex.createCapture(Path.create(DirectSpiral3d.createDirectHalfCosine(Transform.createOriginAndMatrix(Point3d.createZero(), Matrix3d.createRotationAroundAxisIndex(2, Angle.createDegrees(110))), 50, 350, Segment1d.create(0, 1)))));
1825
- return result;
1826
- }
1827
- /**
1828
- * Create a square wave path.
1829
- * @param numTooth number of teeth.
1830
- * @param dxA x size of "A" part
1831
- * @param dxB x size of "B" part
1832
- * @param yA y for A part
1833
- * @param yB y for B part
1834
- * @param structure 1 for line segments, 2 for one linestring per tooth, 0 for single linestring
1835
- */
1836
- static createSquareWavePath(numTooth, dxA, dxB, yA, yB, structure) {
1837
- const dxAB = dxA + dxB;
1838
- const path = Path.create();
1839
- // build the whole linestring ...
1840
- const allPoints = new GrowableXYZArray(4 * numTooth);
1841
- let x2 = 0.0;
1842
- for (let i = 0; i < numTooth; i++) {
1843
- const x0 = i * dxAB;
1844
- const x1 = x0 + dxA;
1845
- x2 = (i + 1) * dxAB;
1846
- allPoints.pushXYZ(x0, yA, 0);
1847
- allPoints.pushXYZ(x1, yA, 0.0);
1848
- allPoints.pushXYZ(x1, yB, 0.0);
1849
- allPoints.pushXYZ(x2, yB, 0.0);
1850
- }
1851
- allPoints.pushXYZ(x2, yA, 0.0);
1852
- const numPoints = allPoints.length;
1853
- if (structure === 1) {
1854
- const pointA = Point3d.create();
1855
- const pointB = Point3d.create();
1856
- allPoints.getPoint3dAtUncheckedPointIndex(0, pointA);
1857
- for (let i1 = 0; i1 + 1 < numPoints; i1++) {
1858
- allPoints.getPoint3dAtUncheckedPointIndex(i1, pointB);
1859
- path.tryAddChild(LineSegment3d.create(pointA, pointB));
1860
- pointA.setFromPoint3d(pointB);
1861
- }
1862
- }
1863
- else if (structure === 2) {
1864
- for (let i0 = 0; i0 + 4 < numPoints; i0 += 4) {
1865
- const ls = LineString3d.create();
1866
- ls.addSteppedPoints(allPoints, i0, 1, 5);
1867
- path.tryAddChild(ls);
1868
- }
1869
- }
1870
- else {
1871
- const ls = LineString3d.create();
1872
- ls.addSteppedPoints(allPoints, 0, 1, numPoints);
1873
- path.tryAddChild(ls);
1874
- }
1875
- return path;
1876
- }
1877
- /**
1878
- * Create various elliptic arcs
1879
- * * circle with vector0, vector90 aligned with x,y
1880
- * * circle with axes rotated
1881
- * *
1882
- * @param radiusRatio = vector90.magnitude / vector0.magnitude
1883
- */
1884
- static createArcs(radiusRatio = 1.0, sweep = AngleSweep.create360()) {
1885
- const arcs = [];
1886
- const center0 = Point3d.create(0, 0, 0);
1887
- const a = 1.0;
1888
- const b = radiusRatio;
1889
- const direction0 = Vector3d.createPolar(a, Angle.createDegrees(35.0));
1890
- const direction90 = direction0.rotate90CCWXY();
1891
- direction90.scaleInPlace(radiusRatio);
1892
- arcs.push(Arc3d.create(center0, Vector3d.create(a, 0, 0), Vector3d.create(0, b, 0), sweep));
1893
- arcs.push(Arc3d.create(center0, direction0, direction90, sweep));
1894
- return arcs;
1895
- }
1896
- /**
1897
- * Create many arcs, optionally including skews
1898
- * * @param skewFactor array of skew factors. for each skew factor, all base arcs are replicated with vector90 shifted by the factor times vector0
1899
- */
1900
- static createManyArcs(skewFactors = []) {
1901
- const result = [];
1902
- const sweep1 = AngleSweep.createStartEndDegrees(-10, 75);
1903
- const sweep2 = AngleSweep.createStartEndDegrees(160.0, 380.0);
1904
- for (const arcs of [
1905
- Sample.createArcs(1.0), Sample.createArcs(0.5),
1906
- Sample.createArcs(1.0, sweep1), Sample.createArcs(0.3, sweep2),
1907
- ]) {
1908
- for (const arc of arcs)
1909
- result.push(arc);
1910
- }
1911
- const numBase = result.length;
1912
- for (const skewFactor of skewFactors) {
1913
- for (let i = 0; i < numBase; i++) {
1914
- const originalArc = result[i];
1915
- result.push(Arc3d.create(originalArc.center, originalArc.vector0, originalArc.vector90.plusScaled(originalArc.vector0, skewFactor), originalArc.sweep));
1916
- }
1917
- }
1918
- return result;
1919
- }
1920
- /**
1921
- * Create edges of a range box.
1922
- * * Line strings on low and high z
1923
- * * single lines on each low z to high z edge.
1924
- * * @param range (possibly null) range
1925
- */
1926
- static createRangeEdges(range) {
1927
- if (range.isNull)
1928
- return undefined;
1929
- const corners = range.corners();
1930
- return BagOfCurves.create(LineString3d.create(corners[0], corners[1], corners[3], corners[2], corners[0]), LineString3d.create(corners[4], corners[5], corners[7], corners[6], corners[4]), LineSegment3d.create(corners[0], corners[4]), LineSegment3d.create(corners[1], corners[5]), LineSegment3d.create(corners[2], corners[6]), LineSegment3d.create(corners[3], corners[7]));
1931
- }
1932
- /** Create swept "solids" that can be capped.
1933
- * * At least one of each solid type.
1934
- * * each is within 10 of the origin all directions.
1935
- * @param capped true to include caps
1936
- * @param rotationAngle angle of rotation for the angular sweep. The default is 90 degrees.
1937
- * Beware that the rotation sweep created with the default or any positive angle produces a mesh with inward normals.
1938
- */
1939
- static createClosedSolidSampler(capped, rotationAngle = Angle.createDegrees(90)) {
1940
- const result = [];
1941
- result.push(Box.createRange(Range3d.createXYZXYZ(0, 0, 0, 3, 2, 5), capped));
1942
- result.push(Cone.createAxisPoints(Point3d.create(0, 0, 0), Point3d.create(0, 0, 5), 1.0, 1.0, capped));
1943
- result.push(Sphere.createCenterRadius(Point3d.create(0, 0, 0), 1.0));
1944
- result.push(TorusPipe.createInFrame(Transform.createIdentity(), 3.0, 1.0, Angle.create360(), capped));
1945
- const arcA = Arc3d.createXY(Point3d.create(6, 1, 0), 1.0, AngleSweep.createStartEndDegrees(-90, 0));
1946
- const point0 = arcA.fractionAndDistanceToPointOnTangent(0.0, -4);
1947
- const pointQ1 = arcA.fractionAndDistanceToPointOnTangent(1.0, 2);
1948
- const pointQ2 = arcA.fractionAndDistanceToPointOnTangent(1.0, 0.5);
1949
- const pointR1 = Point3d.create(point0.x, pointQ1.y);
1950
- const pointR2 = Point3d.create(point0.x, pointQ1.y);
1951
- const pointR3 = Point3d.create(pointQ1.x - 1, pointQ1.y);
1952
- const pointR4 = Point3d.create(pointQ1.x - 3, pointQ1.y);
1953
- const linestringQ1 = LineString3d.create(arcA.fractionToPoint(1.0), pointQ1, pointR1, point0);
1954
- const linestringQ2 = LineString3d.create(arcA.fractionToPoint(1.0), pointQ2, pointR2, point0);
1955
- const linestringQ3 = LineString3d.create(arcA.fractionToPoint(1.0), pointQ2, pointR3, pointR4, point0);
1956
- const contourZ = Path.create(linestringQ1.clone());
1957
- const contourA = Loop.create(LineSegment3d.create(point0, arcA.fractionToPoint(0)), arcA.clone(), linestringQ1.clone());
1958
- const contourB = Loop.create(LineSegment3d.create(point0, arcA.fractionToPoint(0)), arcA.clone(), linestringQ2.clone());
1959
- const contourC1 = Loop.create(LineSegment3d.create(point0, arcA.fractionToPoint(0)), arcA.clone(), linestringQ3.clone());
1960
- contourB.tryTransformInPlace(Transform.createTranslationXYZ(1, 1, 3));
1961
- // const contourC = contourB.cloneTransformed(Transform.createTranslationXYZ(2, 1, 4))!;
1962
- result.push(LinearSweep.create(contourA, Vector3d.create(0, 0, 5), capped));
1963
- result.push(LinearSweep.create(contourC1, Vector3d.create(0, 0, 5), capped));
1964
- const axis = Ray3d.createXYZUVW(0, 8, 0, 1, 0, 0);
1965
- result.push(RotationalSweep.create(contourA.clone(), axis.clone(), rotationAngle, capped));
1966
- if (!capped)
1967
- result.push(RotationalSweep.create(contourZ.clone(), axis.clone(), rotationAngle, false));
1968
- result.push(RuledSweep.create([contourA.clone(), contourB.clone()], capped));
1969
- const transformC = Transform.createScaleAboutPoint(Point3d.create(0, 0, 8), 0.5);
1970
- const contourC = contourB.cloneTransformed(transformC);
1971
- result.push(RuledSweep.create([contourA.clone(), contourB.clone(), contourC.clone()], capped));
1972
- return result;
1973
- }
1974
- /**
1975
- * Create points:
1976
- * * `numRadialEdges` radially from origin to polar point (r,sweep.start)
1977
- * * `numArcEdges` along arc from (r,sweep.start) to (r,sweep.end)
1978
- * * `numRadialEdges` returning to origin.
1979
- * * optionally include closure point at origin.
1980
- * @param x0 center x
1981
- * @param y0 center y
1982
- * @param radius radius of circle.
1983
- * @param sweep start and end angles of sweep.
1984
- * @param numRadialEdges number of edges from center to arc
1985
- * @param numArcEdges number of edges along arc
1986
- * @param addClosure true to repeat center as closure point
1987
- */
1988
- static createCutPie(x0, y0, radius, sweep, numRadialEdges, numArcEdges, addClosure = false) {
1989
- const points = [];
1990
- const center = Point3d.create(x0, y0);
1991
- points.push(center);
1992
- const pointA = Point3d.create(x0 + radius * Math.cos(sweep.startRadians), y0 + radius * Math.sin(sweep.startRadians));
1993
- const pointB = Point3d.create(x0 + radius * Math.cos(sweep.endRadians), y0 + radius * Math.sin(sweep.endRadians));
1994
- for (let i = 1; i < numRadialEdges; i++)
1995
- points.push(center.interpolate(i / numRadialEdges, pointA));
1996
- points.push(pointA);
1997
- for (let i = 1; i < numArcEdges; i++) {
1998
- const radians = sweep.fractionToRadians(i / numArcEdges);
1999
- points.push(Point3d.create(x0 + radius * Math.cos(radians), y0 + radius * Math.sin(radians)));
2000
- }
2001
- points.push(pointB);
2002
- for (let i = 1; i < numRadialEdges; i++)
2003
- points.push(pointB.interpolate(i / numRadialEdges, center));
2004
- if (addClosure)
2005
- points.push(center.clone());
2006
- return points;
2007
- }
2008
- /**
2009
- * * Let ay = 4
2010
- * * Base polygon has vertices (0,0), (ax,0), (2*ax,0), (2* ax,ay), (ax,ay), (0,ay), (0,0).
2011
- * * Shift the x coordinates of vertices 1,4 by indicated amounts (0-based numbering)
2012
- * * Shift the y coordinates for points 1,2,3,4 by indicated amounts (in 0-based numbering)
2013
- * * This is useful for testing non-y-monotonic face situations.
2014
- * * Return as points.
2015
- * @param dy1
2016
- * @param dy2
2017
- * @param dy3
2018
- * @param dy4
2019
- */
2020
- static createVerticalStaggerPolygon(dy1, dy2, dy3, dy4, ax, ay, dx1, dx4) {
2021
- const points = [];
2022
- points.push(Point3d.create(0, 0));
2023
- points.push(Point3d.create(ax + dx1, dy1));
2024
- points.push(Point3d.create(2 * ax, dy2));
2025
- points.push(Point3d.create(2 * ax, ay + dy3));
2026
- points.push(Point3d.create(ax + dx4, ay + dy4));
2027
- points.push(Point3d.create(0.0, ay));
2028
- points.push(Point3d.create(0, 0));
2029
- return points;
2030
- }
2031
- // cspell:word creat
2032
- /** @deprecated in 4.0.0 - will not be removed until after 2026-06-13. Use createVerticalStaggerPolygon instead. */
2033
- static creatVerticalStaggerPolygon(dy1, dy2, dy3, dy4, ax, ay, dx1, dx4) {
2034
- return this.createVerticalStaggerPolygon(dy1, dy2, dy3, dy4, ax, ay, dx1, dx4);
2035
- }
2036
- /**
2037
- * Make line segments for each pair of adjacent points.
2038
- * @param points array of points
2039
- * @param forceClosure if true, inspect coordinates to determine if a closure edge is needed.
2040
- */
2041
- static convertPointsToSegments(points, forceClosure = false) {
2042
- const segments = [];
2043
- const n = points.length;
2044
- for (let i = 0; i + 1 < n; i++) {
2045
- segments.push(LineSegment3d.create(points[i], points[i + 1]));
2046
- }
2047
- if (forceClosure && n > 1 && !points[0].isAlmostEqual(points[n - 1]))
2048
- segments.push(LineSegment3d.create(points[n - 1], points[0]));
2049
- return segments;
2050
- }
2051
- /**
2052
- * Create a regular polygon
2053
- * @param angle0 angle from x axis to first point.
2054
- * @param numPoint number of points
2055
- * @param close true to add closure edge.
2056
- */
2057
- static createRegularPolygon(cx, cy, cz, angle0, r, numPoint, close) {
2058
- const points = [];
2059
- const angleStepRadians = 2.0 * Math.PI / numPoint;
2060
- let radians;
2061
- for (let i = 0; i < numPoint; i++) {
2062
- radians = angle0.radians + i * angleStepRadians;
2063
- points.push(Point3d.create(cx + r * Math.cos(radians), cy + r * Math.sin(radians), cz));
2064
- }
2065
- if (close)
2066
- points.push(points[0].clone());
2067
- return points;
2068
- }
2069
- /**
2070
- * Create a star by alternating radii (with equal angular steps)
2071
- * @param r0 first point radius
2072
- * @param r1 second point radius (if undefined, this is skipped and the result is points on a circle.)
2073
- * @param numPoint number of points
2074
- * @param close true to add closure edge.
2075
- */
2076
- static createStar(cx, cy, cz, r0, r1, numPoint, close, theta0) {
2077
- const points = [];
2078
- const angleStepRadians = Math.PI / numPoint;
2079
- const radians0 = theta0 === undefined ? 0.0 : theta0.radians;
2080
- let radians;
2081
- for (let i = 0; i < numPoint; i++) {
2082
- radians = radians0 + 2 * i * angleStepRadians;
2083
- points.push(Point3d.create(cx + r0 * Math.cos(radians), cy + r0 * Math.sin(radians), cz));
2084
- if (r1 !== undefined) {
2085
- radians = radians0 + (2 * i + 1) * angleStepRadians;
2086
- points.push(Point3d.create(cx + r1 * Math.cos(radians), cy + r1 * Math.sin(radians), cz));
2087
- }
2088
- }
2089
- if (close)
2090
- points.push(points[0].clone());
2091
- return points;
2092
- }
2093
- /**
2094
- * Create an outer star A
2095
- * Place multiple inner stars B with centers on circle C
2096
- * @param rA0 radius to star tips on starA
2097
- * @param rA1 radius to star tips on starA
2098
- * @param numAPoint number of points on starA
2099
- * @param rB0 radius to star B tips
2100
- * @param rB1 radius to star B tips
2101
- * @param numBPoint
2102
- * @param rC radius for inner star centers
2103
- * @param numC number of inner stars
2104
- */
2105
- static createStarsInStars(rA0, rA1, numAPoint, rB0, rB1, numBPoint, rC, numC, close) {
2106
- const loops = [];
2107
- loops.push(this.createStar(0, 0, 0, rA0, rA1, numAPoint, close));
2108
- if (numC > 0) {
2109
- const radiansStep = Math.PI * 2.0 / numC;
2110
- for (let i = 0; i < numC; i++) {
2111
- const radians = i * radiansStep;
2112
- loops.push(this.createStar(rC * Math.cos(radians), rC * Math.sin(radians), 0.0, rB0, rB1, numBPoint, close));
2113
- }
2114
- }
2115
- return loops;
2116
- }
2117
- static appendGeometry(source, dest) {
2118
- for (const g of source)
2119
- dest.push(g);
2120
- }
2121
- /** Create a simple example of each GeometryQuery type .... */
2122
- static createAllGeometryQueryTypes() {
2123
- const result = [];
2124
- const pointA = Point3d.create(0, 0, 0);
2125
- const pointB = Point3d.create(1, 0, 0);
2126
- const pointC = Point3d.create(1, 1, 0);
2127
- const pointD = Point3d.create(0, 1, 0);
2128
- const pointABC = [pointA, pointB, pointC];
2129
- const pointABCD = [pointA, pointB, pointC, pointD];
2130
- const pointABCD1 = [pointA, pointB, pointC, pointD, pointA];
2131
- result.push(LineSegment3d.create(pointA, pointB));
2132
- result.push(CoordinateXYZ.create(pointA));
2133
- result.push(Arc3d.createCircularStartMiddleEnd(pointA, pointB, pointC));
2134
- result.push(PointString3d.create(pointA, pointB));
2135
- result.push(IntegratedSpiral3d.createRadiusRadiusBearingBearing(Segment1d.create(0, 100), AngleSweep.createStartEndDegrees(0, 5), Segment1d.create(0, 0.5), Transform.createIdentity()));
2136
- result.push(LineString3d.create(pointABCD));
2137
- result.push(BezierCurve3d.create(pointABC));
2138
- result.push(BezierCurve3dH.create(pointABC));
2139
- result.push(BSplineCurve3d.createUniformKnots(pointABC, 3));
2140
- result.push(BSplineCurve3dH.createUniformKnots(pointABC, 3));
2141
- result.push(Loop.create(LineString3d.create(pointABCD1)));
2142
- result.push(Path.create(LineString3d.create(pointABCD)));
2143
- result.push(this.createConeBsplineSurface(pointA, pointC, 1, 2, 4));
2144
- result.push(this.createXYGridBsplineSurface(8, 4, 4, 3));
2145
- this.appendGeometry(this.createClosedSolidSampler(true), result);
2146
- result.push(this.createTriangularUnitGridPolyface(pointA, Vector3d.unitX(), Vector3d.unitY(), 4, 5));
2147
- result.push(this.createTriangularUnitGridPolyface(pointA, Vector3d.unitX(), Vector3d.unitY(), 4, 5, true, true, true, false));
2148
- this.appendGeometry(this.createSimpleParityRegions(), result);
2149
- this.appendGeometry(this.createSimpleUnions(), result);
2150
- this.appendGeometry(this.createBagOfCurves(), result);
2151
- return result;
2152
- }
2153
- /**
2154
- * Create points on a sine wave.
2155
- * * Point i is origin + (i * xStep, a *sin(theta0 + i * dTheta), b * sin(beta0 + i * dBeta)).
2156
- * * Default b is zero, so it is a simple sine wave.
2157
- * * If the dTheta and dBeta are equal, it is a sine wave in a tilted plane.
2158
- * * If dTheta and dBeta are different it is a non-planar curve.
2159
- */
2160
- static createPointSineWave(origin, numInterval = 24, xStep = Math.PI / 12, a = 1, thetaSweep = AngleSweep.createStartEndDegrees(0, 360), b = 0, betaSweep = AngleSweep.createStartEndDegrees(0, 180)) {
2161
- return this.createPointsByIndexFunctions(numInterval, SteppedIndexFunctionFactory.createLinear(xStep, origin ? origin.x : 0), SteppedIndexFunctionFactory.createCosine(a, thetaSweep, origin ? origin.y : 0), SteppedIndexFunctionFactory.createCosine(b, betaSweep, origin ? origin.z : 0));
2162
- }
2163
- /**
2164
- * Create points with x,y,z independent functions of i and numInterval,
2165
- * Point3d.create (fx(i,numInterval), fy(i,numInterval), fz(i, numInterval));
2166
- */
2167
- static createPointsByIndexFunctions(numInterval, fx, fy, fz) {
2168
- const points = [];
2169
- if (numInterval > 0) {
2170
- for (let i = 0; i <= numInterval; i++) {
2171
- points.push(Point3d.create(fx(i, numInterval), fy(i, numInterval), fz ? fz(i, numInterval) : 0));
2172
- }
2173
- }
2174
- return points;
2175
- }
2176
- /**
2177
- * Add an AuxData (with multiple AuxChannelData) using data evaluated by a function of input and xyz.
2178
- * @param data existing polyface data object to receive the additional AuxChannel
2179
- * @param channelIndex
2180
- * @param name name of channel
2181
- * @param inputName name of input
2182
- * @param input0 input value for channel 0
2183
- * @param inputStep step between inputs (channels)
2184
- * @param numInput number of channels (inputs)
2185
- * @param dataType
2186
- * @param scalarFunction function to return the scalar value at (input, point)
2187
- */
2188
- static addAuxDataScalarChannel(data, channelIndex, name, inputName, input0, inputStep, numInput, dataType, scalarFunction) {
2189
- if (!data.auxData)
2190
- data.auxData = new PolyfaceAuxData([], []);
2191
- const channelDataArray = [];
2192
- const xyz = Point3d.create();
2193
- for (let i = 0; i < numInput; i++) {
2194
- const input = input0 + i * inputStep;
2195
- const values = [];
2196
- for (let k = 0; k < data.point.length; k++) {
2197
- data.point.getPoint3dAtUncheckedPointIndex(k, xyz);
2198
- values.push(scalarFunction(input, xyz));
2199
- }
2200
- channelDataArray.push(new AuxChannelData(input, values));
2201
- }
2202
- const channel = new AuxChannel(channelDataArray, dataType, name, inputName);
2203
- for (const _q of data.pointIndex) {
2204
- data.auxData.indices.push(channelIndex);
2205
- }
2206
- data.auxData.channels.push(channel);
2207
- }
2208
- /**
2209
- * Create a mesh between concentric arcs
2210
- * @param edgesPerQuadrant edges per 90 degrees
2211
- * @param center arc center
2212
- * @param r0 first radius
2213
- * @param r1 second radius
2214
- * @param theta0 start angle
2215
- * @param theta1 end angle.
2216
- * @returns
2217
- */
2218
- static createMeshInAnnulus(edgesPerQuadrant, center, r0, r1, theta0, theta1) {
2219
- const point0 = [];
2220
- const point1 = [];
2221
- if (edgesPerQuadrant < 1)
2222
- edgesPerQuadrant = 1;
2223
- let edgeCount = Math.ceil(edgesPerQuadrant * (theta1.degrees - theta0.degrees) / 90);
2224
- if (edgeCount < 1)
2225
- edgeCount = 1;
2226
- for (let i = 0; i <= edgeCount; i++) {
2227
- const theta = Angle.createInterpolate(theta0, i / edgeCount, theta1);
2228
- point0.push(center.plusXYZ(r0 * theta.cos(), r0 * theta.sin(), 0));
2229
- point1.push(center.plusXYZ(r1 * theta.cos(), r1 * theta.sin(), 0));
2230
- }
2231
- point1.reverse();
2232
- const builder = PolyfaceBuilder.create();
2233
- builder.addGreedyTriangulationBetweenLineStrings(point0, point1);
2234
- return builder.claimPolyface();
2235
- }
2236
- /** Create strokes on an arc at radius r0, then returning at radius r1. */
2237
- static createAnnulusPolyline(edgesPerQuadrant, center, r0, r1, theta0, theta1, addClosure) {
2238
- const point0 = [];
2239
- const point1 = [];
2240
- if (edgesPerQuadrant < 1)
2241
- edgesPerQuadrant = 1;
2242
- let edgeCount = Math.ceil(edgesPerQuadrant * (theta1.degrees - theta0.degrees) / 90);
2243
- if (edgeCount < 1)
2244
- edgeCount = 1;
2245
- for (let i = 0; i <= edgeCount; i++) {
2246
- const theta = Angle.createInterpolate(theta0, i / edgeCount, theta1);
2247
- point0.push(center.plusXYZ(r0 * theta.cos(), r0 * theta.sin(), 0));
2248
- point1.push(center.plusXYZ(r1 * theta.cos(), r1 * theta.sin(), 0));
2249
- }
2250
- while (point1.length > 0)
2251
- point0.push(point1.pop());
2252
- if (addClosure)
2253
- point0.push(point0[0].clone());
2254
- return point0;
2255
- }
2256
- /**
2257
- * Create a grid of lat-long points on a sphere.
2258
- * * If pole latitudes appear in the evaluation, a single point (not a circle) is evaluated.
2259
- * * Circles at various latitudes proceed south to north.
2260
- * * If first and last angles of longitudeSweep match, that meridian is not duplicated.
2261
- * * Longitudes can wrap freely.
2262
- * @param transform local to world
2263
- * @param numLatitudeStep number of latitude steps (poles count if they are in the sweeps)
2264
- * @param numLongitudeStep number of longitude steps
2265
- * @param latitudeSweep angle range for latitudes
2266
- * @param longitudeSweep angle range for longitudes
2267
- */
2268
- static createGridPointsOnEllipsoid(transform, numLatitudeStep, numLongitudeStep, latitudeSweep = AngleSweep.createStartEndDegrees(-90, 90), longitudeSweep = AngleSweep.createStartEndDegrees(0, 360)) {
2269
- const points = [];
2270
- const numJ = numLatitudeStep + 1;
2271
- const jFractionStep = 1.0 / numJ;
2272
- let numI = numLongitudeStep;
2273
- const iFractionStep = 1.0 / numI;
2274
- if (longitudeSweep.isFullCircle)
2275
- numI--;
2276
- for (let j = 0; j < numJ; j++) {
2277
- const phi = latitudeSweep.fractionToRadians(jFractionStep * j);
2278
- const sinPhi = Math.sin(phi);
2279
- const cosPhi = Math.cos(phi);
2280
- const numIThisCircle = Angle.isAlmostEqualRadiansAllowPeriodShift(phi, -90) ? 1 : numI;
2281
- for (let i = 0; i < numIThisCircle; i++) {
2282
- const theta = longitudeSweep.fractionToRadians(iFractionStep * i);
2283
- const cosTheta = Math.cos(theta);
2284
- const sinTheta = Math.sin(theta);
2285
- points.push(transform.multiplyXYZ(cosTheta * cosPhi, sinTheta * cosPhi, sinPhi));
2286
- }
2287
- }
2288
- return points;
2289
- }
2290
- /**
2291
- * Return an array of points on a circular arc.
2292
- * @param edgesPerQuadrant number of edges per 90 degrees
2293
- * @param center arc center
2294
- * @param r0 arc radius
2295
- * @param theta0 start angle
2296
- * @param theta1 end angle
2297
- * @param addClosure true to add a closure stroke
2298
- * @returns
2299
- */
2300
- static createArcStrokes(edgesPerQuadrant, center, r0, theta0, theta1, addClosure = true, z = 0) {
2301
- const point0 = [];
2302
- if (edgesPerQuadrant < 1)
2303
- edgesPerQuadrant = 1;
2304
- let edgeCount = Math.ceil(edgesPerQuadrant * (theta1.degrees - theta0.degrees) / 90);
2305
- if (edgeCount < 1)
2306
- edgeCount = 1;
2307
- for (let i = 0; i <= edgeCount; i++) {
2308
- const theta = Angle.createInterpolate(theta0, i / edgeCount, theta1);
2309
- point0.push(center.plusXYZ(r0 * theta.cos(), r0 * theta.sin(), z));
2310
- }
2311
- if (addClosure)
2312
- point0.push(point0[0].clone());
2313
- return point0;
2314
- }
2315
- /**
2316
- * Create a mesh with
2317
- * * xy facets are 1x1 quads starting at origin
2318
- * * acceptFunction is called to accept or reject each quad's lower left xy coordinates
2319
- * @param xzPoints array of points in the xz plane. Expected to have increasing x and all integer coordinates.
2320
- * @param ySweep distance to sweep in y direction
2321
- * @param acceptFunction (x0: number, y0: number)=> boolean
2322
- */
2323
- static sweepXZLineStringToMeshWithHoles(xzPoints, ySweep, acceptFunction) {
2324
- const builder = PolyfaceBuilder.create();
2325
- for (let i0 = 0; i0 + 1 < xzPoints.length; i0++) {
2326
- const x0 = xzPoints[i0][0];
2327
- const z0 = xzPoints[i0][1];
2328
- const i1 = i0 + 1;
2329
- const x1 = xzPoints[i1][0];
2330
- const z1 = xzPoints[i1][1];
2331
- for (let xA = x0; xA + 1 <= x1; xA++) {
2332
- const xB = xA + 1;
2333
- const sA = (xA - x0) / (x1 - x0);
2334
- const sB = (xB - x0) / (x1 - x0);
2335
- const zA = Geometry.interpolate(z0, sA, z1);
2336
- const zB = Geometry.interpolate(z0, sB, z1);
2337
- for (let yC = 0; yC + 1 <= ySweep; yC++) {
2338
- const yD = yC + 1;
2339
- if (acceptFunction(xA, yC))
2340
- builder.addPolygon([
2341
- Point3d.create(xA, yC, zA),
2342
- Point3d.create(xB, yC, zB),
2343
- Point3d.create(xB, yD, zB),
2344
- Point3d.create(xA, yD, zA),
2345
- ]);
2346
- }
2347
- }
2348
- }
2349
- return builder.claimPolyface(true);
2350
- }
2351
- /**
2352
- * Successively move in directions in the steps array, creating numStroke total strokes.
2353
- * * In typical use there are two entries in the steps vector, giving the effect of stair steps if they are perpendicular.
2354
- * * if start is a single point, create a new point array with start as its first entry.
2355
- * * if start is an array, add to it.
2356
- * * if start is an empty array, push 000 as starting point.
2357
- * @param start start point or prior array of points whose last is start point.
2358
- * @param steps array of vectors giving step vectors.
2359
- * @param numStroke number of steps to take.
2360
- */
2361
- static createZigZag(start, steps, numStroke) {
2362
- let result;
2363
- if (Array.isArray(start)) {
2364
- result = start;
2365
- if (result.length === 0)
2366
- result.push(Point3d.create(0, 0, 0));
2367
- }
2368
- else {
2369
- result = [start.clone()];
2370
- }
2371
- let numAdded = 0;
2372
- for (;;) {
2373
- for (const step of steps) {
2374
- if (++numAdded > numStroke)
2375
- return result;
2376
- result.push(result[result.length - 1].plus(step));
2377
- }
2378
- }
2379
- }
2380
- /** Create a point on the polar parametric curve r = cos(a * theta), aka "rose".
2381
- * @param theta angle
2382
- * @param a period multiplier. If odd, this is the petal count; if even, twice the number of petals.
2383
- * @param z z-coordinate for output
2384
- */
2385
- static createRosePoint3d(theta, a, z = 0) {
2386
- const r = Math.cos(a * theta);
2387
- return Point3d.create(r * Math.cos(theta), r * Math.sin(theta), z);
2388
- }
2389
- /** Create a point on the polar parametric curve r = cos(a * theta), aka "rose".
2390
- * @param theta angle
2391
- * @param a period multiplier. If odd, this is the petal count; if even, twice the number of petals.
2392
- */
2393
- static createRosePoint2d(theta, a) {
2394
- return Point2d.createFrom(Sample.createRosePoint3d(theta, a));
2395
- }
2396
- /**
2397
- * Create a mesh surface from samples of a smooth real-valued function over [0,1]x[0,1] with multiple humps and dips.
2398
- * * The facets are bilinear quads, so if planar facets are required, set `options.shouldTriangulate = true`.
2399
- * @param size grid size; the number of intervals on each side of the unit square domain.
2400
- * @param scales = array of 4 (four) numbers to scale the corresponding Franke exponential. If undefined, all scales are 1.
2401
- */
2402
- static createMeshFromFrankeSurface(size, options, scales) {
2403
- const builder = PolyfaceBuilder.create(options);
2404
- builder.addUVGridBody(new FrankeSurface(scales), size, size);
2405
- return builder.claimPolyface(true);
2406
- }
2407
- /** Stroke a helix over the unit circle. Place in space via a transform.
2408
- * The various columns of the transform become the critical measures for the (elliptic) helix:
2409
- * The unit cylinder maps to an elliptic cylinder with x and y columns as 0 and 90 degree vectors.
2410
- * the Helix pitch is equal to the length of the z axis in the transform.
2411
- * The completeTurns parameter (which does NOT need to be an integer) is the local z of the last point
2412
- */
2413
- static createHelixPoints(completeTurns, numPoints, placement) {
2414
- const points = [];
2415
- if (numPoints < 2)
2416
- numPoints = 2;
2417
- const dThetaRadians = completeTurns * Math.PI * 2 / (numPoints - 1);
2418
- const dz = completeTurns / (numPoints - 1);
2419
- for (let i = 0; i < numPoints; i++) {
2420
- const thetaRadians = dThetaRadians * i;
2421
- points.push(Point3d.create(Math.cos(thetaRadians), Math.sin(thetaRadians), i * dz));
2422
- }
2423
- if (placement)
2424
- placement.multiplyPoint3dArrayInPlace(points);
2425
- return points;
2426
- }
2427
- }
2428
- //# sourceMappingURL=GeometrySamples.js.map