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

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