@jscad/modeling 3.0.2-alpha.0 → 3.0.4-alpha.0

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 (232) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/jscad-modeling.es.js +2 -7
  3. package/dist/jscad-modeling.min.js +2 -7
  4. package/package.json +6 -7
  5. package/rollup.config.js +8 -4
  6. package/src/colors/colorize.test.js +1 -1
  7. package/src/curves/bezier/arcLengthToT.js +1 -1
  8. package/src/curves/bezier/create.js +1 -1
  9. package/src/curves/bezier/index.js +7 -7
  10. package/src/curves/bezier/length.js +1 -1
  11. package/src/curves/bezier/lengths.js +2 -1
  12. package/src/curves/bezier/tangentAt.js +1 -1
  13. package/src/curves/bezier/valueAt.js +1 -1
  14. package/src/curves/index.js +3 -3
  15. package/src/geometries/geom2/applyTransforms.js +3 -1
  16. package/src/geometries/geom2/clone.js +5 -1
  17. package/src/geometries/geom2/create.js +4 -14
  18. package/src/geometries/geom2/fromSides.js +4 -2
  19. package/src/geometries/geom2/index.d.ts +0 -2
  20. package/src/geometries/geom2/index.js +21 -7
  21. package/src/geometries/geom2/isA.js +5 -1
  22. package/src/geometries/geom2/reverse.js +4 -2
  23. package/src/geometries/geom2/toOutlines.js +2 -1
  24. package/src/geometries/geom2/toPoints.js +5 -2
  25. package/src/geometries/geom2/toSides.js +4 -3
  26. package/src/geometries/geom2/toString.js +3 -2
  27. package/src/geometries/geom2/transform.js +4 -2
  28. package/src/geometries/geom2/validate.js +6 -2
  29. package/src/geometries/geom3/applyTransforms.test.js +2 -2
  30. package/src/geometries/geom3/clone.js +5 -1
  31. package/src/geometries/geom3/clone.test.js +2 -2
  32. package/src/geometries/geom3/create.js +6 -28
  33. package/src/geometries/geom3/{fromPoints.d.ts → fromVertices.d.ts} +1 -1
  34. package/src/geometries/geom3/{fromPoints.js → fromVertices.js} +15 -2
  35. package/src/geometries/geom3/{fromPoints.test.js → fromVertices.test.js} +6 -6
  36. package/src/geometries/geom3/{fromPointsConvex.d.ts → fromVerticesConvex.d.ts} +1 -1
  37. package/src/geometries/geom3/fromVerticesConvex.js +25 -0
  38. package/src/geometries/geom3/{fromPointsConvex.test.js → fromVerticesConvex.test.js} +3 -3
  39. package/src/geometries/geom3/index.d.ts +4 -5
  40. package/src/geometries/geom3/index.js +29 -9
  41. package/src/geometries/geom3/invert.js +5 -1
  42. package/src/geometries/geom3/invert.test.js +2 -2
  43. package/src/geometries/geom3/isA.js +5 -1
  44. package/src/geometries/geom3/isA.test.js +2 -2
  45. package/src/geometries/geom3/isConvex.d.ts +3 -0
  46. package/src/geometries/geom3/isConvex.js +65 -0
  47. package/src/geometries/geom3/isConvex.test.js +44 -0
  48. package/src/geometries/geom3/toPolygons.js +4 -2
  49. package/src/geometries/geom3/toString.js +3 -2
  50. package/src/geometries/geom3/toString.test.js +2 -2
  51. package/src/geometries/geom3/{toPoints.d.ts → toVertices.d.ts} +1 -1
  52. package/src/geometries/geom3/toVertices.js +20 -0
  53. package/src/geometries/geom3/{toPoints.test.js → toVertices.test.js} +4 -4
  54. package/src/geometries/geom3/transform.js +5 -2
  55. package/src/geometries/geom3/transform.test.js +2 -2
  56. package/src/geometries/geom3/validate.js +6 -2
  57. package/src/geometries/geom3/validate.test.js +4 -4
  58. package/src/geometries/index.d.ts +1 -0
  59. package/src/geometries/index.js +10 -7
  60. package/src/geometries/path2/appendArc.js +7 -5
  61. package/src/geometries/path2/appendArc.test.js +11 -15
  62. package/src/geometries/path2/appendBezier.js +6 -4
  63. package/src/geometries/path2/appendPoints.js +4 -2
  64. package/src/geometries/path2/applyTransforms.js +3 -0
  65. package/src/geometries/path2/clone.js +5 -1
  66. package/src/geometries/path2/close.js +5 -1
  67. package/src/geometries/path2/concat.js +3 -2
  68. package/src/geometries/path2/create.js +5 -25
  69. package/src/geometries/path2/equals.js +12 -7
  70. package/src/geometries/path2/fromPoints.js +5 -3
  71. package/src/geometries/path2/index.d.ts +0 -2
  72. package/src/geometries/path2/index.js +21 -6
  73. package/src/geometries/path2/isA.js +5 -1
  74. package/src/geometries/path2/reverse.js +4 -2
  75. package/src/geometries/path2/toPoints.js +5 -3
  76. package/src/geometries/path2/toString.js +3 -2
  77. package/src/geometries/path2/transform.js +4 -2
  78. package/src/geometries/path2/validate.js +5 -1
  79. package/src/geometries/path3/applyTransforms.js +22 -0
  80. package/src/geometries/path3/applyTransforms.test.js +28 -0
  81. package/src/geometries/path3/close.d.ts +3 -0
  82. package/src/geometries/path3/close.js +33 -0
  83. package/src/geometries/path3/close.test.js +43 -0
  84. package/src/geometries/path3/concat.d.ts +3 -0
  85. package/src/geometries/path3/concat.js +35 -0
  86. package/src/geometries/path3/concat.test.js +35 -0
  87. package/src/geometries/path3/create.d.ts +4 -0
  88. package/src/geometries/path3/create.js +14 -0
  89. package/src/geometries/path3/create.test.js +8 -0
  90. package/src/geometries/path3/equals.d.ts +3 -0
  91. package/src/geometries/path3/equals.js +50 -0
  92. package/src/geometries/path3/equals.test.js +38 -0
  93. package/src/geometries/path3/fromVertices.d.ts +8 -0
  94. package/src/geometries/path3/fromVertices.js +44 -0
  95. package/src/geometries/path3/fromVertices.test.js +33 -0
  96. package/src/geometries/path3/index.d.ts +13 -0
  97. package/src/geometries/path3/index.js +37 -0
  98. package/src/geometries/path3/isA.d.ts +3 -0
  99. package/src/geometries/path3/isA.js +22 -0
  100. package/src/geometries/path3/isA.test.js +19 -0
  101. package/src/geometries/path3/reverse.d.ts +3 -0
  102. package/src/geometries/path3/reverse.js +18 -0
  103. package/src/geometries/path3/reverse.test.js +9 -0
  104. package/src/geometries/path3/toString.d.ts +3 -0
  105. package/src/geometries/path3/toString.js +23 -0
  106. package/src/geometries/path3/toVertices.d.ts +4 -0
  107. package/src/geometries/path3/toVertices.js +15 -0
  108. package/src/geometries/path3/toVertices.test.js +13 -0
  109. package/src/geometries/path3/transform.d.ts +4 -0
  110. package/src/geometries/path3/transform.js +20 -0
  111. package/src/geometries/path3/transform.test.js +50 -0
  112. package/src/geometries/path3/type.d.ts +10 -0
  113. package/src/geometries/path3/validate.d.ts +1 -0
  114. package/src/geometries/path3/validate.js +44 -0
  115. package/src/geometries/poly2/arePointsInside.js +4 -1
  116. package/src/geometries/poly2/clone.js +4 -1
  117. package/src/geometries/poly2/create.js +3 -15
  118. package/src/geometries/poly2/index.js +16 -4
  119. package/src/geometries/poly2/isA.js +5 -1
  120. package/src/geometries/poly2/isConvex.js +5 -1
  121. package/src/geometries/poly2/isSimple.js +5 -1
  122. package/src/geometries/poly2/measureArea.js +4 -1
  123. package/src/geometries/poly2/measureBoundingBox.js +6 -1
  124. package/src/geometries/poly2/reverse.js +4 -1
  125. package/src/geometries/poly2/toPoints.js +6 -1
  126. package/src/geometries/poly2/toString.js +5 -1
  127. package/src/geometries/poly2/transform.js +5 -1
  128. package/src/geometries/poly2/validate.js +6 -2
  129. package/src/geometries/poly3/clone.js +4 -1
  130. package/src/geometries/poly3/create.js +4 -17
  131. package/src/geometries/poly3/fromVerticesAndPlane.js +3 -1
  132. package/src/geometries/poly3/index.js +19 -4
  133. package/src/geometries/poly3/invert.js +4 -1
  134. package/src/geometries/poly3/isA.js +5 -1
  135. package/src/geometries/poly3/isConvex.js +5 -1
  136. package/src/geometries/poly3/measureArea.js +5 -1
  137. package/src/geometries/poly3/measureBoundingBox.js +4 -1
  138. package/src/geometries/poly3/measureBoundingSphere.js +4 -3
  139. package/src/geometries/poly3/measureSignedVolume.js +6 -1
  140. package/src/geometries/poly3/plane.js +6 -0
  141. package/src/geometries/poly3/toString.js +5 -1
  142. package/src/geometries/poly3/toVertices.js +6 -1
  143. package/src/geometries/poly3/transform.js +5 -1
  144. package/src/geometries/poly3/validate.js +6 -2
  145. package/src/geometries/slice/calculatePlane.js +3 -3
  146. package/src/geometries/slice/clone.js +4 -1
  147. package/src/geometries/slice/create.js +5 -10
  148. package/src/geometries/slice/equals.js +5 -1
  149. package/src/geometries/slice/fromGeom2.js +1 -1
  150. package/src/geometries/slice/fromVertices.js +3 -3
  151. package/src/geometries/slice/index.js +19 -4
  152. package/src/geometries/slice/isA.js +5 -1
  153. package/src/geometries/slice/reverse.js +5 -2
  154. package/src/geometries/slice/toEdges.js +5 -3
  155. package/src/geometries/slice/toPolygons.js +5 -1
  156. package/src/geometries/slice/toString.js +5 -1
  157. package/src/geometries/slice/toVertices.js +5 -3
  158. package/src/geometries/slice/transform.js +4 -3
  159. package/src/geometries/slice/validate.js +3 -2
  160. package/src/index.d.ts +1 -0
  161. package/src/index.js +4 -0
  162. package/src/maths/constants.js +11 -7
  163. package/src/maths/index.js +2 -1
  164. package/src/maths/mat4/isOnlyTransformScale.js +1 -1
  165. package/src/operations/booleans/index.js +2 -0
  166. package/src/operations/booleans/intersect.js +0 -1
  167. package/src/operations/booleans/intersectGeom3.test.js +4 -4
  168. package/src/operations/booleans/scission.js +0 -1
  169. package/src/operations/booleans/subtractGeom3.test.js +4 -4
  170. package/src/operations/booleans/trees/splitLineSegmentByPlane.js +1 -4
  171. package/src/operations/booleans/trees/splitPolygonByPlane.test.js +138 -0
  172. package/src/operations/booleans/unionGeom3.test.js +40 -5
  173. package/src/operations/extrusions/extrudeFromSlices.js +15 -5
  174. package/src/operations/extrusions/extrudeFromSlices.test.js +6 -6
  175. package/src/operations/extrusions/extrudeLinear.test.js +8 -8
  176. package/src/operations/extrusions/extrudeRotate.js +2 -1
  177. package/src/operations/extrusions/extrudeRotate.test.js +46 -12
  178. package/src/operations/extrusions/extrudeWalls.test.js +60 -0
  179. package/src/operations/hulls/hull.test.js +5 -5
  180. package/src/operations/hulls/hullChain.test.js +5 -5
  181. package/src/operations/hulls/toUniquePoints.js +2 -2
  182. package/src/operations/minkowski/index.d.ts +1 -0
  183. package/src/operations/minkowski/index.js +15 -0
  184. package/src/operations/minkowski/minkowskiSum.d.ts +4 -0
  185. package/src/operations/minkowski/minkowskiSum.js +223 -0
  186. package/src/operations/minkowski/minkowskiSum.test.js +199 -0
  187. package/src/operations/modifiers/generalize.test.js +6 -6
  188. package/src/operations/modifiers/insertTjunctions.test.js +2 -2
  189. package/src/operations/modifiers/reTesselateCoplanarPolygons.js +10 -3
  190. package/src/operations/modifiers/reTesselateCoplanarPolygons.test.js +36 -1
  191. package/src/operations/modifiers/retessellate.js +4 -2
  192. package/src/operations/modifiers/retessellate.test.js +10 -10
  193. package/src/operations/modifiers/snap.test.js +28 -19
  194. package/src/operations/offsets/offsetGeom3.test.js +9 -11
  195. package/src/operations/transforms/center.test.js +7 -7
  196. package/src/operations/transforms/mirror.test.js +7 -7
  197. package/src/operations/transforms/rotate.test.js +7 -7
  198. package/src/operations/transforms/scale.test.js +7 -7
  199. package/src/operations/transforms/transform.test.js +2 -2
  200. package/src/operations/transforms/translate.test.js +7 -7
  201. package/src/primitives/arc.js +2 -2
  202. package/src/primitives/arc.test.js +104 -113
  203. package/src/primitives/cube.test.js +4 -4
  204. package/src/primitives/cuboid.test.js +4 -4
  205. package/src/primitives/cylinder.test.js +5 -5
  206. package/src/primitives/cylinderElliptic.test.js +9 -9
  207. package/src/primitives/ellipsoid.test.js +5 -5
  208. package/src/primitives/geodesicSphere.test.js +4 -4
  209. package/src/primitives/polyhedron.test.js +2 -2
  210. package/src/primitives/roundedCuboid.test.js +7 -7
  211. package/src/primitives/roundedCylinder.test.js +9 -9
  212. package/src/primitives/sphere.test.js +5 -5
  213. package/src/primitives/torus.test.js +4 -4
  214. package/src/utils/flatten.js +1 -1
  215. package/src/utils/flatten.test.js +94 -0
  216. package/src/geometries/geom2/fromCompactBinary.d.ts +0 -3
  217. package/src/geometries/geom2/fromCompactBinary.js +0 -40
  218. package/src/geometries/geom2/fromToCompactBinary.test.js +0 -100
  219. package/src/geometries/geom2/toCompactBinary.d.ts +0 -3
  220. package/src/geometries/geom2/toCompactBinary.js +0 -56
  221. package/src/geometries/geom3/fromCompactBinary.d.ts +0 -3
  222. package/src/geometries/geom3/fromCompactBinary.js +0 -42
  223. package/src/geometries/geom3/fromPointsConvex.js +0 -25
  224. package/src/geometries/geom3/fromToCompactBinary.test.js +0 -139
  225. package/src/geometries/geom3/toCompactBinary.d.ts +0 -3
  226. package/src/geometries/geom3/toCompactBinary.js +0 -66
  227. package/src/geometries/geom3/toPoints.js +0 -15
  228. package/src/geometries/path2/fromCompactBinary.d.ts +0 -3
  229. package/src/geometries/path2/fromCompactBinary.js +0 -31
  230. package/src/geometries/path2/fromToCompactBinary.test.js +0 -114
  231. package/src/geometries/path2/toCompactBinary.d.ts +0 -3
  232. package/src/geometries/path2/toCompactBinary.js +0 -50
@@ -77,11 +77,11 @@ test('mirror: mirroring of geom3 about X/Y/Z produces expected changes to polygo
77
77
  [[-2, -7, -12], [-2, 13, -12], [8, 13, -12], [8, -7, -12]],
78
78
  [[-2, -7, 18], [8, -7, 18], [8, 13, 18], [-2, 13, 18]]
79
79
  ]
80
- const geometry = geom3.fromPoints(points)
80
+ const geometry = geom3.fromVertices(points)
81
81
 
82
82
  // mirror about X
83
83
  let mirrored = mirror({ normal: [1, 0, 0] }, geometry)
84
- let obs = geom3.toPoints(mirrored)
84
+ let obs = geom3.toVertices(mirrored)
85
85
  let exp = [
86
86
  [[2, 13, -12], [2, 13, 18], [2, -7, 18], [2, -7, -12]],
87
87
  [[-8, -7, 18], [-8, 13, 18], [-8, 13, -12], [-8, -7, -12]],
@@ -96,14 +96,14 @@ test('mirror: mirroring of geom3 about X/Y/Z produces expected changes to polygo
96
96
  t.deepEqual(obs, exp)
97
97
 
98
98
  mirrored = mirrorX(geometry)
99
- obs = geom3.toPoints(mirrored)
99
+ obs = geom3.toVertices(mirrored)
100
100
  t.notThrows(() => geom3.validate(mirrored))
101
101
  t.is(measureVolume(mirrored), measureVolume(geometry))
102
102
  t.true(comparePolygonsAsPoints(obs, exp))
103
103
 
104
104
  // mirror about Y
105
105
  mirrored = mirror({ normal: [0, 1, 0] }, geometry)
106
- obs = geom3.toPoints(mirrored)
106
+ obs = geom3.toVertices(mirrored)
107
107
  exp = [
108
108
  [[-2, -13, -12], [-2, -13, 18], [-2, 7, 18], [-2, 7, -12]],
109
109
  [[8, 7, 18], [8, -13, 18], [8, -13, -12], [8, 7, -12]],
@@ -117,14 +117,14 @@ test('mirror: mirroring of geom3 about X/Y/Z produces expected changes to polygo
117
117
  t.true(comparePolygonsAsPoints(obs, exp))
118
118
 
119
119
  mirrored = mirrorY(geometry)
120
- obs = geom3.toPoints(mirrored)
120
+ obs = geom3.toVertices(mirrored)
121
121
  t.notThrows(() => geom3.validate(mirrored))
122
122
  t.is(measureVolume(mirrored), measureVolume(geometry))
123
123
  t.true(comparePolygonsAsPoints(obs, exp))
124
124
 
125
125
  // mirror about Z
126
126
  mirrored = mirror({ normal: [0, 0, 1] }, geometry)
127
- obs = geom3.toPoints(mirrored)
127
+ obs = geom3.toVertices(mirrored)
128
128
  exp = [
129
129
  [[-2, 13, 12], [-2, 13, -18], [-2, -7, -18], [-2, -7, 12]],
130
130
  [[8, -7, -18], [8, 13, -18], [8, 13, 12], [8, -7, 12]],
@@ -138,7 +138,7 @@ test('mirror: mirroring of geom3 about X/Y/Z produces expected changes to polygo
138
138
  t.true(comparePolygonsAsPoints(obs, exp))
139
139
 
140
140
  mirrored = mirrorZ(geometry)
141
- obs = geom3.toPoints(mirrored)
141
+ obs = geom3.toVertices(mirrored)
142
142
  t.notThrows(() => geom3.validate(mirrored))
143
143
  t.is(measureVolume(mirrored), measureVolume(geometry))
144
144
  t.true(comparePolygonsAsPoints(obs, exp))
@@ -60,11 +60,11 @@ test('rotate: rotating of a geom3 produces expected changes to polygons', (t) =>
60
60
  [[-2, -7, -12], [-2, 13, -12], [8, 13, -12], [8, -7, -12]],
61
61
  [[-2, -7, 18], [8, -7, 18], [8, 13, 18], [-2, 13, 18]]
62
62
  ]
63
- const geometry = geom3.fromPoints(points)
63
+ const geometry = geom3.fromVertices(points)
64
64
 
65
65
  // rotate about X
66
66
  let rotated = rotate([TAU / 4], geometry)
67
- let obs = geom3.toPoints(rotated)
67
+ let obs = geom3.toVertices(rotated)
68
68
  let exp = [
69
69
  [[-2, 12, -7.000000000000001], [-2, -18, -6.999999999999999],
70
70
  [-2, -18, 13.000000000000002], [-2, 12, 13]],
@@ -84,14 +84,14 @@ test('rotate: rotating of a geom3 produces expected changes to polygons', (t) =>
84
84
  t.true(comparePolygonsAsPoints(obs, exp))
85
85
 
86
86
  rotated = rotateX(TAU / 4, geometry)
87
- obs = geom3.toPoints(rotated)
87
+ obs = geom3.toVertices(rotated)
88
88
  t.notThrows(() => geom3.validate(rotated))
89
89
  t.is(measureVolume(rotated), measureVolume(geometry))
90
90
  t.true(comparePolygonsAsPoints(obs, exp))
91
91
 
92
92
  // rotate about Y
93
93
  rotated = rotate([0, -TAU / 4], geometry)
94
- obs = geom3.toPoints(rotated)
94
+ obs = geom3.toVertices(rotated)
95
95
  exp = [
96
96
  [[12, -7, -2.000000000000001], [-18, -7, -1.999999999999999],
97
97
  [-18, 13, -1.999999999999999], [12, 13, -2.000000000000001]],
@@ -111,14 +111,14 @@ test('rotate: rotating of a geom3 produces expected changes to polygons', (t) =>
111
111
  t.true(comparePolygonsAsPoints(obs, exp))
112
112
 
113
113
  rotated = rotateY(-TAU / 4, geometry)
114
- obs = geom3.toPoints(rotated)
114
+ obs = geom3.toVertices(rotated)
115
115
  t.notThrows(() => geom3.validate(rotated))
116
116
  t.is(measureVolume(rotated), measureVolume(geometry))
117
117
  t.true(comparePolygonsAsPoints(obs, exp))
118
118
 
119
119
  // rotate about Z
120
120
  rotated = rotate([0, 0, TAU / 2], geometry)
121
- obs = geom3.toPoints(rotated)
121
+ obs = geom3.toVertices(rotated)
122
122
  exp = [
123
123
  [[2.000000000000001, 7, -12], [2.000000000000001, 7, 18],
124
124
  [1.9999999999999984, -13, 18], [1.9999999999999984, -13, -12]],
@@ -138,7 +138,7 @@ test('rotate: rotating of a geom3 produces expected changes to polygons', (t) =>
138
138
  t.true(comparePolygonsAsPoints(obs, exp))
139
139
 
140
140
  rotated = rotateZ(TAU / 2, geometry)
141
- obs = geom3.toPoints(rotated)
141
+ obs = geom3.toVertices(rotated)
142
142
  t.notThrows(() => geom3.validate(rotated))
143
143
  t.is(measureVolume(rotated), measureVolume(geometry))
144
144
  t.true(comparePolygonsAsPoints(obs, exp))
@@ -77,11 +77,11 @@ test('scale: scaling of a geom3 produces expected changes to polygons', (t) => {
77
77
  [[-2, -7, -12], [-2, 13, -12], [8, 13, -12], [8, -7, -12]],
78
78
  [[-2, -7, 18], [8, -7, 18], [8, 13, 18], [-2, 13, 18]]
79
79
  ]
80
- const geometry = geom3.fromPoints(points)
80
+ const geometry = geom3.fromVertices(points)
81
81
 
82
82
  // scale X
83
83
  let scaled = scale([3], geometry)
84
- let obs = geom3.toPoints(scaled)
84
+ let obs = geom3.toVertices(scaled)
85
85
  let exp = [
86
86
  [[-6, -7, -12], [-6, -7, 18], [-6, 13, 18], [-6, 13, -12]],
87
87
  [[24, -7, -12], [24, 13, -12], [24, 13, 18], [24, -7, 18]],
@@ -95,14 +95,14 @@ test('scale: scaling of a geom3 produces expected changes to polygons', (t) => {
95
95
  t.true(comparePolygonsAsPoints(obs, exp))
96
96
 
97
97
  scaled = scaleX(3, geometry)
98
- obs = geom3.toPoints(scaled)
98
+ obs = geom3.toVertices(scaled)
99
99
  t.notThrows(() => geom3.validate(scaled))
100
100
  t.is(measureVolume(scaled), 3 * measureVolume(geometry))
101
101
  t.true(comparePolygonsAsPoints(obs, exp))
102
102
 
103
103
  // scale Y
104
104
  scaled = scale([1, 0.5], geometry)
105
- obs = geom3.toPoints(scaled)
105
+ obs = geom3.toVertices(scaled)
106
106
  exp = [
107
107
  [[-2, -3.5, -12], [-2, -3.5, 18], [-2, 6.5, 18], [-2, 6.5, -12]],
108
108
  [[8, -3.5, -12], [8, 6.5, -12], [8, 6.5, 18], [8, -3.5, 18]],
@@ -116,14 +116,14 @@ test('scale: scaling of a geom3 produces expected changes to polygons', (t) => {
116
116
  t.true(comparePolygonsAsPoints(obs, exp))
117
117
 
118
118
  scaled = scaleY(0.5, geometry)
119
- obs = geom3.toPoints(scaled)
119
+ obs = geom3.toVertices(scaled)
120
120
  t.notThrows(() => geom3.validate(scaled))
121
121
  t.is(measureVolume(scaled), 0.5 * measureVolume(geometry))
122
122
  t.true(comparePolygonsAsPoints(obs, exp))
123
123
 
124
124
  // scale Z
125
125
  scaled = scale([1, 1, 5], geometry)
126
- obs = geom3.toPoints(scaled)
126
+ obs = geom3.toVertices(scaled)
127
127
  exp = [
128
128
  [[-2, -7, -60], [-2, -7, 90], [-2, 13, 90], [-2, 13, -60]],
129
129
  [[8, -7, -60], [8, 13, -60], [8, 13, 90], [8, -7, 90]],
@@ -137,7 +137,7 @@ test('scale: scaling of a geom3 produces expected changes to polygons', (t) => {
137
137
  t.true(comparePolygonsAsPoints(obs, exp))
138
138
 
139
139
  scaled = scaleZ(5, geometry)
140
- obs = geom3.toPoints(scaled)
140
+ obs = geom3.toVertices(scaled)
141
141
  t.notThrows(() => geom3.validate(scaled))
142
142
  t.is(measureVolume(scaled), 5 * measureVolume(geometry))
143
143
  t.true(comparePolygonsAsPoints(obs, exp))
@@ -40,9 +40,9 @@ test('transform: transforming of a geom3 produces expected changes to polygons',
40
40
  [[-2, -7, -12], [-2, 13, -12], [8, 13, -12], [8, -7, -12]],
41
41
  [[-2, -7, 18], [8, -7, 18], [8, 13, 18], [-2, 13, 18]]
42
42
  ]
43
- let geometry = geom3.fromPoints(points)
43
+ let geometry = geom3.fromVertices(points)
44
44
  geometry = transform(matrix, geometry)
45
- const obs = geom3.toPoints(geometry)
45
+ const obs = geom3.toVertices(geometry)
46
46
  const exp = [
47
47
  [[-5, -10, -15], [-5, -10, 15], [-5, 10, 15], [-5, 10, -15]],
48
48
  [[5, -10, -15], [5, 10, -15], [5, 10, 15], [5, -10, 15]],
@@ -77,11 +77,11 @@ test('translate: translating of a geom3 produces expected changes to polygons',
77
77
  [[-2, -7, -12], [-2, 13, -12], [8, 13, -12], [8, -7, -12]],
78
78
  [[-2, -7, 18], [8, -7, 18], [8, 13, 18], [-2, 13, 18]]
79
79
  ]
80
- const geometry = geom3.fromPoints(points)
80
+ const geometry = geom3.fromVertices(points)
81
81
 
82
82
  // translate X
83
83
  let translated = translate([3], geometry)
84
- let obs = geom3.toPoints(translated)
84
+ let obs = geom3.toVertices(translated)
85
85
  let exp = [
86
86
  [[1, -7, -12], [1, -7, 18], [1, 13, 18], [1, 13, -12]],
87
87
  [[11, -7, -12], [11, 13, -12], [11, 13, 18], [11, -7, 18]],
@@ -95,14 +95,14 @@ test('translate: translating of a geom3 produces expected changes to polygons',
95
95
  t.true(comparePolygonsAsPoints(obs, exp))
96
96
 
97
97
  translated = translateX(3, geometry)
98
- obs = geom3.toPoints(translated)
98
+ obs = geom3.toVertices(translated)
99
99
  t.notThrows(() => geom3.validate(translated))
100
100
  t.is(measureVolume(translated), measureVolume(geometry))
101
101
  t.true(comparePolygonsAsPoints(obs, exp))
102
102
 
103
103
  // translated Y
104
104
  translated = translate([0, 3], geometry)
105
- obs = geom3.toPoints(translated)
105
+ obs = geom3.toVertices(translated)
106
106
  exp = [
107
107
  [[-2, -4, -12], [-2, -4, 18], [-2, 16, 18], [-2, 16, -12]],
108
108
  [[8, -4, -12], [8, 16, -12], [8, 16, 18], [8, -4, 18]],
@@ -116,14 +116,14 @@ test('translate: translating of a geom3 produces expected changes to polygons',
116
116
  t.true(comparePolygonsAsPoints(obs, exp))
117
117
 
118
118
  translated = translateY(3, geometry)
119
- obs = geom3.toPoints(translated)
119
+ obs = geom3.toVertices(translated)
120
120
  t.notThrows(() => geom3.validate(translated))
121
121
  t.is(measureVolume(translated), measureVolume(geometry))
122
122
  t.true(comparePolygonsAsPoints(obs, exp))
123
123
 
124
124
  // translate Z
125
125
  translated = translate([0, 0, 3], geometry)
126
- obs = geom3.toPoints(translated)
126
+ obs = geom3.toVertices(translated)
127
127
  exp = [
128
128
  [[-2, -7, -9], [-2, -7, 21], [-2, 13, 21], [-2, 13, -9]],
129
129
  [[8, -7, -9], [8, 13, -9], [8, 13, 21], [8, -7, 21]],
@@ -137,7 +137,7 @@ test('translate: translating of a geom3 produces expected changes to polygons',
137
137
  t.true(comparePolygonsAsPoints(obs, exp))
138
138
 
139
139
  translated = translateZ(3, geometry)
140
- obs = geom3.toPoints(translated)
140
+ obs = geom3.toVertices(translated)
141
141
  t.notThrows(() => geom3.validate(translated))
142
142
  t.is(measureVolume(translated), measureVolume(geometry))
143
143
  t.true(comparePolygonsAsPoints(obs, exp))
@@ -60,8 +60,8 @@ export const arc = (options) => {
60
60
  vec2.add(point, point, centerV)
61
61
  pointArray.push(point)
62
62
  } else {
63
- // note: add one additional step to achieve full rotation
64
- const numSteps = Math.max(1, Math.floor(segments * (rotation / TAU))) + 1
63
+ const numSteps = Math.floor(segments * (Math.abs(rotation) / TAU))
64
+
65
65
  let edgeStepSize = numSteps * 0.5 / rotation // step size for half a degree
66
66
  if (edgeStepSize > 0.25) edgeStepSize = 0.25
67
67
 
@@ -13,205 +13,196 @@ test('arc (defaults)', (t) => {
13
13
  const obs = path2.toPoints(geometry)
14
14
 
15
15
  t.notThrows(() => path2.validate(geometry))
16
- t.is(obs.length, 33)
16
+ t.is(obs.length, 32)
17
17
  })
18
18
 
19
19
  test('arc (options)', (t) => {
20
20
  // test center
21
21
  let exp = [
22
22
  [3, 2],
23
- [2.9324722294043557, 2.361241666187153],
24
- [2.739008917220659, 2.6736956436465573],
25
- [2.4457383557765384, 2.8951632913550625],
26
- [2.092268359463302, 2.9957341762950342],
27
- [1.7263370099279172, 2.961825643172819],
28
- [1.3973653636207437, 2.7980172272802397],
29
- [1.1497828642703858, 2.526432162877356],
30
- [1.017026900316098, 2.1837495178165702],
31
- [1.017026900316098, 1.8162504821834298],
32
- [1.149782864270386, 1.4735678371226442],
33
- [1.3973653636207435, 1.2019827727197605],
34
- [1.726337009927917, 1.0381743568271808],
35
- [2.0922683594633016, 1.0042658237049653],
36
- [2.4457383557765384, 1.1048367086449378],
37
- [2.739008917220659, 1.326304356353443],
38
- [2.9324722294043557, 1.6387583338128469]
23
+ [2.923879532511287, 2.3826834323650896],
24
+ [2.7071067811865475, 2.7071067811865475],
25
+ [2.3826834323650896, 2.923879532511287],
26
+ [2, 3],
27
+ [1.6173165676349104, 2.923879532511287],
28
+ [1.2928932188134525, 2.7071067811865475],
29
+ [1.0761204674887133, 2.38268343236509],
30
+ [1, 2],
31
+ [1.076120467488713, 1.6173165676349104],
32
+ [1.2928932188134523, 1.2928932188134525],
33
+ [1.6173165676349097, 1.0761204674887135],
34
+ [2, 1],
35
+ [2.38268343236509, 1.0761204674887135],
36
+ [2.7071067811865475, 1.2928932188134523],
37
+ [2.9238795325112865, 1.6173165676349095]
39
38
  ]
40
39
  let geometry = arc({ center: [2, 2], segments: 16 })
41
40
  let obs = path2.toPoints(geometry)
42
41
 
43
42
  t.notThrows(() => path2.validate(geometry))
44
- t.is(obs.length, 17)
43
+ t.is(obs.length, 16)
45
44
  t.true(comparePoints(obs, exp))
46
45
 
47
46
  // test radius
48
47
  exp = [
49
48
  [2, 0],
50
- [1.8649444588087116, 0.7224833323743058],
51
- [1.4780178344413182, 1.3473912872931144],
52
- [0.8914767115530766, 1.7903265827101247],
53
- [0.18453671892660403, 1.991468352590069],
54
- [-0.5473259801441658, 1.923651286345638],
55
- [-1.2052692727585126, 1.5960344545604792],
56
- [-1.7004342714592284, 1.0528643257547114],
57
- [-1.9659461993678036, 0.36749903563314074],
58
- [-1.9659461993678036, -0.36749903563314024],
59
- [-1.7004342714592282, -1.0528643257547117],
60
- [-1.205269272758513, -1.596034454560479],
61
- [-0.5473259801441662, -1.923651286345638],
62
- [0.1845367189266031, -1.9914683525900692],
63
- [0.8914767115530771, -1.7903265827101245],
64
- [1.4780178344413184, -1.3473912872931142],
65
- [1.8649444588087116, -0.7224833323743061]
49
+ [1.8477590650225735, 0.7653668647301796],
50
+ [1.4142135623730951, 1.414213562373095],
51
+ [0.7653668647301797, 1.8477590650225735],
52
+ [0, 2],
53
+ [-0.7653668647301795, 1.8477590650225735],
54
+ [-1.414213562373095, 1.4142135623730951],
55
+ [-1.8477590650225735, 0.7653668647301798],
56
+ [-2, 0],
57
+ [-1.8477590650225737, -0.7653668647301793],
58
+ [-1.4142135623730954, -1.414213562373095],
59
+ [-0.7653668647301807, -1.847759065022573],
60
+ [0, -2],
61
+ [0.76536686473018, -1.8477590650225733],
62
+ [1.4142135623730947, -1.4142135623730954],
63
+ [1.847759065022573, -0.7653668647301808]
66
64
  ]
67
65
  geometry = arc({ radius: 2, segments: 16 })
68
66
  obs = path2.toPoints(geometry)
69
67
 
70
68
  t.notThrows(() => path2.validate(geometry))
71
- t.is(obs.length, 17)
69
+ t.is(obs.length, 16)
72
70
  t.true(comparePoints(obs, exp))
73
71
 
74
72
  // test startAngle
75
73
  exp = [
76
- [6.123233995736766e-17, 1],
77
- [-0.3546048870425357, 0.9350162426854148],
78
- [-0.6631226582407953, 0.748510748171101],
79
- [-0.8854560256532098, 0.4647231720437687],
80
- [-0.992708874098054, 0.12053668025532308],
81
- [-0.970941817426052, -0.23931566428755788],
82
- [-0.8229838658936566, -0.5680647467311556],
83
- [-0.5680647467311559, -0.8229838658936564],
84
- [-0.23931566428755774, -0.970941817426052],
85
- [0.1205366802553232, -0.992708874098054],
86
- [0.4647231720437688, -0.8854560256532098],
87
- [0.7485107481711007, -0.6631226582407955],
88
- [0.9350162426854147, -0.35460488704253595],
89
- [1, -2.4492935982947064e-16]
74
+ [0, 1],
75
+ [-0.3826834323650897, 0.9238795325112867],
76
+ [-0.7071067811865475, 0.7071067811865476],
77
+ [-0.9238795325112867, 0.3826834323650899],
78
+ [-1, 0],
79
+ [-0.9238795325112868, -0.38268343236508967],
80
+ [-0.7071067811865477, -0.7071067811865475],
81
+ [-0.38268343236509034, -0.9238795325112865],
82
+ [0, -1],
83
+ [0.38268343236509, -0.9238795325112866],
84
+ [0.7071067811865474, -0.7071067811865477],
85
+ [0.9238795325112865, -0.3826834323650904],
86
+ [1, 0]
90
87
  ]
91
88
  geometry = arc({ startAngle: TAU / 4, segments: 16 })
92
89
  obs = path2.toPoints(geometry)
93
90
 
94
91
  t.notThrows(() => path2.validate(geometry))
95
- t.is(obs.length, 14)
92
+ t.is(obs.length, 13)
96
93
  t.true(comparePoints(obs, exp))
97
94
 
98
95
  // test endAngle
99
96
  exp = [
100
97
  [1, 0],
101
- [0.9510565162951535, 0.3090169943749474],
102
- [0.8090169943749475, 0.5877852522924731],
103
- [0.5877852522924731, 0.8090169943749475],
104
- [0.30901699437494745, 0.9510565162951535],
105
- [6.123233995736766e-17, 1]
98
+ [0.9238795325112867, 0.3826834323650898],
99
+ [0.7071067811865476, 0.7071067811865475],
100
+ [0.38268343236508984, 0.9238795325112867],
101
+ [0, 1]
106
102
  ]
107
103
  geometry = arc({ endAngle: TAU / 4, segments: 16 })
108
104
  obs = path2.toPoints(geometry)
109
105
 
110
106
  t.notThrows(() => path2.validate(geometry))
111
- t.is(obs.length, 6)
107
+ t.is(obs.length, 5)
112
108
  t.true(comparePoints(obs, exp))
113
109
 
114
110
  // test makeTangent
115
111
  exp = [
116
112
  [1, 0],
117
- [0.9957341762950345, 0.09226835946330199],
118
- [0.8999557329057603, 0.43598128263728936],
119
- [0.6896020498551045, 0.7241885202318785],
120
- [0.391453692861967, 0.9201978082699006],
121
- [0.04346855052920052, 0.9990547958520045],
122
- [-0.31005066355011174, 0.9507200355689026],
123
- [-0.6240966815770753, 0.781347126470996],
124
- [-0.858687650595474, 0.5124992865505523],
125
- [-0.9839573055048071, 0.1784040945262181],
126
- [-0.9839573055048071, -0.1784040945262183],
127
- [-0.8586876505954741, -0.5124992865505521],
128
- [-0.6240966815770755, -0.7813471264709959],
129
- [-0.3100506635501122, -0.9507200355689025],
130
- [0.04346855052920005, -0.9990547958520045],
131
- [0.39145369286196696, -0.9201978082699006],
132
- [0.6896020498551043, -0.7241885202318787],
133
- [0.8999557329057604, -0.435981282637289],
134
- [0.9957341762950345, -0.09226835946330197]
113
+ [0.9951847266721969, 0.0980171403295606],
114
+ [0.8876396204028539, 0.46053871095824],
115
+ [0.6531728429537769, 0.7572088465064846],
116
+ [0.325310292162263, 0.9456073253805213],
117
+ [-0.04906767432741801, 0.9987954562051724],
118
+ [-0.416429560097637, 0.9091679830905225],
119
+ [-0.7242470829514668, 0.689540544737067],
120
+ [-0.9285060804732155, 0.3713171939518377],
121
+ [-1, 0],
122
+ [-0.9285060804732156, -0.37131719395183743],
123
+ [-0.724247082951467, -0.6895405447370668],
124
+ [-0.4164295600976372, -0.9091679830905224],
125
+ [-0.04906767432741803, -0.9987954562051724],
126
+ [0.3253102921622629, -0.9456073253805213],
127
+ [0.6531728429537768, -0.7572088465064846],
128
+ [0.8876396204028539, -0.46053871095823995],
129
+ [0.9951847266721969, -0.0980171403295605]
135
130
  ]
136
131
  geometry = arc({ makeTangent: true, segments: 16 })
137
132
  obs = path2.toPoints(geometry)
138
133
 
139
134
  t.notThrows(() => path2.validate(geometry))
140
- t.is(obs.length, 19)
135
+ t.is(obs.length, 18)
141
136
  t.true(comparePoints(obs, exp))
142
137
 
143
138
  // test segments
144
139
  exp = [
145
140
  [1, 0],
146
- [0.766044443118978, 0.6427876096865393],
147
- [0.17364817766693041, 0.984807753012208],
148
- [-0.4999999999999998, 0.8660254037844387],
149
- [-0.9396926207859083, 0.3420201433256689],
150
- [-0.9396926207859084, -0.34202014332566866],
151
- [-0.5000000000000004, -0.8660254037844385],
152
- [0.17364817766692997, -0.9848077530122081],
153
- [0.7660444431189778, -0.6427876096865396]
141
+ [0.7071067811865476, 0.7071067811865475],
142
+ [0, 1],
143
+ [-0.7071067811865475, 0.7071067811865476],
144
+ [-1, 0],
145
+ [-0.7071067811865477, -0.7071067811865475],
146
+ [0, -1],
147
+ [0.7071067811865474, -0.7071067811865477]
154
148
  ]
155
149
  geometry = arc({ segments: 8 })
156
150
  obs = path2.toPoints(geometry)
157
151
 
158
152
  t.notThrows(() => path2.validate(geometry))
159
- t.is(obs.length, 9)
153
+ t.is(obs.length, 8)
160
154
  t.true(comparePoints(obs, exp))
161
155
  })
162
156
 
163
157
  test('arc (rotations)', (t) => {
164
158
  let exp = [
165
- [6.123233995736766e-17, 1],
166
- [-0.30901699437494734, 0.9510565162951536],
167
- [-0.587785252292473, 0.8090169943749475],
168
- [-0.8090169943749473, 0.5877852522924732],
169
- [-0.9510565162951535, 0.3090169943749475],
170
- [-1, 1.2246467991473532e-16]
159
+ [0, 1],
160
+ [-0.3826834323650897, 0.9238795325112867],
161
+ [-0.7071067811865475, 0.7071067811865476],
162
+ [-0.9238795325112867, 0.3826834323650899],
163
+ [-1, 0]
171
164
  ]
172
165
  let geometry = arc({ startAngle: TAU / 4, endAngle: TAU / 2, segments: 16 })
173
166
  let obs = path2.toPoints(geometry)
174
167
 
175
168
  t.notThrows(() => path2.validate(geometry))
176
- t.is(obs.length, 6)
169
+ t.is(obs.length, 5)
177
170
  t.true(comparePoints(obs, exp))
178
171
 
179
172
  exp = [
180
- [-1, 1.2246467991473532e-16],
181
- [-0.9396926207859084, -0.34202014332566866],
182
- [-0.7660444431189781, -0.6427876096865393],
183
- [-0.5000000000000004, -0.8660254037844385],
184
- [-0.17364817766693033, -0.984807753012208],
185
- [0.17364817766692997, -0.9848077530122081],
186
- [0.49999999999999933, -0.866025403784439],
187
- [0.7660444431189778, -0.6427876096865396],
188
- [0.9396926207859084, -0.3420201433256686],
189
- [1, -2.4492935982947064e-16]
173
+ [-1, 0],
174
+ [-0.9238795325112868, -0.38268343236508967],
175
+ [-0.7071067811865477, -0.7071067811865475],
176
+ [-0.38268343236509034, -0.9238795325112865],
177
+ [0, -1],
178
+ [0.38268343236509, -0.9238795325112866],
179
+ [0.7071067811865474, -0.7071067811865477],
180
+ [0.9238795325112865, -0.3826834323650904],
181
+ [1, 0]
190
182
  ]
191
183
  geometry = arc({ startAngle: TAU / 2, endAngle: TAU, segments: 16 })
192
184
  obs = path2.toPoints(geometry)
193
185
 
194
186
  t.notThrows(() => path2.validate(geometry))
195
- t.is(obs.length, 10)
187
+ t.is(obs.length, 9)
196
188
  t.true(comparePoints(obs, exp))
197
189
 
198
190
  exp = [
199
- [-1.8369701987210297e-16, -1],
200
- [0.34202014332566816, -0.9396926207859085],
201
- [0.6427876096865393, -0.7660444431189781],
202
- [0.8660254037844384, -0.5000000000000004],
203
- [0.984807753012208, -0.1736481776669304],
204
- [0.9848077530122081, 0.17364817766692991],
205
- [0.866025403784439, 0.4999999999999993],
206
- [0.6427876096865396, 0.7660444431189778],
207
- [0.34202014332566866, 0.9396926207859084],
208
- [3.061616997868383e-16, 1]
191
+ [0, -1],
192
+ [0.38268343236509, -0.9238795325112866],
193
+ [0.7071067811865474, -0.7071067811865477],
194
+ [0.9238795325112865, -0.3826834323650904],
195
+ [1, 0],
196
+ [0.9238795325112867, 0.38268343236508995],
197
+ [0.7071067811865477, 0.7071067811865474],
198
+ [0.38268343236509045, 0.9238795325112865],
199
+ [0, 1]
209
200
  ]
210
201
  geometry = arc({ startAngle: TAU * 0.75, endAngle: TAU / 4, segments: 16 })
211
202
  obs = path2.toPoints(geometry)
212
203
 
213
204
  t.notThrows(() => path2.validate(geometry))
214
- t.is(obs.length, 10)
205
+ t.is(obs.length, 9)
215
206
  t.true(comparePoints(obs, exp))
216
207
 
217
208
  exp = [[-1.8369701987210297e-16, -1]]
@@ -10,7 +10,7 @@ import { comparePolygonsAsPoints } from '../../test/helpers/index.js'
10
10
 
11
11
  test('cube (defaults)', (t) => {
12
12
  const obs = cube()
13
- const pts = geom3.toPoints(obs)
13
+ const pts = geom3.toVertices(obs)
14
14
  t.notThrows(() => geom3.validate(obs))
15
15
  t.is(measureArea(obs), 24)
16
16
  t.is(measureVolume(obs), 7.999999999999999)
@@ -20,7 +20,7 @@ test('cube (defaults)', (t) => {
20
20
  test('cube (options)', (t) => {
21
21
  // test center
22
22
  let obs = cube({ size: 7, center: [6.5, 6.5, 6.5] })
23
- let pts = geom3.toPoints(obs)
23
+ let pts = geom3.toVertices(obs)
24
24
  let exp = [
25
25
  [[3, 3, 3], [3, 3, 10], [3, 10, 10], [3, 10, 3]],
26
26
  [[10, 3, 3], [10, 10, 3], [10, 10, 10], [10, 3, 10]],
@@ -38,7 +38,7 @@ test('cube (options)', (t) => {
38
38
 
39
39
  // test size
40
40
  obs = cube({ size: 7 })
41
- pts = geom3.toPoints(obs)
41
+ pts = geom3.toVertices(obs)
42
42
  exp = [
43
43
  [[-3.5, -3.5, -3.5], [-3.5, -3.5, 3.5], [-3.5, 3.5, 3.5], [-3.5, 3.5, -3.5]],
44
44
  [[3.5, -3.5, -3.5], [3.5, 3.5, -3.5], [3.5, 3.5, 3.5], [3.5, -3.5, 3.5]],
@@ -57,7 +57,7 @@ test('cube (options)', (t) => {
57
57
 
58
58
  test('cube (zero size)', (t) => {
59
59
  const obs = cube({ size: 0 })
60
- const pts = geom3.toPoints(obs)
60
+ const pts = geom3.toVertices(obs)
61
61
  t.notThrows(() => geom3.validate(obs))
62
62
  t.is(measureArea(obs), 0)
63
63
  t.is(measureVolume(obs), 0)
@@ -10,7 +10,7 @@ import { comparePolygonsAsPoints } from '../../test/helpers/index.js'
10
10
 
11
11
  test('cuboid (defaults)', (t) => {
12
12
  const obs = cuboid()
13
- const pts = geom3.toPoints(obs)
13
+ const pts = geom3.toVertices(obs)
14
14
  const exp = [
15
15
  [[-1, -1, -1], [-1, -1, 1], [-1, 1, 1], [-1, 1, -1]],
16
16
  [[1, -1, -1], [1, 1, -1], [1, 1, 1], [1, -1, 1]],
@@ -29,7 +29,7 @@ test('cuboid (defaults)', (t) => {
29
29
  test('cuboid (options)', (t) => {
30
30
  // test center
31
31
  let obs = cuboid({ size: [6, 6, 6], center: [3, 5, 7] })
32
- let pts = geom3.toPoints(obs)
32
+ let pts = geom3.toVertices(obs)
33
33
  let exp = [
34
34
  [[0, 2, 4], [0, 2, 10], [0, 8, 10], [0, 8, 4]],
35
35
  [[6, 2, 4], [6, 8, 4], [6, 8, 10], [6, 2, 10]],
@@ -47,7 +47,7 @@ test('cuboid (options)', (t) => {
47
47
 
48
48
  // test size
49
49
  obs = cuboid({ size: [4.5, 1.5, 7] })
50
- pts = geom3.toPoints(obs)
50
+ pts = geom3.toVertices(obs)
51
51
  exp = [
52
52
  [[-2.25, -0.75, -3.5], [-2.25, -0.75, 3.5], [-2.25, 0.75, 3.5], [-2.25, 0.75, -3.5]],
53
53
  [[2.25, -0.75, -3.5], [2.25, 0.75, -3.5], [2.25, 0.75, 3.5], [2.25, -0.75, 3.5]],
@@ -66,7 +66,7 @@ test('cuboid (options)', (t) => {
66
66
 
67
67
  test('cuboid (zero size)', (t) => {
68
68
  const obs = cuboid({ size: [1, 1, 0] })
69
- const pts = geom3.toPoints(obs)
69
+ const pts = geom3.toVertices(obs)
70
70
  t.notThrows(() => geom3.validate(obs))
71
71
  t.is(measureArea(obs), 0)
72
72
  t.is(measureVolume(obs), 0)