@jscad/modeling 3.0.2-alpha.0 → 3.0.3-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 (116) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/jscad-modeling.es.js +2 -2
  3. package/dist/jscad-modeling.min.js +2 -2
  4. package/package.json +2 -2
  5. package/src/colors/colorize.test.js +1 -1
  6. package/src/geometries/geom2/index.d.ts +0 -2
  7. package/src/geometries/geom2/index.js +0 -2
  8. package/src/geometries/geom3/applyTransforms.test.js +2 -2
  9. package/src/geometries/geom3/clone.test.js +2 -2
  10. package/src/geometries/geom3/create.js +1 -9
  11. package/src/geometries/geom3/{fromPoints.d.ts → fromVertices.d.ts} +1 -1
  12. package/src/geometries/geom3/{fromPoints.js → fromVertices.js} +3 -2
  13. package/src/geometries/geom3/{fromPoints.test.js → fromVertices.test.js} +6 -6
  14. package/src/geometries/geom3/{fromPointsConvex.d.ts → fromVerticesConvex.d.ts} +1 -1
  15. package/src/geometries/geom3/fromVerticesConvex.js +25 -0
  16. package/src/geometries/geom3/{fromPointsConvex.test.js → fromVerticesConvex.test.js} +3 -3
  17. package/src/geometries/geom3/index.d.ts +3 -5
  18. package/src/geometries/geom3/index.js +4 -6
  19. package/src/geometries/geom3/invert.test.js +2 -2
  20. package/src/geometries/geom3/isA.test.js +2 -2
  21. package/src/geometries/geom3/toString.test.js +2 -2
  22. package/src/geometries/geom3/{toPoints.d.ts → toVertices.d.ts} +1 -1
  23. package/src/geometries/geom3/{toPoints.js → toVertices.js} +3 -2
  24. package/src/geometries/geom3/{toPoints.test.js → toVertices.test.js} +4 -4
  25. package/src/geometries/geom3/transform.test.js +2 -2
  26. package/src/geometries/geom3/validate.test.js +4 -4
  27. package/src/geometries/index.d.ts +1 -0
  28. package/src/geometries/index.js +1 -0
  29. package/src/geometries/path2/create.js +1 -10
  30. package/src/geometries/path2/index.d.ts +0 -2
  31. package/src/geometries/path2/index.js +0 -2
  32. package/src/geometries/path3/applyTransforms.js +22 -0
  33. package/src/geometries/path3/applyTransforms.test.js +28 -0
  34. package/src/geometries/path3/close.d.ts +3 -0
  35. package/src/geometries/path3/close.js +31 -0
  36. package/src/geometries/path3/close.test.js +43 -0
  37. package/src/geometries/path3/concat.d.ts +3 -0
  38. package/src/geometries/path3/concat.js +36 -0
  39. package/src/geometries/path3/concat.test.js +35 -0
  40. package/src/geometries/path3/create.d.ts +4 -0
  41. package/src/geometries/path3/create.js +30 -0
  42. package/src/geometries/path3/create.test.js +8 -0
  43. package/src/geometries/path3/equals.d.ts +3 -0
  44. package/src/geometries/path3/equals.js +48 -0
  45. package/src/geometries/path3/equals.test.js +38 -0
  46. package/src/geometries/path3/fromVertices.d.ts +8 -0
  47. package/src/geometries/path3/fromVertices.js +45 -0
  48. package/src/geometries/path3/fromVertices.test.js +33 -0
  49. package/src/geometries/path3/index.d.ts +13 -0
  50. package/src/geometries/path3/index.js +21 -0
  51. package/src/geometries/path3/isA.d.ts +3 -0
  52. package/src/geometries/path3/isA.js +20 -0
  53. package/src/geometries/path3/isA.test.js +19 -0
  54. package/src/geometries/path3/reverse.d.ts +3 -0
  55. package/src/geometries/path3/reverse.js +19 -0
  56. package/src/geometries/path3/reverse.test.js +9 -0
  57. package/src/geometries/path3/toString.d.ts +3 -0
  58. package/src/geometries/path3/toString.js +24 -0
  59. package/src/geometries/path3/toVertices.d.ts +4 -0
  60. package/src/geometries/path3/toVertices.js +16 -0
  61. package/src/geometries/path3/toVertices.test.js +13 -0
  62. package/src/geometries/path3/transform.d.ts +4 -0
  63. package/src/geometries/path3/transform.js +21 -0
  64. package/src/geometries/path3/transform.test.js +50 -0
  65. package/src/geometries/path3/type.d.ts +10 -0
  66. package/src/geometries/path3/validate.d.ts +1 -0
  67. package/src/geometries/path3/validate.js +41 -0
  68. package/src/geometries/poly2/create.js +1 -6
  69. package/src/geometries/poly3/create.js +1 -6
  70. package/src/operations/booleans/intersectGeom3.test.js +4 -4
  71. package/src/operations/booleans/subtractGeom3.test.js +4 -4
  72. package/src/operations/booleans/unionGeom3.test.js +5 -5
  73. package/src/operations/extrusions/extrudeFromSlices.test.js +6 -6
  74. package/src/operations/extrusions/extrudeLinear.test.js +8 -8
  75. package/src/operations/extrusions/extrudeRotate.test.js +12 -12
  76. package/src/operations/hulls/hull.test.js +5 -5
  77. package/src/operations/hulls/hullChain.test.js +5 -5
  78. package/src/operations/hulls/toUniquePoints.js +2 -2
  79. package/src/operations/modifiers/generalize.test.js +6 -6
  80. package/src/operations/modifiers/insertTjunctions.test.js +2 -2
  81. package/src/operations/modifiers/retessellate.test.js +10 -10
  82. package/src/operations/modifiers/snap.test.js +4 -4
  83. package/src/operations/offsets/offsetGeom3.test.js +4 -4
  84. package/src/operations/transforms/center.test.js +7 -7
  85. package/src/operations/transforms/mirror.test.js +7 -7
  86. package/src/operations/transforms/rotate.test.js +7 -7
  87. package/src/operations/transforms/scale.test.js +7 -7
  88. package/src/operations/transforms/transform.test.js +2 -2
  89. package/src/operations/transforms/translate.test.js +7 -7
  90. package/src/primitives/cube.test.js +4 -4
  91. package/src/primitives/cuboid.test.js +4 -4
  92. package/src/primitives/cylinder.test.js +5 -5
  93. package/src/primitives/cylinderElliptic.test.js +9 -9
  94. package/src/primitives/ellipsoid.test.js +5 -5
  95. package/src/primitives/geodesicSphere.test.js +4 -4
  96. package/src/primitives/polyhedron.test.js +2 -2
  97. package/src/primitives/roundedCuboid.test.js +7 -7
  98. package/src/primitives/roundedCylinder.test.js +9 -9
  99. package/src/primitives/sphere.test.js +5 -5
  100. package/src/primitives/torus.test.js +4 -4
  101. package/src/geometries/geom2/fromCompactBinary.d.ts +0 -3
  102. package/src/geometries/geom2/fromCompactBinary.js +0 -40
  103. package/src/geometries/geom2/fromToCompactBinary.test.js +0 -100
  104. package/src/geometries/geom2/toCompactBinary.d.ts +0 -3
  105. package/src/geometries/geom2/toCompactBinary.js +0 -56
  106. package/src/geometries/geom3/fromCompactBinary.d.ts +0 -3
  107. package/src/geometries/geom3/fromCompactBinary.js +0 -42
  108. package/src/geometries/geom3/fromPointsConvex.js +0 -25
  109. package/src/geometries/geom3/fromToCompactBinary.test.js +0 -139
  110. package/src/geometries/geom3/toCompactBinary.d.ts +0 -3
  111. package/src/geometries/geom3/toCompactBinary.js +0 -66
  112. package/src/geometries/path2/fromCompactBinary.d.ts +0 -3
  113. package/src/geometries/path2/fromCompactBinary.js +0 -31
  114. package/src/geometries/path2/fromToCompactBinary.test.js +0 -114
  115. package/src/geometries/path2/toCompactBinary.d.ts +0 -3
  116. 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))
@@ -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)
@@ -10,7 +10,7 @@ import { comparePolygonsAsPoints } from '../../test/helpers/index.js'
10
10
 
11
11
  test('cylinder (defaults)', (t) => {
12
12
  const obs = cylinder()
13
- const pts = geom3.toPoints(obs)
13
+ const pts = geom3.toVertices(obs)
14
14
 
15
15
  t.notThrows(() => geom3.validate(obs))
16
16
  t.is(measureArea(obs), 18.789084266699856)
@@ -20,7 +20,7 @@ test('cylinder (defaults)', (t) => {
20
20
 
21
21
  test('cylinder (zero height)', (t) => {
22
22
  const obs = cylinder({ height: 0 })
23
- const pts = geom3.toPoints(obs)
23
+ const pts = geom3.toVertices(obs)
24
24
  t.notThrows(() => geom3.validate(obs))
25
25
  t.is(measureArea(obs), 0)
26
26
  t.is(measureVolume(obs), 0)
@@ -29,7 +29,7 @@ test('cylinder (zero height)', (t) => {
29
29
 
30
30
  test('cylinder (zero radius)', (t) => {
31
31
  const obs = cylinder({ radius: 0 })
32
- const pts = geom3.toPoints(obs)
32
+ const pts = geom3.toVertices(obs)
33
33
  t.notThrows(() => geom3.validate(obs))
34
34
  t.is(measureArea(obs), 0)
35
35
  t.is(measureVolume(obs), 0)
@@ -38,7 +38,7 @@ test('cylinder (zero radius)', (t) => {
38
38
 
39
39
  test('cylinder (options)', (t) => {
40
40
  let obs = cylinder({ height: 10, radius: 4, segments: 5 })
41
- let pts = geom3.toPoints(obs)
41
+ let pts = geom3.toVertices(obs)
42
42
  let exp = [
43
43
  [[0, 0, -5], [1.2360679774997898, 3.804226065180614, -5], [4, 0, -5]],
44
44
  [[1.2360679774997898, 3.804226065180614, -5], [1.2360679774997898, 3.804226065180614, 5],
@@ -70,7 +70,7 @@ test('cylinder (options)', (t) => {
70
70
 
71
71
  // test center
72
72
  obs = cylinder({ center: [-5, -5, -5], segments: 5 })
73
- pts = geom3.toPoints(obs)
73
+ pts = geom3.toVertices(obs)
74
74
  exp = [
75
75
  [[-5, -5, -6], [-4.6909830056250525, -4.048943483704846, -6], [-4, -5, -6]],
76
76
  [[-4.6909830056250525, -4.048943483704846, -6], [-4.6909830056250525, -4.048943483704846, -4],
@@ -12,7 +12,7 @@ import { comparePolygonsAsPoints } from '../../test/helpers/index.js'
12
12
 
13
13
  test('cylinderElliptic (defaults)', (t) => {
14
14
  const obs = cylinderElliptic()
15
- const pts = geom3.toPoints(obs)
15
+ const pts = geom3.toVertices(obs)
16
16
 
17
17
  t.notThrows(() => geom3.validate(obs))
18
18
  t.is(measureArea(obs), 18.789084266699856)
@@ -23,7 +23,7 @@ test('cylinderElliptic (defaults)', (t) => {
23
23
  test('cylinderElliptic (options)', (t) => {
24
24
  // test height
25
25
  let obs = cylinderElliptic({ height: 10, segments: 12 })
26
- let pts = geom3.toPoints(obs)
26
+ let pts = geom3.toVertices(obs)
27
27
  let exp = [
28
28
  [[0, 0, -5], [0.8660254037844387, 0.49999999999999994, -5], [1, 0, -5]],
29
29
  [[0.8660254037844387, 0.49999999999999994, -5], [0.8660254037844387, 0.49999999999999994, 5],
@@ -83,7 +83,7 @@ test('cylinderElliptic (options)', (t) => {
83
83
 
84
84
  // test startRadius and endRadius
85
85
  obs = cylinderElliptic({ startRadius: [1, 2], endRadius: [2, 1], segments: 12 })
86
- pts = geom3.toPoints(obs)
86
+ pts = geom3.toVertices(obs)
87
87
  exp = [
88
88
  [[0, 0, -1], [0.8660254037844387, 0.9999999999999999, -1], [1, 0, -1]],
89
89
  [[1, 0, -1], [0.8660254037844387, 0.9999999999999999, -1], [2, 0, 1]],
@@ -143,7 +143,7 @@ test('cylinderElliptic (options)', (t) => {
143
143
 
144
144
  // test startAngle and endAngle
145
145
  obs = cylinderElliptic({ startRadius: [1, 2], endRadius: [2, 1], startAngle: TAU / 4, endAngle: TAU * 0.75, segments: 12 })
146
- pts = geom3.toPoints(obs)
146
+ pts = geom3.toVertices(obs)
147
147
 
148
148
  t.notThrows(() => geom3.validate(obs))
149
149
  t.is(measureArea(obs), 22.17105015072561)
@@ -152,7 +152,7 @@ test('cylinderElliptic (options)', (t) => {
152
152
 
153
153
  // test startAngle and endAngle
154
154
  obs = cylinderElliptic({ startAngle: 1, endAngle: 1 + TAU })
155
- pts = geom3.toPoints(obs)
155
+ pts = geom3.toVertices(obs)
156
156
 
157
157
  t.notThrows(() => geom3.validate(obs))
158
158
  t.is(measureArea(obs), 18.78908426669986)
@@ -161,7 +161,7 @@ test('cylinderElliptic (options)', (t) => {
161
161
 
162
162
  // test segments
163
163
  obs = cylinderElliptic({ segments: 8 })
164
- pts = geom3.toPoints(obs)
164
+ pts = geom3.toVertices(obs)
165
165
 
166
166
  t.notThrows(() => geom3.validate(obs))
167
167
  t.is(measureArea(obs), 17.902724085175244)
@@ -170,7 +170,7 @@ test('cylinderElliptic (options)', (t) => {
170
170
 
171
171
  // test center
172
172
  obs = cylinderElliptic({ center: [-5, -5, -5], height: 3, segments: 8 })
173
- pts = geom3.toPoints(obs)
173
+ pts = geom3.toVertices(obs)
174
174
  exp = [
175
175
  [[-5, -5, -6.5], [-4.292893218813452, -4.292893218813452, -6.5], [-4, -5, -6.5]],
176
176
  [[-4.292893218813452, -4.292893218813452, -6.5], [-4.292893218813452, -4.292893218813452, -3.5],
@@ -215,7 +215,7 @@ test('cylinderElliptic (options)', (t) => {
215
215
 
216
216
  test('cylinderElliptic (cone)', (t) => {
217
217
  const obs = cylinderElliptic({ endRadius: [0, 0] })
218
- const pts = geom3.toPoints(obs)
218
+ const pts = geom3.toVertices(obs)
219
219
 
220
220
  t.notThrows(() => geom3.validate(obs))
221
221
  t.is(measureArea(obs), 10.128239395900382)
@@ -225,7 +225,7 @@ test('cylinderElliptic (cone)', (t) => {
225
225
 
226
226
  test('cylinderElliptic (squished)', (t) => {
227
227
  const obs = cylinderElliptic({ startRadius: [1, 0], endRadius: [0, 1], segments: 4 })
228
- const pts = geom3.toPoints(obs)
228
+ const pts = geom3.toVertices(obs)
229
229
 
230
230
  t.notThrows(() => geom3.validate(obs))
231
231
  t.is(measureArea(obs), 8.47213595499958)
@@ -10,7 +10,7 @@ import { comparePolygonsAsPoints } from '../../test/helpers/index.js'
10
10
 
11
11
  test('ellipsoid (defaults)', (t) => {
12
12
  const obs = ellipsoid()
13
- const pts = geom3.toPoints(obs)
13
+ const pts = geom3.toVertices(obs)
14
14
 
15
15
  t.notThrows(() => geom3.validate(obs))
16
16
  t.is(measureArea(obs), 12.465694088650583)
@@ -21,7 +21,7 @@ test('ellipsoid (defaults)', (t) => {
21
21
  test('ellipsoid (options)', (t) => {
22
22
  // test radius
23
23
  let obs = ellipsoid({ radius: [3, 5, 7], segments: 12 })
24
- let pts = geom3.toPoints(obs)
24
+ let pts = geom3.toVertices(obs)
25
25
  let exp = [
26
26
  [[3, 0, 0], [2.598076211353316, -2.4999999999999996, 0],
27
27
  [2.25, -2.1650635094610964, -3.4999999999999996], [2.598076211353316, 0, -3.4999999999999996]],
@@ -152,14 +152,14 @@ test('ellipsoid (options)', (t) => {
152
152
 
153
153
  // test segments
154
154
  obs = ellipsoid({ segments: 8 })
155
- pts = geom3.toPoints(obs)
155
+ pts = geom3.toVertices(obs)
156
156
  t.notThrows(() => geom3.validate(obs))
157
157
  t.is(measureArea(obs), 11.013439076647456)
158
158
  t.is(measureVolume(obs), 3.2189514164974597)
159
159
  t.is(pts.length, 32)
160
160
 
161
161
  obs = ellipsoid({ center: [-3, 5, 7], segments: 8 })
162
- pts = geom3.toPoints(obs)
162
+ pts = geom3.toVertices(obs)
163
163
  exp = [
164
164
  [[-2, 5, 7], [-2.2928932188134525, 4.292893218813452, 7],
165
165
  [-2.5, 4.5, 6.292893218813452], [-2.2928932188134525, 5, 6.292893218813452]],
@@ -220,7 +220,7 @@ test('ellipsoid (options)', (t) => {
220
220
 
221
221
  test('ellipsoid (zero radius)', (t) => {
222
222
  const obs = ellipsoid({ radius: [1, 1, 0] })
223
- const pts = geom3.toPoints(obs)
223
+ const pts = geom3.toVertices(obs)
224
224
  t.notThrows(() => geom3.validate(obs))
225
225
  t.is(measureArea(obs), 0)
226
226
  t.is(measureVolume(obs), 0)
@@ -10,7 +10,7 @@ import { comparePolygonsAsPoints } from '../../test/helpers/index.js'
10
10
 
11
11
  test('geodesicSphere (defaults)', (t) => {
12
12
  const obs = geodesicSphere()
13
- const pts = geom3.toPoints(obs)
13
+ const pts = geom3.toVertices(obs)
14
14
  t.notThrows(() => geom3.validate(obs))
15
15
  t.is(pts.length, 20)
16
16
  })
@@ -18,7 +18,7 @@ test('geodesicSphere (defaults)', (t) => {
18
18
  test('geodesicSphere (options)', (t) => {
19
19
  // test radius
20
20
  let obs = geodesicSphere({ radius: 5 })
21
- let pts = geom3.toPoints(obs)
21
+ let pts = geom3.toVertices(obs)
22
22
  const exp = [
23
23
  [[4.253254557317035, 0, 2.628654726407001], [2.628654726407001, -4.253254557317035, 0], [4.253254557317035, 0, -2.628654726407001]],
24
24
  [[4.253254557317035, 0, -2.628654726407001], [2.628654726407001, 4.253254557317035, 0], [4.253254557317035, 0, 2.628654726407001]],
@@ -50,7 +50,7 @@ test('geodesicSphere (options)', (t) => {
50
50
 
51
51
  // test frequency
52
52
  obs = geodesicSphere({ radius: 5, frequency: 18 })
53
- pts = geom3.toPoints(obs)
53
+ pts = geom3.toVertices(obs)
54
54
 
55
55
  t.notThrows.skip(() => geom3.validate(obs))
56
56
  t.is(measureArea(obs), 303.76605423529395)
@@ -60,7 +60,7 @@ test('geodesicSphere (options)', (t) => {
60
60
 
61
61
  test('geodesicSphere (zero radius)', (t) => {
62
62
  const obs = geodesicSphere({ radius: 0 })
63
- const pts = geom3.toPoints(obs)
63
+ const pts = geom3.toVertices(obs)
64
64
  t.notThrows(() => geom3.validate(obs))
65
65
  t.is(measureArea(obs), 0)
66
66
  t.is(measureVolume(obs), 0)
@@ -14,7 +14,7 @@ test('polyhedron (points and faces)', (t) => {
14
14
  let faces = [[0, 1, 2, 3], [5, 6, 7, 4], [0, 5, 4, 1], [3, 2, 7, 6], [0, 3, 6, 5], [1, 4, 7, 2]]
15
15
  const colors = [[0, 0, 0, 1], [1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1], [0.5, 0.5, 0.5, 1], [1, 1, 1, 1]]
16
16
  let obs = polyhedron({ points, faces, colors })
17
- let pts = geom3.toPoints(obs)
17
+ let pts = geom3.toVertices(obs)
18
18
  let exp = [
19
19
  [[-1, -1, -1], [-1, -1, 1], [-1, 1, 1], [-1, 1, -1]],
20
20
  [[1, -1, -1], [1, 1, -1], [1, 1, 1], [1, -1, 1]],
@@ -33,7 +33,7 @@ test('polyhedron (points and faces)', (t) => {
33
33
  points = [[10, 10, 0], [10, -10, 0], [-10, -10, 0], [-10, 10, 0], [0, 0, 10]]
34
34
  faces = [[0, 1, 4], [1, 2, 4], [2, 3, 4], [3, 0, 4], [1, 0, 3], [2, 1, 3]]
35
35
  obs = polyhedron({ points: points, faces: faces, orientation: 'inward' })
36
- pts = geom3.toPoints(obs)
36
+ pts = geom3.toVertices(obs)
37
37
  exp = [
38
38
  [[0, 0, 10], [10, -10, 0], [10, 10, 0]],
39
39
  [[0, 0, 10], [-10, -10, 0], [10, -10, 0]],
@@ -10,7 +10,7 @@ import { comparePolygonsAsPoints } from '../../test/helpers/index.js'
10
10
 
11
11
  test('roundedCuboid (defaults)', (t) => {
12
12
  const obs = roundedCuboid()
13
- const pts = geom3.toPoints(obs)
13
+ const pts = geom3.toVertices(obs)
14
14
 
15
15
  t.notThrows(() => geom3.validate(obs))
16
16
  t.is(measureArea(obs), 21.87859958298585)
@@ -20,7 +20,7 @@ test('roundedCuboid (defaults)', (t) => {
20
20
 
21
21
  test('roundedCuboid (zero size)', (t) => {
22
22
  const obs = roundedCuboid({ size: [1, 1, 0] })
23
- const pts = geom3.toPoints(obs)
23
+ const pts = geom3.toVertices(obs)
24
24
  t.notThrows(() => geom3.validate(obs))
25
25
  t.is(measureArea(obs), 0)
26
26
  t.is(measureVolume(obs), 0)
@@ -29,7 +29,7 @@ test('roundedCuboid (zero size)', (t) => {
29
29
 
30
30
  test('roundedCuboid (zero radius)', (t) => {
31
31
  const obs = roundedCuboid({ roundRadius: 0 })
32
- const pts = geom3.toPoints(obs)
32
+ const pts = geom3.toVertices(obs)
33
33
  t.notThrows(() => geom3.validate(obs))
34
34
  t.is(measureArea(obs), 24)
35
35
  t.is(measureVolume(obs), 7.999999999999999)
@@ -39,7 +39,7 @@ test('roundedCuboid (zero radius)', (t) => {
39
39
  test('roundedCuboid (options)', (t) => {
40
40
  // test segments
41
41
  let obs = roundedCuboid({ segments: 8 })
42
- let pts = geom3.toPoints(obs)
42
+ let pts = geom3.toVertices(obs)
43
43
  let exp = []
44
44
 
45
45
  t.notThrows(() => geom3.validate(obs))
@@ -49,7 +49,7 @@ test('roundedCuboid (options)', (t) => {
49
49
 
50
50
  // test center
51
51
  obs = roundedCuboid({ center: [4, 5, 6], segments: 8 })
52
- pts = geom3.toPoints(obs)
52
+ pts = geom3.toVertices(obs)
53
53
  exp = [
54
54
  ]
55
55
 
@@ -60,7 +60,7 @@ test('roundedCuboid (options)', (t) => {
60
60
 
61
61
  // test size
62
62
  obs = roundedCuboid({ size: [8, 10, 12], segments: 8 })
63
- pts = geom3.toPoints(obs)
63
+ pts = geom3.toVertices(obs)
64
64
  exp = [
65
65
  [[4, 4.8, -5.8], [3.9414213562373095, 4.941421356237309, -5.8],
66
66
  [3.9414213562373095, 4.941421356237309, 5.8], [4, 4.8, 5.8]],
@@ -163,7 +163,7 @@ test('roundedCuboid (options)', (t) => {
163
163
 
164
164
  // test roundRadius
165
165
  obs = roundedCuboid({ size: [8, 10, 12], roundRadius: 2, segments: 8 })
166
- pts = geom3.toPoints(obs)
166
+ pts = geom3.toVertices(obs)
167
167
  exp = [
168
168
  [[4, 3, -4], [3.414213562373095, 4.414213562373095, -4],
169
169
  [3.414213562373095, 4.414213562373095, 4], [4, 3, 4]],