@jscad/modeling 2.7.2 → 2.8.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 (159) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/jscad-modeling.min.js +136 -133
  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.js +10 -0
  7. package/src/geometries/geom2/isA.js +2 -2
  8. package/src/geometries/geom2/toCompactBinary.js +4 -4
  9. package/src/geometries/geom2/toString.js +1 -1
  10. package/src/geometries/geom2/transform.test.js +1 -1
  11. package/src/geometries/geom3/fromCompactBinary.js +1 -1
  12. package/src/geometries/geom3/index.js +17 -0
  13. package/src/geometries/geom3/isA.js +2 -2
  14. package/src/geometries/geom3/toCompactBinary.js +4 -4
  15. package/src/geometries/geom3/toString.js +1 -1
  16. package/src/geometries/geom3/transform.test.js +1 -1
  17. package/src/geometries/index.js +8 -1
  18. package/src/geometries/path2/eachPoint.js +3 -3
  19. package/src/geometries/path2/index.js +11 -0
  20. package/src/geometries/path2/isA.js +2 -2
  21. package/src/geometries/path2/reverse.js +4 -4
  22. package/src/geometries/path2/toCompactBinary.js +6 -6
  23. package/src/geometries/path2/toString.js +1 -1
  24. package/src/geometries/path2/transform.test.js +1 -1
  25. package/src/geometries/poly2/arePointsInside.test.js +1 -1
  26. package/src/geometries/poly2/index.js +6 -0
  27. package/src/geometries/poly3/index.js +7 -1
  28. package/src/geometries/poly3/isA.js +2 -2
  29. package/src/geometries/poly3/isConvex.js +2 -2
  30. package/src/geometries/poly3/measureArea.js +4 -4
  31. package/src/geometries/poly3/measureBoundingBox.js +2 -2
  32. package/src/geometries/poly3/measureBoundingSphere.js +2 -2
  33. package/src/geometries/poly3/measureSignedVolume.js +4 -4
  34. package/src/geometries/poly3/toPoints.js +2 -2
  35. package/src/geometries/poly3/toString.js +2 -2
  36. package/src/geometries/poly3/transform.js +2 -2
  37. package/src/maths/index.js +1 -1
  38. package/src/maths/line2/equals.js +2 -2
  39. package/src/maths/line2/fromValues.js +2 -2
  40. package/src/maths/line2/intersectPointOfLines.js +1 -1
  41. package/src/maths/line2/intersectPointOfLines.test.js +1 -1
  42. package/src/maths/line2/reverse.test.js +1 -1
  43. package/src/maths/line2/transform.test.js +1 -1
  44. package/src/maths/line3/equals.js +2 -2
  45. package/src/maths/line3/reverse.test.js +1 -1
  46. package/src/maths/line3/transform.test.js +1 -1
  47. package/src/maths/mat4/fromVectorRotation.js +1 -1
  48. package/src/maths/mat4/fromVectorRotation.test.js +1 -1
  49. package/src/maths/mat4/identity.test.js +1 -1
  50. package/src/maths/mat4/invert.js +18 -18
  51. package/src/maths/mat4/isIdentity.js +1 -1
  52. package/src/maths/mat4/isMirroring.js +4 -4
  53. package/src/maths/mat4/isMirroring.test.js +1 -1
  54. package/src/maths/mat4/leftMultiplyVec3.js +2 -2
  55. package/src/maths/mat4/toString.js +2 -2
  56. package/src/maths/mat4/translate.test.js +1 -1
  57. package/src/maths/plane/flip.test.js +1 -1
  58. package/src/maths/plane/fromPoints.d.ts +1 -1
  59. package/src/maths/plane/fromPoints.js +1 -3
  60. package/src/maths/plane/signedDistanceToPoint.js +1 -1
  61. package/src/maths/plane/transform.test.js +1 -1
  62. package/src/maths/utils/aboutEqualNormals.js +2 -2
  63. package/src/maths/vec2/abs.d.ts +1 -1
  64. package/src/maths/vec2/add.test.js +1 -1
  65. package/src/maths/vec2/angleDegrees.d.ts +1 -1
  66. package/src/maths/vec2/angleRadians.d.ts +1 -1
  67. package/src/maths/vec2/create.js +1 -1
  68. package/src/maths/vec2/cross.test.js +1 -1
  69. package/src/maths/vec2/divide.test.js +1 -1
  70. package/src/maths/vec2/fromAngleDegrees.js +1 -1
  71. package/src/maths/vec2/fromScalar.js +1 -1
  72. package/src/maths/vec2/length.d.ts +1 -1
  73. package/src/maths/vec2/length.js +1 -1
  74. package/src/maths/vec2/lerp.test.js +1 -1
  75. package/src/maths/vec2/multiply.test.js +1 -1
  76. package/src/maths/vec2/negate.test.js +1 -1
  77. package/src/maths/vec2/normal.js +1 -1
  78. package/src/maths/vec2/normalize.d.ts +1 -1
  79. package/src/maths/vec2/normalize.test.js +1 -1
  80. package/src/maths/vec2/rotate.test.js +1 -1
  81. package/src/maths/vec2/squaredLength.d.ts +1 -1
  82. package/src/maths/vec2/squaredLength.js +3 -3
  83. package/src/maths/vec2/subtract.test.js +1 -1
  84. package/src/maths/vec2/toString.js +1 -1
  85. package/src/maths/vec2/transform.test.js +1 -1
  86. package/src/maths/vec3/abs.d.ts +1 -1
  87. package/src/maths/vec3/add.test.js +1 -1
  88. package/src/maths/vec3/cross.test.js +1 -1
  89. package/src/maths/vec3/divide.test.js +1 -1
  90. package/src/maths/vec3/fromScalar.js +1 -1
  91. package/src/maths/vec3/fromVec2.d.ts +1 -1
  92. package/src/maths/vec3/fromVec2.js +3 -3
  93. package/src/maths/vec3/length.d.ts +1 -1
  94. package/src/maths/vec3/length.js +4 -4
  95. package/src/maths/vec3/lerp.test.js +1 -1
  96. package/src/maths/vec3/multiply.test.js +1 -1
  97. package/src/maths/vec3/negate.d.ts +1 -1
  98. package/src/maths/vec3/negate.test.js +1 -1
  99. package/src/maths/vec3/normalize.d.ts +1 -1
  100. package/src/maths/vec3/normalize.test.js +1 -1
  101. package/src/maths/vec3/rotateX.test.js +1 -1
  102. package/src/maths/vec3/rotateY.test.js +1 -1
  103. package/src/maths/vec3/rotateZ.test.js +1 -1
  104. package/src/maths/vec3/scale.test.js +1 -1
  105. package/src/maths/vec3/squaredLength.d.ts +1 -1
  106. package/src/maths/vec3/squaredLength.js +4 -4
  107. package/src/maths/vec3/subtract.test.js +1 -1
  108. package/src/maths/vec3/toString.js +1 -1
  109. package/src/maths/vec3/transform.test.js +1 -1
  110. package/src/maths/vec4/toString.js +1 -1
  111. package/src/maths/vec4/transform.test.js +1 -1
  112. package/src/measurements/measureBoundingSphere.js +4 -4
  113. package/src/measurements/measureCenterOfMass.js +1 -1
  114. package/src/operations/booleans/mayOverlap.js +3 -3
  115. package/src/operations/booleans/retessellate.js +2 -2
  116. package/src/operations/booleans/scission.js +1 -1
  117. package/src/operations/booleans/subtract.js +1 -1
  118. package/src/operations/booleans/union.test.js +1 -1
  119. package/src/operations/booleans/unionGeom3Sub.js +1 -1
  120. package/src/operations/expansions/expand.js +2 -2
  121. package/src/operations/expansions/expand.test.js +3 -35
  122. package/src/operations/expansions/expandShell.js +24 -18
  123. package/src/operations/expansions/offset.js +1 -1
  124. package/src/operations/expansions/offset.test.js +25 -89
  125. package/src/operations/expansions/offsetFromPoints.js +11 -6
  126. package/src/operations/extrusions/extrudeLinear.js +6 -2
  127. package/src/operations/extrusions/extrudeLinear.test.js +25 -1
  128. package/src/operations/extrusions/extrudeLinearPath2.js +24 -0
  129. package/src/operations/extrusions/extrudeRectangular.js +1 -1
  130. package/src/operations/extrusions/extrudeRectangular.test.js +2 -2
  131. package/src/operations/extrusions/project.js +1 -1
  132. package/src/operations/extrusions/slice/isA.js +2 -2
  133. package/src/operations/extrusions/slice/toPolygons.js +1 -1
  134. package/src/operations/hulls/hull.test.js +1 -1
  135. package/src/operations/hulls/hullChain.js +1 -1
  136. package/src/operations/hulls/hullGeom2.js +1 -1
  137. package/src/operations/hulls/hullPath2.js +6 -4
  138. package/src/operations/hulls/hullPath2.test.js +16 -0
  139. package/src/operations/hulls/hullPoints2.test.js +1 -1
  140. package/src/operations/modifiers/edges.js +1 -1
  141. package/src/operations/modifiers/generalize.js +1 -1
  142. package/src/operations/modifiers/snap.test.js +3 -3
  143. package/src/operations/transforms/align.d.ts +1 -1
  144. package/src/operations/transforms/center.js +17 -17
  145. package/src/operations/transforms/mirror.js +12 -12
  146. package/src/operations/transforms/rotate.js +12 -12
  147. package/src/operations/transforms/scale.js +19 -19
  148. package/src/operations/transforms/transform.js +3 -3
  149. package/src/operations/transforms/translate.js +14 -14
  150. package/src/primitives/arc.js +1 -1
  151. package/src/primitives/cylinderElliptic.test.js +0 -2
  152. package/src/primitives/ellipsoid.js +1 -1
  153. package/src/primitives/ellipsoid.test.js +0 -2
  154. package/src/primitives/geodesicSphere.d.ts +0 -1
  155. package/src/primitives/polyhedron.js +1 -1
  156. package/src/primitives/torus.d.ts +0 -1
  157. package/src/primitives/triangle.js +1 -1
  158. package/src/text/vectorText.js +2 -2
  159. package/src/utils/padArrayToLength.js +1 -1
@@ -4,27 +4,27 @@
4
4
  * code from https://github.com/jlmakes/rematrix/blob/master/src/index.js
5
5
  *
6
6
  * @param {mat4} out - receiving matrix
7
- * @param {mat4} m - matrix to invert
7
+ * @param {mat4} matrix - matrix to invert
8
8
  * @returns {mat4} out
9
9
  * @alias module:modeling/maths/mat4.invert
10
10
  */
11
- const invert = (out, a) => {
12
- const a00 = a[0]
13
- const a01 = a[1]
14
- const a02 = a[2]
15
- const a03 = a[3]
16
- const a10 = a[4]
17
- const a11 = a[5]
18
- const a12 = a[6]
19
- const a13 = a[7]
20
- const a20 = a[8]
21
- const a21 = a[9]
22
- const a22 = a[10]
23
- const a23 = a[11]
24
- const a30 = a[12]
25
- const a31 = a[13]
26
- const a32 = a[14]
27
- const a33 = a[15]
11
+ const invert = (out, matrix) => {
12
+ const a00 = matrix[0]
13
+ const a01 = matrix[1]
14
+ const a02 = matrix[2]
15
+ const a03 = matrix[3]
16
+ const a10 = matrix[4]
17
+ const a11 = matrix[5]
18
+ const a12 = matrix[6]
19
+ const a13 = matrix[7]
20
+ const a20 = matrix[8]
21
+ const a21 = matrix[9]
22
+ const a22 = matrix[10]
23
+ const a23 = matrix[11]
24
+ const a30 = matrix[12]
25
+ const a31 = matrix[13]
26
+ const a32 = matrix[14]
27
+ const a33 = matrix[15]
28
28
 
29
29
  const b00 = a00 * a11 - a01 * a10
30
30
  const b01 = a00 * a12 - a02 * a10
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Determine whether the given matris is the identity transform.
2
+ * Determine whether the given matrix is the identity transform.
3
3
  * This is equivalent to (but much faster than):
4
4
  *
5
5
  * mat4.equals(mat4.create(), matrix)
@@ -9,10 +9,10 @@ const fromValues = require('../vec3/fromValues')
9
9
  * @returns {Boolean} true if matrix is a mirroring transformation
10
10
  * @alias module:modeling/maths/mat4.isMirroring
11
11
  */
12
- const isMirroring = (mat) => {
13
- const u = fromValues(mat[0], mat[4], mat[8])
14
- const v = fromValues(mat[1], mat[5], mat[9])
15
- const w = fromValues(mat[2], mat[6], mat[10])
12
+ const isMirroring = (matrix) => {
13
+ const u = fromValues(matrix[0], matrix[4], matrix[8])
14
+ const v = fromValues(matrix[1], matrix[5], matrix[9])
15
+ const w = fromValues(matrix[2], matrix[6], matrix[10])
16
16
 
17
17
  // for a true orthogonal, non-mirrored base, u.cross(v) == w
18
18
  // If they have an opposite direction then we are mirroring
@@ -4,7 +4,7 @@ const plane = require('../plane')
4
4
 
5
5
  const { isMirroring, fromScaling, create, mirrorByPlane, rotate, scale, translate } = require('./index')
6
6
 
7
- test('mat4: isMirroring() should determine correctlly', (t) => {
7
+ test('mat4: isMirroring() should determine correctly', (t) => {
8
8
  let matrix = create()
9
9
  t.false(isMirroring(matrix))
10
10
 
@@ -8,7 +8,7 @@ const fromValues = require('../vec3/fromValues')
8
8
  * @param {mat4} matrix the input matrix
9
9
  * @returns {vec3} output
10
10
  */
11
- const lefttMultiplyVec3 = (vector, matrix) => {
11
+ const leftMultiplyVec3 = (vector, matrix) => {
12
12
  const [v0, v1, v2] = vector
13
13
  const v3 = 1
14
14
  let x = v0 * matrix[0] + v1 * matrix[4] + v2 * matrix[8] + v3 * matrix[12]
@@ -26,4 +26,4 @@ const lefttMultiplyVec3 = (vector, matrix) => {
26
26
  return fromValues(x, y, z)
27
27
  }
28
28
 
29
- module.exports = lefttMultiplyVec3
29
+ module.exports = leftMultiplyVec3
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Return a string representing the given matrix.
3
3
  *
4
- * @param {mat4} matrix - matrix of reference
4
+ * @param {mat4} mat - matrix of reference
5
5
  * @returns {String} string representation
6
6
  * @alias module:modeling/maths/mat4.toString
7
7
  */
8
- const toString = (mat) => `[${mat[0].toFixed(7)}, ${mat[1].toFixed(7)}, ${mat[2].toFixed(7)}, ${mat[3].toFixed(7)}, ${mat[4].toFixed(7)}, ${mat[5].toFixed(7)}, ${mat[6].toFixed(7)}, ${mat[7].toFixed(7)}, ${mat[8].toFixed(7)}, ${mat[9].toFixed(7)}, ${mat[10].toFixed(7)}, ${mat[11].toFixed(7)}, ${mat[12].toFixed(7)}, ${mat[13].toFixed(7)}, ${mat[14].toFixed(7)}, ${mat[15].toFixed(7)}]`
8
+ const toString = (mat) => mat.map((n) => n.toFixed(7)).toString()
9
9
 
10
10
  module.exports = toString
@@ -3,7 +3,7 @@ const { translate, create } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('mat4: translate() called with three paramerters should update a mat4 with correct values', (t) => {
6
+ test('mat4: translate() called with three parameters should update a mat4 with correct values', (t) => {
7
7
  const identityMatrix = [
8
8
  1, 0, 0, 0,
9
9
  0, 1, 0, 0,
@@ -3,7 +3,7 @@ const { create, flip } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('plane: flip() called with two paramerters should update a plane with correct values', (t) => {
6
+ test('plane: flip() called with two parameters should update a plane with correct values', (t) => {
7
7
  const org1 = create()
8
8
  const ret1 = flip(org1, [0, 0, 0, 0])
9
9
  t.true(compareVectors(org1, [-0, -0, -0, -0]))
@@ -3,4 +3,4 @@ import Vec3 from '../vec3/type'
3
3
 
4
4
  export default fromPoints
5
5
 
6
- declare function fromPoints(out: Plane, a: Vec3, b: Vec3, c: Vec3): Plane
6
+ declare function fromPoints(out: Plane, ...vertices: Array<Vec3>): Plane
@@ -4,9 +4,7 @@ const vec3 = require('../vec3')
4
4
  * Create a plane from the given points.
5
5
  *
6
6
  * @param {plane} out - receiving plane
7
- * @param {vec3} a - 3D point
8
- * @param {vec3} b - 3D point
9
- * @param {vec3} c - 3D point
7
+ * @param {Array} vertices - points on the plane
10
8
  * @returns {plane} out
11
9
  * @alias module:modeling/maths/plane.fromPoints
12
10
  */
@@ -8,6 +8,6 @@ const vec3 = require('../vec3')
8
8
  * @return {Number} signed distance to point
9
9
  * @alias module:modeling/maths/plane.signedDistanceToPoint
10
10
  */
11
- const signedDistanceToPoint = (plane, vector) => vec3.dot(plane, vector) - plane[3]
11
+ const signedDistanceToPoint = (plane, point) => vec3.dot(plane, point) - plane[3]
12
12
 
13
13
  module.exports = signedDistanceToPoint
@@ -3,7 +3,7 @@ const { transform, create, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('plane: transform() called with three paramerters should return a plane with correct values', (t) => {
6
+ test('plane: transform() called with three parameters should return a plane with correct values', (t) => {
7
7
  const identityMatrix = [
8
8
  1, 0, 0, 0,
9
9
  0, 1, 0, 0,
@@ -1,5 +1,5 @@
1
- // Normals are directional vectors with component values from 0 to 1.0, requiring specialized comparision
2
- // This EPS is derived from a serieas of tests to determine the optimal precision for comparing coplanar polygons,
1
+ // Normals are directional vectors with component values from 0 to 1.0, requiring specialized comparison
2
+ // This EPS is derived from a series of tests to determine the optimal precision for comparing coplanar polygons,
3
3
  // as provided by the sphere primitive at high segmentation
4
4
  // This EPS is for 64 bit Number values
5
5
  const NEPS = 1e-13
@@ -2,4 +2,4 @@ import Vec2 from './type'
2
2
 
3
3
  export default abs
4
4
 
5
- declare function abs(out: Vec2, vec: Vec2): Vec2
5
+ declare function abs(out: Vec2, vector: Vec2): Vec2
@@ -3,7 +3,7 @@ const { add, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec2: add() called with three paramerters should update a vec2 with correct values', (t) => {
6
+ test('vec2: add() called with three parameters should update a vec2 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0)
8
8
  const ret1 = add(obs1, [0, 0], [0, 0])
9
9
  t.true(compareVectors(obs1, [0, 0]))
@@ -2,4 +2,4 @@ import Vec2 from './type'
2
2
 
3
3
  export default angleDegrees
4
4
 
5
- declare function angleDegrees(vec: Vec2): number
5
+ declare function angleDegrees(vector: Vec2): number
@@ -2,4 +2,4 @@ import Vec2 from './type'
2
2
 
3
3
  export default angleRadians
4
4
 
5
- declare function angleRadians(vec: Vec2): number
5
+ declare function angleRadians(vector: Vec2): number
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  /**
8
- * Creates a new vector, intialized to [0,0].
8
+ * Creates a new vector, initialized to [0,0].
9
9
  *
10
10
  * @returns {vec2} a new vector
11
11
  * @alias module:modeling/maths/vec2.create
@@ -3,7 +3,7 @@ const { cross } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec2: cross() called with three paramerters should update a vec2 with correct values', (t) => {
6
+ test('vec2: cross() called with three parameters should update a vec2 with correct values', (t) => {
7
7
  const obs1 = [0, 0, 0]
8
8
  const ret1 = cross(obs1, [0, 0], [0, 0])
9
9
  t.true(compareVectors(obs1, [0, 0, 0]))
@@ -3,7 +3,7 @@ const { divide, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec2: divide() called with three paramerters should update a vec2 with correct values', (t) => {
6
+ test('vec2: divide() called with three parameters should update a vec2 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0)
8
8
  const ret1 = divide(obs1, [0, 0], [0, 0])
9
9
  t.true(compareVectors(obs1, [0 / 0, 0 / 0]))
@@ -4,7 +4,7 @@ const fromAngleRadians = require('./fromAngleRadians')
4
4
  * Create a new vector in the direction of the given angle.
5
5
  *
6
6
  * @param {vec2} out - receiving vector
7
- * @param {Number} angle - angle in degrees
7
+ * @param {Number} degrees - angle in degrees
8
8
  * @returns {vec2} out
9
9
  * @alias module:modeling/maths/vec2.fromAngleDegrees
10
10
  */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @param {vec2} out - receiving vector
5
5
  * @param {Number} scalar - the scalar value
6
- * @returns {Vec2} out
6
+ * @returns {vec2} out
7
7
  * @alias module:modeling/maths/vec2.fromScalar
8
8
  */
9
9
  const fromScalar = (out, scalar) => {
@@ -2,4 +2,4 @@ import Vec2 from './type'
2
2
 
3
3
  export default length
4
4
 
5
- declare function length(a: Vec2): number
5
+ declare function length(vector: Vec2): number
@@ -5,6 +5,6 @@
5
5
  * @returns {Number} length
6
6
  * @alias module:modeling/maths/vec2.length
7
7
  */
8
- const length = (a) => Math.hypot(a[0], a[1])
8
+ const length = (vector) => Math.hypot(vector[0], vector[1])
9
9
 
10
10
  module.exports = length
@@ -3,7 +3,7 @@ const { lerp, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec2: lerp() called with three paramerters should update a vec2 with correct values', (t) => {
6
+ test('vec2: lerp() called with three parameters should update a vec2 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0)
8
8
  const ret1 = lerp(obs1, [0, 0], [0, 0], 0)
9
9
  t.true(compareVectors(obs1, [0, 0]))
@@ -3,7 +3,7 @@ const { multiply, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec2: multiply() called with three paramerters should update a vec2 with correct values', (t) => {
6
+ test('vec2: multiply() called with three parameters should update a vec2 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0)
8
8
  const ret1 = multiply(obs1, [0, 0], [0, 0])
9
9
  t.true(compareVectors(obs1, [0, 0]))
@@ -3,7 +3,7 @@ const { negate, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec2: negate() called with two paramerters should update a vec2 with correct values', (t) => {
6
+ test('vec2: negate() called with two parameters should update a vec2 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0)
8
8
  const ret1 = negate(obs1, [0, 0])
9
9
  t.true(compareVectors(obs1, [0, 0]))
@@ -3,7 +3,7 @@ const rotate = require('./rotate')
3
3
 
4
4
  /**
5
5
  * Calculates the normal of the given vector.
6
- * The normal value is the given vector rotated 90 degress.
6
+ * The normal value is the given vector rotated 90 degrees.
7
7
  *
8
8
  * @param {vec2} out - receiving vector
9
9
  * @param {vec2} vector - given value
@@ -2,4 +2,4 @@ import Vec2 from './type'
2
2
 
3
3
  export default normalize
4
4
 
5
- declare function normalize(out: Vec2, vec: Vec2): Vec2
5
+ declare function normalize(out: Vec2, vector: Vec2): Vec2
@@ -3,7 +3,7 @@ const { normalize, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec2: normalize() called with two paramerters should update a vec2 with correct values', (t) => {
6
+ test('vec2: normalize() called with two parameters should update a vec2 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0)
8
8
  const ret1 = normalize(obs1, [0, 0])
9
9
  t.true(compareVectors(obs1, [0, 0]))
@@ -3,7 +3,7 @@ const { rotate, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec2: rotate() called with three paramerters should update a vec2 with correct values', (t) => {
6
+ test('vec2: rotate() called with three parameters should update a vec2 with correct values', (t) => {
7
7
  const radians = 90 * Math.PI / 180
8
8
 
9
9
  const obs1 = fromValues(0, 0)
@@ -2,4 +2,4 @@ import Vec2 from './type'
2
2
 
3
3
  export default squaredLength
4
4
 
5
- declare function squaredLength(vec: Vec2): number
5
+ declare function squaredLength(vector: Vec2): number
@@ -5,9 +5,9 @@
5
5
  * @returns {Number} squared length
6
6
  * @alias module:modeling/maths/vec2.squaredLength
7
7
  */
8
- const squaredLength = (a) => {
9
- const x = a[0]
10
- const y = a[1]
8
+ const squaredLength = (vector) => {
9
+ const x = vector[0]
10
+ const y = vector[1]
11
11
  return x * x + y * y
12
12
  }
13
13
 
@@ -3,7 +3,7 @@ const { subtract, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec2: subtract() called with three paramerters should update a vec2 with correct values', (t) => {
6
+ test('vec2: subtract() called with three parameters should update a vec2 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0)
8
8
  const ret1 = subtract(obs1, [0, 0], [0, 0])
9
9
  t.true(compareVectors(obs1, [0, 0]))
@@ -5,6 +5,6 @@
5
5
  * @returns {String} string representation
6
6
  * @alias module:modeling/maths/vec2.toString
7
7
  */
8
- const toString = (vec) => `[${vec[0].toFixed(7)}, ${vec[1].toFixed(7)}]`
8
+ const toString = (vector) => `[${vector[0].toFixed(7)}, ${vector[1].toFixed(7)}]`
9
9
 
10
10
  module.exports = toString
@@ -3,7 +3,7 @@ const { transform, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec2: transform() called with three paramerters should update a vec2 with correct values', (t) => {
6
+ test('vec2: transform() called with three parameters should update a vec2 with correct values', (t) => {
7
7
  const identityMatrix = [
8
8
  1, 0, 0, 0,
9
9
  0, 1, 0, 0,
@@ -2,4 +2,4 @@ import Vec3 from './type'
2
2
 
3
3
  export default abs
4
4
 
5
- declare function abs(out: Vec3, vec: Vec3): Vec3
5
+ declare function abs(out: Vec3, vector: Vec3): Vec3
@@ -3,7 +3,7 @@ const { add, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: add() called with three paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: add() called with three parameters should update a vec3 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0, 0)
8
8
  const ret1 = add(obs1, [0, 0, 0], [0, 0, 0])
9
9
  t.true(compareVectors(obs1, [0, 0, 0]))
@@ -3,7 +3,7 @@ const { cross, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: cross() called with three paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: cross() called with three parameters should update a vec3 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0, 0)
8
8
  const ret1 = cross(obs1, [0, 0, 0], [0, 0, 0])
9
9
  t.true(compareVectors(obs1, [0, 0, 0]))
@@ -3,7 +3,7 @@ const { divide, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: divide() called with three paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: divide() called with three parameters should update a vec3 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0, 0)
8
8
  const ret1 = divide(obs1, [0, 0, 0], [0, 0, 0])
9
9
  t.true(compareVectors(obs1, [0 / 0, 0 / 0, 0 / 0]))
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * @param {vec3} out - receiving vector
6
6
  * @param {Number} scalar
7
- * @returns {Vec3} out
7
+ * @returns {vec3} out
8
8
  * @alias module:modeling/maths/vec3.fromScalar
9
9
  */
10
10
  const fromScalar = (out, scalar) => {
@@ -3,4 +3,4 @@ import Vec2 from '../vec2/type'
3
3
 
4
4
  export default fromVector2
5
5
 
6
- declare function fromVector2(out: Vec3, vec2: Vec2, z?: number): Vec3
6
+ declare function fromVector2(out: Vec3, vector: Vec2, z?: number): Vec3
@@ -7,9 +7,9 @@
7
7
  * @returns {vec3} out
8
8
  * @alias module:modeling/maths/vec3.fromVec2
9
9
  */
10
- const fromVector2 = (out, vec2, z = 0) => {
11
- out[0] = vec2[0]
12
- out[1] = vec2[1]
10
+ const fromVector2 = (out, vector, z = 0) => {
11
+ out[0] = vector[0]
12
+ out[1] = vector[1]
13
13
  out[2] = z
14
14
  return out
15
15
  }
@@ -2,4 +2,4 @@ import Vec3 from './type'
2
2
 
3
3
  export default length
4
4
 
5
- declare function length(a: Vec3): number
5
+ declare function length(vector: Vec3): number
@@ -5,10 +5,10 @@
5
5
  * @returns {Number} length
6
6
  * @alias module:modeling/maths/vec3.length
7
7
  */
8
- const length = (a) => {
9
- const x = a[0]
10
- const y = a[1]
11
- const z = a[2]
8
+ const length = (vector) => {
9
+ const x = vector[0]
10
+ const y = vector[1]
11
+ const z = vector[2]
12
12
  return Math.hypot(x, y, z)
13
13
  }
14
14
 
@@ -3,7 +3,7 @@ const { lerp, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: lerp() called with three paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: lerp() called with three parameters should update a vec3 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0, 0)
8
8
  const ret1 = lerp(obs1, [0, 0, 0], [0, 0, 0], 0)
9
9
  t.true(compareVectors(obs1, [0, 0, 0]))
@@ -3,7 +3,7 @@ const { multiply, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: multiply() called with three paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: multiply() called with three parameters should update a vec3 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0, 0)
8
8
  const ret1 = multiply(obs1, [0, 0, 0], [0, 0, 0])
9
9
  t.true(compareVectors(obs1, [0, 0, 0]))
@@ -2,4 +2,4 @@ import Vec3 from './type'
2
2
 
3
3
  export default negate
4
4
 
5
- declare function negate(out: Vec3, vec: Vec3): Vec3
5
+ declare function negate(out: Vec3, vector: Vec3): Vec3
@@ -3,7 +3,7 @@ const { negate, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: negate() called with two paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: negate() called with two parameters should update a vec3 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0, 0)
8
8
  const ret1 = negate(obs1, [0, 0, 0])
9
9
  t.true(compareVectors(obs1, [-0, -0, -0]))
@@ -2,4 +2,4 @@ import Vec3 from './type'
2
2
 
3
3
  export default normalize
4
4
 
5
- declare function normalize(out: Vec3, vec: Vec3): Vec3
5
+ declare function normalize(out: Vec3, vector: Vec3): Vec3
@@ -3,7 +3,7 @@ const { normalize, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: normalize() called with two paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: normalize() called with two parameters should update a vec3 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0, 0)
8
8
  const ret1 = normalize(obs1, [0, 0, 0])
9
9
  t.true(compareVectors(obs1, [0, 0, 0]))
@@ -3,7 +3,7 @@ const { rotateX, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: rotateX() called with four paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: rotateX() called with four parameters should update a vec3 with correct values', (t) => {
7
7
  const radians = 90 * Math.PI / 180
8
8
 
9
9
  const obs1 = fromValues(0, 0, 0)
@@ -3,7 +3,7 @@ const { rotateY, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: rotateY() called with three paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: rotateY() called with three parameters should update a vec3 with correct values', (t) => {
7
7
  const radians = 90 * Math.PI / 180
8
8
 
9
9
  const obs1 = fromValues(0, 0, 0)
@@ -3,7 +3,7 @@ const { rotateZ, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: rotateZ() called with four paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: rotateZ() called with four parameters should update a vec3 with correct values', (t) => {
7
7
  const radians = 90 * Math.PI / 180
8
8
 
9
9
  const obs1 = fromValues(0, 0, 0)
@@ -3,7 +3,7 @@ const { scale, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: scale() called with three paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: scale() called with three parameters should update a vec3 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0, 0)
8
8
  const ret1 = scale(obs1, [0, 0, 0], 0)
9
9
  t.true(compareVectors(obs1, [0, 0, 0]))
@@ -2,4 +2,4 @@ import Vec3 from './type'
2
2
 
3
3
  export default squaredLength
4
4
 
5
- declare function squaredLength(vec: Vec3): number
5
+ declare function squaredLength(vector: Vec3): number
@@ -5,10 +5,10 @@
5
5
  * @returns {Number} squared length
6
6
  * @alias module:modeling/maths/vec3.squaredLength
7
7
  */
8
- const squaredLength = (a) => {
9
- const x = a[0]
10
- const y = a[1]
11
- const z = a[2]
8
+ const squaredLength = (vector) => {
9
+ const x = vector[0]
10
+ const y = vector[1]
11
+ const z = vector[2]
12
12
  return x * x + y * y + z * z
13
13
  }
14
14
 
@@ -3,7 +3,7 @@ const { subtract, fromValues } = require('./index')
3
3
 
4
4
  const { compareVectors } = require('../../../test/helpers/index')
5
5
 
6
- test('vec3: subtract() called with three paramerters should update a vec3 with correct values', (t) => {
6
+ test('vec3: subtract() called with three parameters should update a vec3 with correct values', (t) => {
7
7
  const obs1 = fromValues(0, 0, 0)
8
8
  const ret1 = subtract(obs1, [0, 0, 0], [0, 0, 0])
9
9
  t.true(compareVectors(obs1, [0, 0, 0]))