@@ -47,6 +47,8 @@ See the tutorial "<a href="tutorial-glmath.md">H3DU's Math Functions</a>" for mo
4747* [ .quatNormInPlace] ( #H3DU.Math.quatNormInPlace )
4848* [ .quatScale] ( #H3DU.Math.quatScale )
4949* [ .quatScaleInPlace] ( #H3DU.Math.quatScaleInPlace )
50+ * [ boxCenter] ( #H3DU.Math.boxCenter )
51+ * [ boxDimensions] ( #H3DU.Math.boxDimensions )
5052* [ boxIsEmpty] ( #H3DU.Math.boxIsEmpty )
5153* [ frustumHasBox] ( #H3DU.Math.frustumHasBox )
5254* [ frustumHasPoint] ( #H3DU.Math.frustumHasPoint )
@@ -99,6 +101,8 @@ See the tutorial "<a href="tutorial-glmath.md">H3DU's Math Functions</a>" for mo
99101* [ quatToMat4] ( #H3DU.Math.quatToMat4 )
100102* [ quatToTaitBryan] ( #H3DU.Math.quatToTaitBryan )
101103* [ quatTransform] ( #H3DU.Math.quatTransform )
104+ * [ vec3abs] ( #H3DU.Math.vec3abs )
105+ * [ vec3absInPlace] ( #H3DU.Math.vec3absInPlace )
102106* [ vec3add] ( #H3DU.Math.vec3add )
103107* [ vec3addInPlace] ( #H3DU.Math.vec3addInPlace )
104108* [ vec3assign] ( #H3DU.Math.vec3assign )
@@ -121,12 +125,15 @@ See the tutorial "<a href="tutorial-glmath.md">H3DU's Math Functions</a>" for mo
121125* [ vec3subInPlace] ( #H3DU.Math.vec3subInPlace )
122126* [ vec3toWindowPoint] ( #H3DU.Math.vec3toWindowPoint )
123127* [ vec3triple] ( #H3DU.Math.vec3triple )
128+ * [ vec4abs] ( #H3DU.Math.vec4abs )
129+ * [ vec4absInPlace] ( #H3DU.Math.vec4absInPlace )
124130* [ vec4assign] ( #H3DU.Math.vec4assign )
125131* [ vec4copy] ( #H3DU.Math.vec4copy )
126132* [ vec4dot] ( #H3DU.Math.vec4dot )
127133* [ vec4length] ( #H3DU.Math.vec4length )
128134* [ vec4lerp] ( #H3DU.Math.vec4lerp )
129135* [ vec4negate] ( #H3DU.Math.vec4negate )
136+ * [ vec4negateInPlace] ( #H3DU.Math.vec4negateInPlace )
130137* [ vec4norm] ( #H3DU.Math.vec4norm )
131138* [ vec4normInPlace] ( #H3DU.Math.vec4normInPlace )
132139* [ vec4scale] ( #H3DU.Math.vec4scale )
@@ -415,9 +422,42 @@ The parameter "a". (Type: Array.<Number>)
415422
416423<a href =" H3DU.Math.md#H3DU.Math.vec4scaleInPlace " >H3DU.Math.vec4scaleInPlace</a >
417424
425+ ### (static) H3DU.Math.boxCenter(box) <a id =' H3DU.Math.boxCenter ' ></a >
426+
427+ Finds the center of a 3D bounding box.
428+
429+ #### Parameters
430+
431+ * ` box ` (Type: Array.< ; Number>)<br >
432+ An axis-aligned bounding box, which is an array of six values. The first three values are the smallest X, Y, and Z coordinates, and the last three values are the largest X, Y, and Z coordinates.
433+
434+ #### Return Value
435+
436+ A 3-element array containing the
437+ X, Y, and Z coordinates, respectively, of the bounding box's
438+ center. (Type: Array.< ; Number>)
439+
440+ ### (static) H3DU.Math.boxDimensions(box) <a id =' H3DU.Math.boxDimensions ' ></a >
441+
442+ Finds the dimensions of a 3D bounding box. This is done by subtracting
443+ the first three values of the given array with its last three values.
444+
445+ #### Parameters
446+
447+ * ` box ` (Type: Array.< ; Number>)<br >
448+ An axis-aligned bounding box, which is an array of six values. The first three values are the smallest X, Y, and Z coordinates, and the last three values are the largest X, Y, and Z coordinates.
449+
450+ #### Return Value
451+
452+ A 3-element array containing the
453+ width, height, and depth of the bounding box, respectively. If
454+ at least one of the minimum coordinates is greater than its
455+ corresponding maximum coordinate, the array can contain
456+ negative values. (Type: Array.< ; Number>)
457+
418458### (static) H3DU.Math.boxIsEmpty(box) <a id =' H3DU.Math.boxIsEmpty ' ></a >
419459
420- Determines whether a bounding box is empty.
460+ Determines whether a 3D bounding box is empty.
421461This is determined if the minimum coordinate
422462is larger than the corresponding maximum coordinate.
423463
@@ -1492,6 +1532,34 @@ the transformed vector. The fourth element will be 1.0.
14921532If the input vector has 3 elements, a 3-element vector will
14931533be returned instead. (Type: Array.< ; Number>)
14941534
1535+ ### (static) H3DU.Math.vec3abs(a) <a id =' H3DU.Math.vec3abs ' ></a >
1536+
1537+ Returns a new 3-element
1538+ vector with the absolute value of each of its components.
1539+
1540+ #### Parameters
1541+
1542+ * ` a ` (Type: Array.< ; Number>)<br >
1543+ A 3-element vector.
1544+
1545+ #### Return Value
1546+
1547+ The resulting 3-element vector. (Type: Array.< ; Number>)
1548+
1549+ ### (static) H3DU.Math.vec3absInPlace(a) <a id =' H3DU.Math.vec3absInPlace ' ></a >
1550+
1551+ Sets each component of the given 3-element
1552+ vector to its absolute value.
1553+
1554+ #### Parameters
1555+
1556+ * ` a ` (Type: Array.< ; Number>)<br >
1557+ A 3-element vector.
1558+
1559+ #### Return Value
1560+
1561+ The vector "a". (Type: Array.< ; Number>)
1562+
14951563### (static) H3DU.Math.vec3add(a, b) <a id =' H3DU.Math.vec3add ' ></a >
14961564
14971565Adds two 3-element vectors and returns a new
@@ -1564,11 +1632,7 @@ The following are properties of the cross product:<ul>
15641632vector with the same length but opposite direction.
15651633<li >If the cross product's length is 0, then A and B are parallel vectors.
15661634<li >Let there be a triangle formed by point A, point B, and the point (0,0,0) in that order.
1567- <<<<<<< HEAD
15681635The cross product vector will be such that, while the vector points toward the viewer,
1569- =======
1570- The cross product vector will be such that, whenever the vector points toward the viewer,
1571- >>>>>>> 46648dcbdc510ab994e4eb259cdce8eae656c30c
15721636the triangle's vertices are oriented counterclockwise for right-handed coordinate systems,
15731637or clockwise for left-handed systems. The triangle's area is half of the cross product's length.
15741638<li >If A and B are unit vectors (<a href =" H3DU.Math.md#H3DU.Math.vec3norm " >"normalized" vectors</a > with a length of 1), the absolute value
@@ -1987,6 +2051,34 @@ two vectors that lie on a plane with the given normal.
19872051 // and in a clockwise direction for left-handed systems.
19882052 angle*=(triple<0 ? -1.0 : 1.0);
19892053
2054+ ### (static) H3DU.Math.vec4abs(a) <a id =' H3DU.Math.vec4abs ' ></a >
2055+
2056+ Returns a new 4-element
2057+ vector with the absolute value of each of its components.
2058+
2059+ #### Parameters
2060+
2061+ * ` a ` (Type: Array.< ; Number>)<br >
2062+ A 4-element vector.
2063+
2064+ #### Return Value
2065+
2066+ The resulting 4-element vector. (Type: Array.< ; Number>)
2067+
2068+ ### (static) H3DU.Math.vec4absInPlace(a) <a id =' H3DU.Math.vec4absInPlace ' ></a >
2069+
2070+ Sets each component of the given 4-element
2071+ vector to its absolute value.
2072+
2073+ #### Parameters
2074+
2075+ * ` a ` (Type: Array.< ; Number>)<br >
2076+ A 4-element vector.
2077+
2078+ #### Return Value
2079+
2080+ The vector "a". (Type: Array.< ; Number>)
2081+
19902082### (static) H3DU.Math.vec4assign(dst, src) <a id =' H3DU.Math.vec4assign ' ></a >
19912083
19922084Assigns the values of a 4-element vector into another
@@ -2091,6 +2183,21 @@ is the same as reversing the sign of each of its components.
20912183
20922184The resulting 4-element vector. (Type: Array.< ; Number>)
20932185
2186+ ### (static) H3DU.Math.vec4negateInPlace(a) <a id =' H3DU.Math.vec4negateInPlace ' ></a >
2187+
2188+ Negates a 4-element vector in place.
2189+ Negating a vector
2190+ is the same as reversing the sign of each of its components.
2191+
2192+ #### Parameters
2193+
2194+ * ` a ` (Type: Array.< ; Number>)<br >
2195+ A 4-element vector.
2196+
2197+ #### Return Value
2198+
2199+ The parameter "a". (Type: Array.< ; Number>)
2200+
20942201### (static) H3DU.Math.vec4norm(vec) <a id =' H3DU.Math.vec4norm ' ></a >
20952202
20962203Returns a normalized version of a 4-element vector.
0 commit comments