@jscad/modeling 2.7.2 → 2.9.1

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 (238) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/jscad-modeling.min.js +443 -398
  3. package/package.json +2 -2
  4. package/src/curves/bezier/tangentAt.test.js +1 -1
  5. package/src/curves/bezier/valueAt.test.js +1 -1
  6. package/src/geometries/geom2/index.d.ts +1 -0
  7. package/src/geometries/geom2/index.js +12 -1
  8. package/src/geometries/geom2/isA.js +2 -2
  9. package/src/geometries/geom2/toCompactBinary.js +4 -4
  10. package/src/geometries/geom2/toString.js +1 -1
  11. package/src/geometries/geom2/transform.test.js +1 -1
  12. package/src/geometries/geom2/validate.d.ts +3 -0
  13. package/src/geometries/geom2/validate.js +36 -0
  14. package/src/geometries/geom3/fromCompactBinary.js +1 -1
  15. package/src/geometries/geom3/index.d.ts +1 -0
  16. package/src/geometries/geom3/index.js +19 -1
  17. package/src/geometries/geom3/isA.js +2 -2
  18. package/src/geometries/geom3/toCompactBinary.js +4 -4
  19. package/src/geometries/geom3/toString.js +1 -1
  20. package/src/geometries/geom3/transform.test.js +1 -1
  21. package/src/geometries/geom3/validate.d.ts +3 -0
  22. package/src/geometries/geom3/validate.js +62 -0
  23. package/src/geometries/index.js +8 -1
  24. package/src/geometries/path2/eachPoint.js +3 -3
  25. package/src/geometries/path2/index.d.ts +1 -0
  26. package/src/geometries/path2/index.js +13 -1
  27. package/src/geometries/path2/isA.js +2 -2
  28. package/src/geometries/path2/reverse.js +4 -4
  29. package/src/geometries/path2/toCompactBinary.js +6 -6
  30. package/src/geometries/path2/toString.js +1 -1
  31. package/src/geometries/path2/transform.test.js +1 -1
  32. package/src/geometries/path2/validate.d.ts +3 -0
  33. package/src/geometries/path2/validate.js +41 -0
  34. package/src/geometries/poly2/arePointsInside.js +0 -35
  35. package/src/geometries/poly2/arePointsInside.test.js +1 -1
  36. package/src/geometries/poly2/index.js +6 -0
  37. package/src/geometries/poly3/index.d.ts +1 -0
  38. package/src/geometries/poly3/index.js +9 -2
  39. package/src/geometries/poly3/invert.js +7 -1
  40. package/src/geometries/poly3/isA.js +2 -2
  41. package/src/geometries/poly3/isConvex.js +2 -2
  42. package/src/geometries/poly3/measureArea.js +4 -4
  43. package/src/geometries/poly3/measureArea.test.js +16 -16
  44. package/src/geometries/poly3/measureBoundingBox.js +2 -2
  45. package/src/geometries/poly3/measureBoundingSphere.js +2 -2
  46. package/src/geometries/poly3/measureBoundingSphere.test.js +8 -8
  47. package/src/geometries/poly3/measureSignedVolume.js +4 -4
  48. package/src/geometries/poly3/toPoints.js +2 -2
  49. package/src/geometries/poly3/toString.js +2 -2
  50. package/src/geometries/poly3/transform.js +2 -2
  51. package/src/geometries/poly3/validate.d.ts +4 -0
  52. package/src/geometries/poly3/validate.js +50 -0
  53. package/src/maths/index.js +1 -1
  54. package/src/maths/line2/equals.js +2 -2
  55. package/src/maths/line2/fromValues.js +2 -2
  56. package/src/maths/line2/intersectPointOfLines.js +1 -1
  57. package/src/maths/line2/intersectPointOfLines.test.js +1 -1
  58. package/src/maths/line2/reverse.test.js +1 -1
  59. package/src/maths/line2/transform.test.js +1 -1
  60. package/src/maths/line3/equals.js +2 -2
  61. package/src/maths/line3/reverse.test.js +1 -1
  62. package/src/maths/line3/transform.test.js +1 -1
  63. package/src/maths/mat4/fromVectorRotation.js +1 -1
  64. package/src/maths/mat4/fromVectorRotation.test.js +1 -1
  65. package/src/maths/mat4/identity.test.js +1 -1
  66. package/src/maths/mat4/invert.js +18 -18
  67. package/src/maths/mat4/isIdentity.js +1 -1
  68. package/src/maths/mat4/isMirroring.js +4 -4
  69. package/src/maths/mat4/isMirroring.test.js +1 -1
  70. package/src/maths/mat4/leftMultiplyVec3.js +2 -2
  71. package/src/maths/mat4/toString.js +2 -2
  72. package/src/maths/mat4/translate.test.js +1 -1
  73. package/src/maths/plane/flip.test.js +1 -1
  74. package/src/maths/plane/fromPoints.d.ts +1 -1
  75. package/src/maths/plane/fromPoints.js +1 -3
  76. package/src/maths/plane/signedDistanceToPoint.js +1 -1
  77. package/src/maths/plane/transform.test.js +1 -1
  78. package/src/maths/utils/aboutEqualNormals.js +2 -2
  79. package/src/maths/vec2/abs.d.ts +1 -1
  80. package/src/maths/vec2/add.test.js +1 -1
  81. package/src/maths/vec2/angleDegrees.d.ts +1 -1
  82. package/src/maths/vec2/angleRadians.d.ts +1 -1
  83. package/src/maths/vec2/create.js +1 -1
  84. package/src/maths/vec2/cross.test.js +1 -1
  85. package/src/maths/vec2/divide.test.js +1 -1
  86. package/src/maths/vec2/fromAngleDegrees.js +1 -1
  87. package/src/maths/vec2/fromScalar.js +1 -1
  88. package/src/maths/vec2/length.d.ts +1 -1
  89. package/src/maths/vec2/length.js +1 -1
  90. package/src/maths/vec2/lerp.test.js +1 -1
  91. package/src/maths/vec2/multiply.test.js +1 -1
  92. package/src/maths/vec2/negate.test.js +1 -1
  93. package/src/maths/vec2/normal.js +1 -1
  94. package/src/maths/vec2/normalize.d.ts +1 -1
  95. package/src/maths/vec2/normalize.test.js +1 -1
  96. package/src/maths/vec2/rotate.test.js +1 -1
  97. package/src/maths/vec2/squaredLength.d.ts +1 -1
  98. package/src/maths/vec2/squaredLength.js +3 -3
  99. package/src/maths/vec2/subtract.test.js +1 -1
  100. package/src/maths/vec2/toString.js +1 -1
  101. package/src/maths/vec2/transform.test.js +1 -1
  102. package/src/maths/vec3/abs.d.ts +1 -1
  103. package/src/maths/vec3/add.test.js +1 -1
  104. package/src/maths/vec3/cross.test.js +1 -1
  105. package/src/maths/vec3/divide.test.js +1 -1
  106. package/src/maths/vec3/fromScalar.js +1 -1
  107. package/src/maths/vec3/fromVec2.d.ts +1 -1
  108. package/src/maths/vec3/fromVec2.js +3 -3
  109. package/src/maths/vec3/length.d.ts +1 -1
  110. package/src/maths/vec3/length.js +4 -4
  111. package/src/maths/vec3/lerp.test.js +1 -1
  112. package/src/maths/vec3/multiply.test.js +1 -1
  113. package/src/maths/vec3/negate.d.ts +1 -1
  114. package/src/maths/vec3/negate.test.js +1 -1
  115. package/src/maths/vec3/normalize.d.ts +1 -1
  116. package/src/maths/vec3/normalize.test.js +1 -1
  117. package/src/maths/vec3/rotateX.test.js +1 -1
  118. package/src/maths/vec3/rotateY.test.js +1 -1
  119. package/src/maths/vec3/rotateZ.test.js +1 -1
  120. package/src/maths/vec3/scale.test.js +1 -1
  121. package/src/maths/vec3/squaredLength.d.ts +1 -1
  122. package/src/maths/vec3/squaredLength.js +4 -4
  123. package/src/maths/vec3/subtract.test.js +1 -1
  124. package/src/maths/vec3/toString.js +1 -1
  125. package/src/maths/vec3/transform.test.js +1 -1
  126. package/src/maths/vec4/toString.js +1 -1
  127. package/src/maths/vec4/transform.test.js +1 -1
  128. package/src/measurements/measureBoundingSphere.js +4 -4
  129. package/src/measurements/measureCenterOfMass.js +1 -1
  130. package/src/measurements/measureCenterOfMass.test.js +2 -2
  131. package/src/operations/booleans/intersect.test.js +8 -0
  132. package/src/operations/booleans/mayOverlap.js +3 -3
  133. package/src/operations/booleans/retessellate.js +2 -2
  134. package/src/operations/booleans/scission.js +1 -1
  135. package/src/operations/booleans/scission.test.js +4 -4
  136. package/src/operations/booleans/subtract.js +1 -1
  137. package/src/operations/booleans/subtract.test.js +8 -0
  138. package/src/operations/booleans/trees/Node.js +10 -16
  139. package/src/operations/booleans/trees/PolygonTreeNode.js +13 -14
  140. package/src/operations/booleans/trees/Tree.js +1 -2
  141. package/src/operations/booleans/trees/splitPolygonByPlane.js +2 -3
  142. package/src/operations/booleans/union.test.js +28 -1
  143. package/src/operations/booleans/unionGeom3Sub.js +1 -1
  144. package/src/operations/expansions/expand.js +2 -2
  145. package/src/operations/expansions/expand.test.js +32 -55
  146. package/src/operations/expansions/expandShell.js +24 -18
  147. package/src/operations/expansions/offset.js +1 -1
  148. package/src/operations/expansions/offset.test.js +50 -89
  149. package/src/operations/expansions/offsetFromPoints.js +11 -6
  150. package/src/operations/extrusions/earcut/assignHoles.js +91 -0
  151. package/src/operations/extrusions/earcut/assignHoles.test.js +74 -0
  152. package/src/operations/extrusions/earcut/eliminateHoles.js +131 -0
  153. package/src/operations/extrusions/earcut/index.js +252 -0
  154. package/src/operations/extrusions/earcut/linkedList.js +58 -0
  155. package/src/operations/extrusions/earcut/linkedListSort.js +54 -0
  156. package/src/operations/extrusions/earcut/linkedPolygon.js +197 -0
  157. package/src/operations/extrusions/earcut/polygonHierarchy.js +64 -0
  158. package/src/operations/extrusions/earcut/triangle.js +16 -0
  159. package/src/operations/extrusions/extrudeFromSlices.js +10 -3
  160. package/src/operations/extrusions/extrudeFromSlices.test.js +47 -31
  161. package/src/operations/extrusions/extrudeLinear.js +10 -5
  162. package/src/operations/extrusions/extrudeLinear.test.js +91 -35
  163. package/src/operations/extrusions/extrudeLinearGeom2.js +5 -2
  164. package/src/operations/extrusions/extrudeLinearPath2.js +24 -0
  165. package/src/operations/extrusions/extrudeRectangular.js +1 -1
  166. package/src/operations/extrusions/extrudeRectangular.test.js +22 -15
  167. package/src/operations/extrusions/extrudeRotate.test.js +31 -27
  168. package/src/operations/extrusions/project.js +1 -1
  169. package/src/operations/extrusions/project.test.js +5 -5
  170. package/src/operations/extrusions/slice/calculatePlane.js +7 -4
  171. package/src/operations/extrusions/slice/isA.js +2 -2
  172. package/src/operations/extrusions/slice/repairSlice.js +47 -0
  173. package/src/operations/extrusions/slice/toPolygons.js +24 -60
  174. package/src/operations/hulls/hull.test.js +25 -2
  175. package/src/operations/hulls/hullChain.js +1 -1
  176. package/src/operations/hulls/hullChain.test.js +6 -4
  177. package/src/operations/hulls/hullGeom2.js +1 -1
  178. package/src/operations/hulls/hullPath2.js +6 -4
  179. package/src/operations/hulls/hullPath2.test.js +16 -0
  180. package/src/operations/hulls/hullPoints2.test.js +1 -1
  181. package/src/operations/modifiers/edges.js +1 -1
  182. package/src/operations/modifiers/generalize.js +1 -1
  183. package/src/operations/modifiers/generalize.test.js +6 -0
  184. package/src/operations/modifiers/snap.test.js +3 -3
  185. package/src/operations/transforms/align.d.ts +1 -1
  186. package/src/operations/transforms/align.test.js +12 -0
  187. package/src/operations/transforms/center.js +17 -17
  188. package/src/operations/transforms/center.test.js +12 -0
  189. package/src/operations/transforms/mirror.js +12 -12
  190. package/src/operations/transforms/mirror.test.js +16 -0
  191. package/src/operations/transforms/rotate.js +12 -12
  192. package/src/operations/transforms/rotate.test.js +10 -0
  193. package/src/operations/transforms/scale.js +19 -19
  194. package/src/operations/transforms/scale.test.js +15 -0
  195. package/src/operations/transforms/transform.js +3 -3
  196. package/src/operations/transforms/transform.test.js +5 -0
  197. package/src/operations/transforms/translate.js +14 -14
  198. package/src/operations/transforms/translate.test.js +16 -0
  199. package/src/primitives/arc.js +1 -1
  200. package/src/primitives/arc.test.js +11 -0
  201. package/src/primitives/circle.test.js +15 -9
  202. package/src/primitives/cube.test.js +3 -0
  203. package/src/primitives/cuboid.test.js +9 -24
  204. package/src/primitives/cylinder.test.js +7 -4
  205. package/src/primitives/cylinderElliptic.js +13 -6
  206. package/src/primitives/cylinderElliptic.test.js +72 -52
  207. package/src/primitives/ellipse.js +3 -1
  208. package/src/primitives/ellipse.test.js +14 -8
  209. package/src/primitives/ellipsoid.js +7 -5
  210. package/src/primitives/ellipsoid.test.js +84 -82
  211. package/src/primitives/geodesicSphere.d.ts +0 -1
  212. package/src/primitives/geodesicSphere.test.js +3 -0
  213. package/src/primitives/line.test.js +1 -0
  214. package/src/primitives/polygon.test.js +15 -10
  215. package/src/primitives/polyhedron.js +1 -1
  216. package/src/primitives/polyhedron.test.js +14 -42
  217. package/src/primitives/rectangle.test.js +3 -0
  218. package/src/primitives/roundedCuboid.test.js +5 -0
  219. package/src/primitives/roundedCylinder.js +6 -4
  220. package/src/primitives/roundedCylinder.test.js +40 -36
  221. package/src/primitives/roundedRectangle.test.js +5 -0
  222. package/src/primitives/sphere.test.js +52 -73
  223. package/src/primitives/square.test.js +3 -0
  224. package/src/primitives/star.test.js +6 -0
  225. package/src/primitives/torus.d.ts +0 -1
  226. package/src/primitives/torus.test.js +8 -1
  227. package/src/primitives/triangle.js +1 -1
  228. package/src/primitives/triangle.test.js +7 -0
  229. package/src/text/vectorText.js +2 -2
  230. package/src/utils/areAllShapesTheSameType.js +2 -2
  231. package/src/utils/areAllShapesTheSameType.test.js +17 -0
  232. package/src/utils/index.d.ts +1 -0
  233. package/src/utils/index.js +3 -1
  234. package/src/utils/padArrayToLength.js +1 -1
  235. package/src/utils/trigonometry.d.ts +2 -0
  236. package/src/utils/trigonometry.js +35 -0
  237. package/src/utils/trigonometry.test.js +25 -0
  238. package/test/helpers/nearlyEqual.js +4 -1
@@ -24,18 +24,18 @@ const centerGeometry = (options, object) => {
24
24
  }
25
25
 
26
26
  /**
27
- * Center the given geometries using the given options.
27
+ * Center the given objects using the given options.
28
28
  * @param {Object} options - options for centering
29
29
  * @param {Array} [options.axes=[true,true,true]] - axis of which to center, true or false
30
- * @param {Array} [options.relativeTo=[0,0,0]] - relative point of which to center the geometries
31
- * @param {...Object} geometries - the geometries to center
32
- * @return {Object|Array} the centered geometry, or a list of centered geometries
30
+ * @param {Array} [options.relativeTo=[0,0,0]] - relative point of which to center the objects
31
+ * @param {...Object} objects - the objects to center
32
+ * @return {Object|Array} the centered object, or a list of centered objects
33
33
  * @alias module:modeling/transforms.center
34
34
  *
35
35
  * @example
36
36
  * let myshape = center({axes: [true,false,false]}, sphere()) // center about the X axis
37
37
  */
38
- const center = (options, ...geometries) => {
38
+ const center = (options, ...objects) => {
39
39
  const defaults = {
40
40
  axes: [true, true, true],
41
41
  relativeTo: [0, 0, 0]
@@ -43,13 +43,13 @@ const center = (options, ...geometries) => {
43
43
  }
44
44
  const { axes, relativeTo } = Object.assign({}, defaults, options)
45
45
 
46
- geometries = flatten(geometries)
47
- if (geometries.length === 0) throw new Error('wrong number of arguments')
46
+ objects = flatten(objects)
47
+ if (objects.length === 0) throw new Error('wrong number of arguments')
48
48
  if (relativeTo.length !== 3) throw new Error('relativeTo must be an array of length 3')
49
49
 
50
50
  options = { axes, relativeTo }
51
51
 
52
- const results = geometries.map((object) => {
52
+ const results = objects.map((object) => {
53
53
  if (path2.isA(object)) return centerGeometry(options, object)
54
54
  if (geom2.isA(object)) return centerGeometry(options, object)
55
55
  if (geom3.isA(object)) return centerGeometry(options, object)
@@ -59,25 +59,25 @@ const center = (options, ...geometries) => {
59
59
  }
60
60
 
61
61
  /**
62
- * Center the given geometries about the X axis.
63
- * @param {...Object} geometries - the geometries to center
64
- * @return {Object|Array} the centered geometry, or a list of centered geometry
62
+ * Center the given objects about the X axis.
63
+ * @param {...Object} objects - the objects to center
64
+ * @return {Object|Array} the centered object, or a list of centered objects
65
65
  * @alias module:modeling/transforms.centerX
66
66
  */
67
67
  const centerX = (...objects) => center({ axes: [true, false, false] }, objects)
68
68
 
69
69
  /**
70
- * Center the given geometries about the Y axis.
71
- * @param {...Object} geometries - the geometries to center
72
- * @return {Object|Array} the centered geometry, or a list of centered geometry
70
+ * Center the given objects about the Y axis.
71
+ * @param {...Object} objects - the objects to center
72
+ * @return {Object|Array} the centered object, or a list of centered objects
73
73
  * @alias module:modeling/transforms.centerY
74
74
  */
75
75
  const centerY = (...objects) => center({ axes: [false, true, false] }, objects)
76
76
 
77
77
  /**
78
- * Center the given geometries about the Z axis.
79
- * @param {...Object} geometries - the geometries to center
80
- * @return {Object|Array} the centered geometry, or a list of centered geometry
78
+ * Center the given objects about the Z axis.
79
+ * @param {...Object} objects - the objects to center
80
+ * @return {Object|Array} the centered object, or a list of centered objects
81
81
  * @alias module:modeling/transforms.centerZ
82
82
  */
83
83
  const centerZ = (...objects) => center({ axes: [false, false, true] }, objects)
@@ -13,10 +13,12 @@ test('center: centering of a path2 produces expected changes to points', (t) =>
13
13
  let centered = center({ axes: [true, false, false] }, geometry)
14
14
  let pts = path2.toPoints(centered)
15
15
  const exp = [[3, 0], [-2, 3], [-3, 0]]
16
+ t.notThrows(() => path2.validate(centered))
16
17
  t.true(comparePoints(pts, exp))
17
18
 
18
19
  centered = centerX(geometry)
19
20
  pts = path2.toPoints(centered)
21
+ t.notThrows(() => path2.validate(centered))
20
22
  t.true(comparePoints(pts, exp))
21
23
  })
22
24
 
@@ -27,10 +29,12 @@ test('center: centering of a geom2 produces expected changes to points', (t) =>
27
29
  let centered = center({ axes: [false, true, false] }, geometry)
28
30
  let pts = geom2.toPoints(centered)
29
31
  const exp = [[0, -5], [10, -5], [0, 5]]
32
+ t.notThrows(() => geom2.validate(centered))
30
33
  t.true(comparePoints(pts, exp))
31
34
 
32
35
  centered = centerY(geometry)
33
36
  pts = geom2.toPoints(centered)
37
+ t.notThrows(() => geom2.validate(centered))
34
38
  t.true(comparePoints(pts, exp))
35
39
  })
36
40
 
@@ -56,10 +60,12 @@ test('center: centering of a geom3 produces expected changes to polygons', (t) =
56
60
  [[-5, -7, -12], [-5, 13, -12], [5, 13, -12], [5, -7, -12]],
57
61
  [[-5, -7, 18], [5, -7, 18], [5, 13, 18], [-5, 13, 18]]
58
62
  ]
63
+ t.notThrows(() => geom3.validate(centered))
59
64
  t.true(comparePolygonsAsPoints(pts, exp))
60
65
 
61
66
  centered = centerX(geometry)
62
67
  pts = geom3.toPoints(centered)
68
+ t.notThrows(() => geom3.validate(centered))
63
69
  t.true(comparePolygonsAsPoints(pts, exp))
64
70
 
65
71
  // center about Y
@@ -73,10 +79,12 @@ test('center: centering of a geom3 produces expected changes to polygons', (t) =
73
79
  [[-2, -10, -12], [-2, 10, -12], [8, 10, -12], [8, -10, -12]],
74
80
  [[-2, -10, 18], [8, -10, 18], [8, 10, 18], [-2, 10, 18]]
75
81
  ]
82
+ t.notThrows(() => geom3.validate(centered))
76
83
  t.true(comparePolygonsAsPoints(pts, exp))
77
84
 
78
85
  centered = centerY(geometry)
79
86
  pts = geom3.toPoints(centered)
87
+ t.notThrows(() => geom3.validate(centered))
80
88
  t.true(comparePolygonsAsPoints(pts, exp))
81
89
 
82
90
  // center about Z
@@ -90,10 +98,12 @@ test('center: centering of a geom3 produces expected changes to polygons', (t) =
90
98
  [[-2, -7, -15], [-2, 13, -15], [8, 13, -15], [8, -7, -15]],
91
99
  [[-2, -7, 15], [8, -7, 15], [8, 13, 15], [-2, 13, 15]]
92
100
  ]
101
+ t.notThrows(() => geom3.validate(centered))
93
102
  t.true(comparePolygonsAsPoints(pts, exp))
94
103
 
95
104
  centered = centerZ(geometry)
96
105
  pts = geom3.toPoints(centered)
106
+ t.notThrows(() => geom3.validate(centered))
97
107
  t.true(comparePolygonsAsPoints(pts, exp))
98
108
  })
99
109
 
@@ -108,9 +118,11 @@ test('center: centering of multiple objects produces expected changes', (t) => {
108
118
 
109
119
  const pts1 = path2.toPoints(centered[1])
110
120
  const exp1 = [[2.5, 20], [12.5, 20], [2.5, 10], [17.5, 10]]
121
+ t.notThrows(() => path2.validate(centered[1]))
111
122
  t.true(comparePoints(pts1, exp1))
112
123
 
113
124
  const pts2 = geom2.toPoints(centered[2])
114
125
  const exp2 = [[2.5, 10], [7.5, 20], [17.5, 10]]
126
+ t.notThrows(() => geom2.validate(centered[2]))
115
127
  t.true(comparePoints(pts2, exp2))
116
128
  })
@@ -8,12 +8,12 @@ const geom3 = require('../../geometries/geom3')
8
8
  const path2 = require('../../geometries/path2')
9
9
 
10
10
  /**
11
- * Mirror the given geometries using the given options.
11
+ * Mirror the given objects using the given options.
12
12
  * @param {Object} options - options for mirror
13
13
  * @param {Array} [options.origin=[0,0,0]] - the origin of the plane
14
14
  * @param {Array} [options.normal=[0,0,1]] - the normal vector of the plane
15
- * @param {...Object} geometries - the geometries to mirror
16
- * @return {Object|Array} the mirrored geometry, or a list of mirrored geometry
15
+ * @param {...Object} objects - the objects to mirror
16
+ * @return {Object|Array} the mirrored object, or a list of mirrored objects
17
17
  * @alias module:modeling/transforms.mirror
18
18
  *
19
19
  * @example
@@ -47,25 +47,25 @@ const mirror = (options, ...objects) => {
47
47
  }
48
48
 
49
49
  /**
50
- * Mirror the given geometries about the X axis.
51
- * @param {...Object} geometries - the geometries to mirror
52
- * @return {Object|Array} the mirrored geometry, or a list of mirrored geometry
50
+ * Mirror the given objects about the X axis.
51
+ * @param {...Object} objects - the objects to mirror
52
+ * @return {Object|Array} the mirrored object, or a list of mirrored objects
53
53
  * @alias module:modeling/transforms.mirrorX
54
54
  */
55
55
  const mirrorX = (...objects) => mirror({ normal: [1, 0, 0] }, objects)
56
56
 
57
57
  /**
58
- * Mirror the given geometries about the Y axis.
59
- * @param {...Object} geometries - the geometries to mirror
60
- * @return {Object|Array} the mirrored geometry, or a list of mirrored geometry
58
+ * Mirror the given objects about the Y axis.
59
+ * @param {...Object} objects - the geometries to mirror
60
+ * @return {Object|Array} the mirrored object, or a list of mirrored objects
61
61
  * @alias module:modeling/transforms.mirrorY
62
62
  */
63
63
  const mirrorY = (...objects) => mirror({ normal: [0, 1, 0] }, objects)
64
64
 
65
65
  /**
66
- * Mirror the given object(s) about the Z axis.
67
- * @param {...Object} geometries - the geometries to mirror
68
- * @return {Object|Array} the mirrored geometry, or a list of mirrored geometry
66
+ * Mirror the given objects about the Z axis.
67
+ * @param {...Object} objects - the geometries to mirror
68
+ * @return {Object|Array} the mirrored object, or a list of mirrored objects
69
69
  * @alias module:modeling/transforms.mirrorZ
70
70
  */
71
71
  const mirrorZ = (...objects) => mirror({ normal: [0, 0, 1] }, objects)
@@ -13,20 +13,24 @@ test('mirror: mirroring of path2 about X/Y produces expected changes to points',
13
13
  let mirrored = mirror({ normal: [1, 0, 0] }, geometry)
14
14
  let obs = path2.toPoints(mirrored)
15
15
  let exp = [[5, 5], [-5, 5], [5, -5], [-10, -5]]
16
+ t.notThrows(() => path2.validate(mirrored))
16
17
  t.true(comparePoints(obs, exp))
17
18
 
18
19
  mirrored = mirrorX(geometry)
19
20
  obs = path2.toPoints(mirrored)
21
+ t.notThrows(() => path2.validate(mirrored))
20
22
  t.true(comparePoints(obs, exp))
21
23
 
22
24
  // mirror about Y
23
25
  mirrored = mirror({ normal: [0, 1, 0] }, geometry)
24
26
  obs = path2.toPoints(mirrored)
25
27
  exp = [[-5, -5], [5, -5], [-5, 5], [10, 5]]
28
+ t.notThrows(() => path2.validate(mirrored))
26
29
  t.true(comparePoints(obs, exp))
27
30
 
28
31
  mirrored = mirrorY(geometry)
29
32
  obs = path2.toPoints(mirrored)
33
+ t.notThrows(() => path2.validate(mirrored))
30
34
  t.true(comparePoints(obs, exp))
31
35
  })
32
36
 
@@ -37,20 +41,24 @@ test('mirror: mirroring of geom2 about X/Y produces expected changes to points',
37
41
  let mirrored = mirror({ normal: [1, 0, 0] }, geometry)
38
42
  let obs = geom2.toPoints(mirrored)
39
43
  let exp = [[5, -5], [0, 5], [-10, -5]]
44
+ t.notThrows(() => geom2.validate(mirrored))
40
45
  t.true(comparePoints(obs, exp))
41
46
 
42
47
  mirrored = mirrorX(geometry)
43
48
  obs = geom2.toPoints(mirrored)
49
+ t.notThrows(() => geom2.validate(mirrored))
44
50
  t.true(comparePoints(obs, exp))
45
51
 
46
52
  // mirror about Y
47
53
  mirrored = mirror({ normal: [0, 1, 0] }, geometry)
48
54
  obs = geom2.toPoints(mirrored)
49
55
  exp = [[-5, 5], [0, -5], [10, 5]]
56
+ t.notThrows(() => geom2.validate(mirrored))
50
57
  t.true(comparePoints(obs, exp))
51
58
 
52
59
  mirrored = mirrorY(geometry)
53
60
  obs = geom2.toPoints(mirrored)
61
+ t.notThrows(() => geom2.validate(mirrored))
54
62
  t.true(comparePoints(obs, exp))
55
63
  })
56
64
 
@@ -76,11 +84,13 @@ test('mirror: mirroring of geom3 about X/Y/Z produces expected changes to polygo
76
84
  [[-8, -7, -12], [-8, 13, -12], [2, 13, -12], [2, -7, -12]],
77
85
  [[2, 13, 18], [-8, 13, 18], [-8, -7, 18], [2, -7, 18]]
78
86
  ]
87
+ t.notThrows(() => geom3.validate(mirrored))
79
88
  t.true(comparePolygonsAsPoints(obs, exp))
80
89
  t.deepEqual(obs, exp)
81
90
 
82
91
  mirrored = mirrorX(geometry)
83
92
  obs = geom3.toPoints(mirrored)
93
+ t.notThrows(() => geom3.validate(mirrored))
84
94
  t.true(comparePolygonsAsPoints(obs, exp))
85
95
 
86
96
  // mirror about Y
@@ -94,10 +104,12 @@ test('mirror: mirroring of geom3 about X/Y/Z produces expected changes to polygo
94
104
  [[8, 7, -12], [8, -13, -12], [-2, -13, -12], [-2, 7, -12]],
95
105
  [[-2, -13, 18], [8, -13, 18], [8, 7, 18], [-2, 7, 18]]
96
106
  ]
107
+ t.notThrows(() => geom3.validate(mirrored))
97
108
  t.true(comparePolygonsAsPoints(obs, exp))
98
109
 
99
110
  mirrored = mirrorY(geometry)
100
111
  obs = geom3.toPoints(mirrored)
112
+ t.notThrows(() => geom3.validate(mirrored))
101
113
  t.true(comparePolygonsAsPoints(obs, exp))
102
114
 
103
115
  // mirror about Z
@@ -111,10 +123,12 @@ test('mirror: mirroring of geom3 about X/Y/Z produces expected changes to polygo
111
123
  [[8, -7, 12], [8, 13, 12], [-2, 13, 12], [-2, -7, 12]],
112
124
  [[-2, 13, -18], [8, 13, -18], [8, -7, -18], [-2, -7, -18]]
113
125
  ]
126
+ t.notThrows(() => geom3.validate(mirrored))
114
127
  t.true(comparePolygonsAsPoints(obs, exp))
115
128
 
116
129
  mirrored = mirrorZ(geometry)
117
130
  obs = geom3.toPoints(mirrored)
131
+ t.notThrows(() => geom3.validate(mirrored))
118
132
  t.true(comparePolygonsAsPoints(obs, exp))
119
133
  })
120
134
 
@@ -128,9 +142,11 @@ test('mirror: mirroring of multiple objects produces an array of mirrored object
128
142
 
129
143
  let obs = path2.toPoints(mirrored[1])
130
144
  let exp = [[-5, -5], [5, -5], [-5, 5], [10, 5]]
145
+ t.notThrows(() => path2.validate(mirrored[1]))
131
146
  t.true(comparePoints(obs, exp))
132
147
 
133
148
  obs = geom2.toPoints(mirrored[2])
134
149
  exp = [[-5, 5], [0, -5], [10, 5]]
150
+ t.notThrows(() => geom2.validate(mirrored[2]))
135
151
  t.true(comparePoints(obs, exp))
136
152
  })
@@ -7,10 +7,10 @@ const geom3 = require('../../geometries/geom3')
7
7
  const path2 = require('../../geometries/path2')
8
8
 
9
9
  /**
10
- * Rotate the given geometries using the given options.
10
+ * Rotate the given objects using the given options.
11
11
  * @param {Array} angles - angle (RADIANS) of rotations about X, Y, and Z axis
12
- * @param {...Object} geometries - the geometries to rotate
13
- * @return {Object|Array} the rotated geometry, or a list of rotated geometries
12
+ * @param {...Object} objects - the objects to rotate
13
+ * @return {Object|Array} the rotated object, or a list of rotated objects
14
14
  * @alias module:modeling/transforms.rotate
15
15
  *
16
16
  * @example
@@ -42,28 +42,28 @@ const rotate = (angles, ...objects) => {
42
42
  }
43
43
 
44
44
  /**
45
- * Rotate the given object(s) about the X axis, using the given options.
45
+ * Rotate the given objects about the X axis, using the given options.
46
46
  * @param {Number} angle - angle (RADIANS) of rotations about X
47
- * @param {...Object} geometries - the geometries to rotate
48
- * @return {Object|Array} the rotated geometry, or a list of rotated geometries
47
+ * @param {...Object} objects - the objects to rotate
48
+ * @return {Object|Array} the rotated object, or a list of rotated objects
49
49
  * @alias module:modeling/transforms.rotateX
50
50
  */
51
51
  const rotateX = (angle, ...objects) => rotate([angle, 0, 0], objects)
52
52
 
53
53
  /**
54
- * Rotate the given object(s) about the Y axis, using the given options.
54
+ * Rotate the given objects about the Y axis, using the given options.
55
55
  * @param {Number} angle - angle (RADIANS) of rotations about Y
56
- * @param {...Object} geometries - the geometries to rotate
57
- * @return {Object|Array} the rotated geometry, or a list of rotated geometries
56
+ * @param {...Object} objects - the objects to rotate
57
+ * @return {Object|Array} the rotated object, or a list of rotated objects
58
58
  * @alias module:modeling/transforms.rotateY
59
59
  */
60
60
  const rotateY = (angle, ...objects) => rotate([0, angle, 0], objects)
61
61
 
62
62
  /**
63
- * Rotate the given object(s) about the Z axis, using the given options.
63
+ * Rotate the given objects about the Z axis, using the given options.
64
64
  * @param {Number} angle - angle (RADIANS) of rotations about Z
65
- * @param {...Object} geometries - the geometries to rotate
66
- * @return {Object|Array} the rotated geometry, or a list of rotated geometries
65
+ * @param {...Object} objects - the objects to rotate
66
+ * @return {Object|Array} the rotated object, or a list of rotated objects
67
67
  * @alias module:modeling/transforms.rotateZ
68
68
  */
69
69
  const rotateZ = (angle, ...objects) => rotate([0, 0, angle], objects)
@@ -21,6 +21,7 @@ test('rotate: rotating of a path2 produces expected changes to points', (t) => {
21
21
 
22
22
  rotated = rotateZ(Math.PI / 2, geometry)
23
23
  obs = path2.toPoints(rotated)
24
+ t.notThrows(() => path2.validate(rotated))
24
25
  t.true(comparePoints(obs, exp))
25
26
  })
26
27
 
@@ -35,10 +36,12 @@ test('rotate: rotating of a geom2 produces expected changes to points', (t) => {
35
36
  new Float32Array([0, -1]),
36
37
  new Float32Array([1, 0])
37
38
  ]
39
+ t.notThrows(() => geom2.validate(rotated))
38
40
  t.true(comparePoints(obs, exp))
39
41
 
40
42
  rotated = rotateZ(-Math.PI / 2, geometry)
41
43
  obs = geom2.toPoints(rotated)
44
+ t.notThrows(() => geom2.validate(rotated))
42
45
  t.true(comparePoints(obs, exp))
43
46
  })
44
47
 
@@ -70,10 +73,12 @@ test('rotate: rotating of a geom3 produces expected changes to polygons', (t) =>
70
73
  [[-2, -18, -6.999999999999999], [8, -18, -6.999999999999999],
71
74
  [8, -18, 13.000000000000002], [-2, -18, 13.000000000000002]]
72
75
  ]
76
+ t.notThrows(() => geom3.validate(rotated))
73
77
  t.true(comparePolygonsAsPoints(obs, exp))
74
78
 
75
79
  rotated = rotateX(Math.PI / 2, geometry)
76
80
  obs = geom3.toPoints(rotated)
81
+ t.notThrows(() => geom3.validate(rotated))
77
82
  t.true(comparePolygonsAsPoints(obs, exp))
78
83
 
79
84
  // rotate about Y
@@ -93,6 +98,7 @@ test('rotate: rotating of a geom3 produces expected changes to polygons', (t) =>
93
98
  [[-18, -7, -1.999999999999999], [-18, -7, 8.000000000000002],
94
99
  [-18, 13, 8.000000000000002], [-18, 13, -1.999999999999999]]
95
100
  ]
101
+ t.notThrows(() => geom3.validate(rotated))
96
102
  t.true(comparePolygonsAsPoints(obs, exp))
97
103
 
98
104
  rotated = rotateY(-Math.PI / 2, geometry)
@@ -116,10 +122,12 @@ test('rotate: rotating of a geom3 produces expected changes to polygons', (t) =>
116
122
  [[2.000000000000001, 7, 18], [-7.999999999999999, 7.000000000000001, 18],
117
123
  [-8.000000000000002, -12.999999999999998, 18], [1.9999999999999984, -13, 18]]
118
124
  ]
125
+ t.notThrows(() => geom3.validate(rotated))
119
126
  t.true(comparePolygonsAsPoints(obs, exp))
120
127
 
121
128
  rotated = rotateZ(Math.PI, geometry)
122
129
  obs = geom3.toPoints(rotated)
130
+ t.notThrows(() => geom3.validate(rotated))
123
131
  t.true(comparePolygonsAsPoints(obs, exp))
124
132
  })
125
133
 
@@ -134,9 +142,11 @@ test('rotate: rotating of multiple objects produces expected changes', (t) => {
134
142
 
135
143
  const obs1 = path2.toPoints(rotated[1])
136
144
  const exp1 = [[-5, -5], [-5, 5], [5, -5], [5.000000000000001, 10]]
145
+ t.notThrows(() => path2.validate(rotated[1]))
137
146
  t.true(comparePoints(obs1, exp1))
138
147
 
139
148
  const obs2 = geom2.toPoints(rotated[2])
140
149
  const exp2 = [[5, -5], [-5, 3.061616997868383e-16], [5.000000000000001, 10]]
150
+ t.notThrows(() => geom2.validate(rotated[2]))
141
151
  t.true(comparePoints(obs2, exp2))
142
152
  })
@@ -7,10 +7,10 @@ const geom3 = require('../../geometries/geom3')
7
7
  const path2 = require('../../geometries/path2')
8
8
 
9
9
  /**
10
- * Scale the given geometries using the given options.
11
- * @param {Array} factors - X, Y, Z factors by which to scale the geometries
12
- * @param {...Object} geometries - the geometries to scale
13
- * @return {Object|Array} the scaled geometry, or a list of scaled geometries
10
+ * Scale the given objects using the given options.
11
+ * @param {Array} factors - X, Y, Z factors by which to scale the objects
12
+ * @param {...Object} objects - the objects to scale
13
+ * @return {Object|Array} the scaled object, or a list of scaled objects
14
14
  * @alias module:modeling/transforms.scale
15
15
  *
16
16
  * @example
@@ -40,31 +40,31 @@ const scale = (factors, ...objects) => {
40
40
  }
41
41
 
42
42
  /**
43
- * Scale the given geometries about the X axis using the given options.
44
- * @param {Number} factor - X factor by which to scale the geometries
45
- * @param {...Object} geometries - the geometries to scale
46
- * @return {Object|Array} the scaled geometry, or a list of scaled geometries
43
+ * Scale the given objects about the X axis using the given options.
44
+ * @param {Number} factor - X factor by which to scale the objects
45
+ * @param {...Object} objects - the objects to scale
46
+ * @return {Object|Array} the scaled object, or a list of scaled objects
47
47
  * @alias module:modeling/transforms.scaleX
48
48
  */
49
- const scaleX = (offset, ...objects) => scale([offset, 1, 1], objects)
49
+ const scaleX = (factor, ...objects) => scale([factor, 1, 1], objects)
50
50
 
51
51
  /**
52
- * Scale the given geometries about the Y axis using the given options.
53
- * @param {Number} factor - Y factor by which to scale the geometries
54
- * @param {...Object} geometries - the geometries to scale
55
- * @return {Object|Array} the scaled geometry, or a list of scaled geometries
52
+ * Scale the given objects about the Y axis using the given options.
53
+ * @param {Number} factor - Y factor by which to scale the objects
54
+ * @param {...Object} objects - the objects to scale
55
+ * @return {Object|Array} the scaled object, or a list of scaled objects
56
56
  * @alias module:modeling/transforms.scaleY
57
57
  */
58
- const scaleY = (offset, ...objects) => scale([1, offset, 1], objects)
58
+ const scaleY = (factor, ...objects) => scale([1, factor, 1], objects)
59
59
 
60
60
  /**
61
- * Scale the given geometries about the Z axis using the given options.
62
- * @param {Number} factor - Z factor by which to scale the geometries
63
- * @param {...Object} geometries - the geometries to scale
64
- * @return {Object|Array} the scaled geometry, or a list of scaled geometries
61
+ * Scale the given objects about the Z axis using the given options.
62
+ * @param {Number} factor - Z factor by which to scale the objects
63
+ * @param {...Object} objects - the objects to scale
64
+ * @return {Object|Array} the scaled object, or a list of scaled objects
65
65
  * @alias module:modeling/transforms.scaleZ
66
66
  */
67
- const scaleZ = (offset, ...objects) => scale([1, 1, offset], objects)
67
+ const scaleZ = (factor, ...objects) => scale([1, 1, factor], objects)
68
68
 
69
69
  module.exports = {
70
70
  scale,
@@ -13,20 +13,24 @@ test('scale: scaling of a path2 produces expected changes to points', (t) => {
13
13
  let scaled = scale([3], geometry)
14
14
  let obs = path2.toPoints(scaled)
15
15
  let exp = [[0, 4], [3, 0]]
16
+ t.notThrows(() => path2.validate(scaled))
16
17
  t.true(comparePoints(obs, exp))
17
18
 
18
19
  scaled = scaleX(3, geometry)
19
20
  obs = path2.toPoints(scaled)
21
+ t.notThrows(() => path2.validate(scaled))
20
22
  t.true(comparePoints(obs, exp))
21
23
 
22
24
  // scale Y
23
25
  scaled = scale([1, 0.5], geometry)
24
26
  obs = path2.toPoints(scaled)
25
27
  exp = [[0, 2], [1, 0]]
28
+ t.notThrows(() => path2.validate(scaled))
26
29
  t.true(comparePoints(obs, exp))
27
30
 
28
31
  scaled = scaleY(0.5, geometry)
29
32
  obs = path2.toPoints(scaled)
33
+ t.notThrows(() => path2.validate(scaled))
30
34
  t.true(comparePoints(obs, exp))
31
35
  })
32
36
 
@@ -37,20 +41,24 @@ test('scale: scaling of a geom2 produces expected changes to points', (t) => {
37
41
  let scaled = scale([3], geometry)
38
42
  let obs = geom2.toPoints(scaled)
39
43
  let exp = [[-3, 0], [3, 0], [0, 1]]
44
+ t.notThrows(() => geom2.validate(scaled))
40
45
  t.true(comparePoints(obs, exp))
41
46
 
42
47
  scaled = scaleX(3, geometry)
43
48
  obs = geom2.toPoints(scaled)
49
+ t.notThrows(() => geom2.validate(scaled))
44
50
  t.true(comparePoints(obs, exp))
45
51
 
46
52
  // scale Y
47
53
  scaled = scale([1, 3], geometry)
48
54
  obs = geom2.toPoints(scaled)
49
55
  exp = [[-1, 0], [1, 0], [0, 3]]
56
+ t.notThrows(() => geom2.validate(scaled))
50
57
  t.true(comparePoints(obs, exp))
51
58
 
52
59
  scaled = scaleY(3, geometry)
53
60
  obs = geom2.toPoints(scaled)
61
+ t.notThrows(() => geom2.validate(scaled))
54
62
  t.true(comparePoints(obs, exp))
55
63
  })
56
64
 
@@ -76,10 +84,12 @@ test('scale: scaling of a geom3 produces expected changes to polygons', (t) => {
76
84
  [[-6, -7, -12], [-6, 13, -12], [24, 13, -12], [24, -7, -12]],
77
85
  [[-6, -7, 18], [24, -7, 18], [24, 13, 18], [-6, 13, 18]]
78
86
  ]
87
+ t.notThrows(() => geom3.validate(scaled))
79
88
  t.true(comparePolygonsAsPoints(obs, exp))
80
89
 
81
90
  scaled = scaleX(3, geometry)
82
91
  obs = geom3.toPoints(scaled)
92
+ t.notThrows(() => geom3.validate(scaled))
83
93
  t.true(comparePolygonsAsPoints(obs, exp))
84
94
 
85
95
  // scale Y
@@ -97,6 +107,7 @@ test('scale: scaling of a geom3 produces expected changes to polygons', (t) => {
97
107
 
98
108
  scaled = scaleY(0.5, geometry)
99
109
  obs = geom3.toPoints(scaled)
110
+ t.notThrows(() => geom3.validate(scaled))
100
111
  t.true(comparePolygonsAsPoints(obs, exp))
101
112
 
102
113
  // scale Z
@@ -110,10 +121,12 @@ test('scale: scaling of a geom3 produces expected changes to polygons', (t) => {
110
121
  [[-2, -7, -60], [-2, 13, -60], [8, 13, -60], [8, -7, -60]],
111
122
  [[-2, -7, 90], [8, -7, 90], [8, 13, 90], [-2, 13, 90]]
112
123
  ]
124
+ t.notThrows(() => geom3.validate(scaled))
113
125
  t.true(comparePolygonsAsPoints(obs, exp))
114
126
 
115
127
  scaled = scaleZ(5, geometry)
116
128
  obs = geom3.toPoints(scaled)
129
+ t.notThrows(() => geom3.validate(scaled))
117
130
  t.true(comparePolygonsAsPoints(obs, exp))
118
131
  })
119
132
 
@@ -128,9 +141,11 @@ test('scale: scaling of multiple objects produces expected changes', (t) => {
128
141
 
129
142
  const obs1 = path2.toPoints(scaled[1])
130
143
  const exp1 = [[-15, 5], [15, 5], [-15, -5], [30, -5]]
144
+ t.notThrows(() => path2.validate(scaled[1]))
131
145
  t.true(comparePoints(obs1, exp1))
132
146
 
133
147
  const obs2 = geom2.toPoints(scaled[2])
134
148
  const exp2 = [[-15, -5], [0, 5], [30, -5]]
149
+ t.notThrows(() => geom2.validate(scaled[2]))
135
150
  t.true(comparePoints(obs2, exp2))
136
151
  })
@@ -5,10 +5,10 @@ const geom3 = require('../../geometries/geom3')
5
5
  const path2 = require('../../geometries/path2')
6
6
 
7
7
  /**
8
- * Transform the given geometries using the given matrix.
8
+ * Transform the given objects using the given matrix.
9
9
  * @param {mat4} matrix - a transformation matrix
10
- * @param {...Object} geometries - the geometries to transform
11
- * @return {Object|Array} the transformed geometry, or a list of transformed geometries
10
+ * @param {...Object} objects - the objects to transform
11
+ * @return {Object|Array} the transformed object, or a list of transformed objects
12
12
  * @alias module:modeling/transforms.transform
13
13
  *
14
14
  * @example
@@ -15,6 +15,7 @@ test('transform: transforming of a path2 produces expected changes to points', (
15
15
  geometry = transform(matrix, geometry)
16
16
  const obs = path2.toPoints(geometry)
17
17
  const exp = [[2, 2], [3, 2]]
18
+ t.notThrows(() => path2.validate(geometry))
18
19
  t.true(comparePoints(obs, exp))
19
20
  })
20
21
 
@@ -25,6 +26,7 @@ test('transform: transforming of a geom2 produces expected changes to sides', (t
25
26
  geometry = transform(matrix, geometry)
26
27
  const obs = geom2.toPoints(geometry)
27
28
  const exp = [[0, 0], [5, 0], [0, 5]]
29
+ t.notThrows(() => geom2.validate(geometry))
28
30
  t.true(comparePoints(obs, exp))
29
31
  })
30
32
 
@@ -49,6 +51,7 @@ test('transform: transforming of a geom3 produces expected changes to polygons',
49
51
  [[-5, -10, -15], [-5, 10, -15], [5, 10, -15], [5, -10, -15]],
50
52
  [[-5, -10, 15], [5, -10, 15], [5, 10, 15], [-5, 10, 15]]
51
53
  ]
54
+ t.notThrows(() => geom3.validate(geometry))
52
55
  t.true(comparePolygonsAsPoints(obs, exp))
53
56
  })
54
57
 
@@ -63,9 +66,11 @@ test('transform: transforming of multiple objects produces expected changes', (t
63
66
 
64
67
  let obs = path2.toPoints(transformed[1])
65
68
  let exp = [[-3, 7], [7, 7], [-3, -3], [12, -3]]
69
+ t.notThrows(() => path2.validate(transformed[1]))
66
70
  t.true(comparePoints(obs, exp))
67
71
 
68
72
  obs = geom2.toPoints(transformed[2])
69
73
  exp = [[-3, -3], [2, 7], [12, -3]]
74
+ t.notThrows(() => geom2.validate(transformed[2]))
70
75
  t.true(comparePoints(obs, exp))
71
76
  })