2 Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
5 Redistribution and use in source and binary forms,
6 with or without modification, are permitted provided that the
7 following conditions are met:
8 * Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 * Neither the name of the Sony Computer Entertainment Inc nor the names
14 of its contributors may be used to endorse or promote products derived
15 from this software without specific prior written permission.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 POSSIBILITY OF SUCH DAMAGE.
30 #ifndef _VECTORMATH_AOS_C_V_PPU_H
31 #define _VECTORMATH_AOS_C_V_PPU_H
35 #include "vec_types.h"
37 #ifdef _VECTORMATH_DEBUG
43 #endif /* __cplusplus */
45 #ifndef _VECTORMATH_AOS_C_TYPES_H
46 #define _VECTORMATH_AOS_C_TYPES_H
48 /* A 3-D vector in array-of-structures format
50 typedef struct _VmathVector3
55 /* A 4-D vector in array-of-structures format
57 typedef struct _VmathVector4
62 /* A 3-D point in array-of-structures format
64 typedef struct _VmathPoint3
69 /* A quaternion in array-of-structures format
71 typedef struct _VmathQuat
76 /* A 3x3 matrix in array-of-structures format
78 typedef struct _VmathMatrix3
85 /* A 4x4 matrix in array-of-structures format
87 typedef struct _VmathMatrix4
95 /* A 3x4 transformation matrix in array-of-structures format
97 typedef struct _VmathTransform3
108 * Construct a 3-D vector from x, y, and z elements
110 static inline VmathVector3 vmathV3MakeFromElems_V( float x, float y, float z );
113 * Copy elements from a 3-D point into a 3-D vector
115 static inline VmathVector3 vmathV3MakeFromP3_V( VmathPoint3 pnt );
118 * Set all elements of a 3-D vector to the same scalar value
120 static inline VmathVector3 vmathV3MakeFromScalar_V( float scalar );
123 * Set vector float data in a 3-D vector
125 static inline VmathVector3 vmathV3MakeFrom128_V( vec_float4 vf4 );
128 * Get vector float data from a 3-D vector
130 static inline vec_float4 vmathV3Get128_V( VmathVector3 vec );
133 * Set the x element of a 3-D vector
135 static inline void vmathV3SetX_V( VmathVector3 *result, float x );
138 * Set the y element of a 3-D vector
140 static inline void vmathV3SetY_V( VmathVector3 *result, float y );
143 * Set the z element of a 3-D vector
145 static inline void vmathV3SetZ_V( VmathVector3 *result, float z );
148 * Get the x element of a 3-D vector
150 static inline float vmathV3GetX_V( VmathVector3 vec );
153 * Get the y element of a 3-D vector
155 static inline float vmathV3GetY_V( VmathVector3 vec );
158 * Get the z element of a 3-D vector
160 static inline float vmathV3GetZ_V( VmathVector3 vec );
163 * Set an x, y, or z element of a 3-D vector by index
165 static inline void vmathV3SetElem_V( VmathVector3 *result, int idx, float value );
168 * Get an x, y, or z element of a 3-D vector by index
170 static inline float vmathV3GetElem_V( VmathVector3 vec, int idx );
173 * Add two 3-D vectors
175 static inline VmathVector3 vmathV3Add_V( VmathVector3 vec0, VmathVector3 vec1 );
178 * Subtract a 3-D vector from another 3-D vector
180 static inline VmathVector3 vmathV3Sub_V( VmathVector3 vec0, VmathVector3 vec1 );
183 * Add a 3-D vector to a 3-D point
185 static inline VmathPoint3 vmathV3AddP3_V( VmathVector3 vec, VmathPoint3 pnt );
188 * Multiply a 3-D vector by a scalar
190 static inline VmathVector3 vmathV3ScalarMul_V( VmathVector3 vec, float scalar );
193 * Divide a 3-D vector by a scalar
195 static inline VmathVector3 vmathV3ScalarDiv_V( VmathVector3 vec, float scalar );
198 * Negate all elements of a 3-D vector
200 static inline VmathVector3 vmathV3Neg_V( VmathVector3 vec );
205 static inline VmathVector3 vmathV3MakeXAxis_V( );
210 static inline VmathVector3 vmathV3MakeYAxis_V( );
215 static inline VmathVector3 vmathV3MakeZAxis_V( );
218 * Multiply two 3-D vectors per element
220 static inline VmathVector3 vmathV3MulPerElem_V( VmathVector3 vec0, VmathVector3 vec1 );
223 * Divide two 3-D vectors per element
225 * Floating-point behavior matches standard library function divf4.
227 static inline VmathVector3 vmathV3DivPerElem_V( VmathVector3 vec0, VmathVector3 vec1 );
230 * Compute the reciprocal of a 3-D vector per element
232 * Floating-point behavior matches standard library function recipf4.
234 static inline VmathVector3 vmathV3RecipPerElem_V( VmathVector3 vec );
237 * Compute the square root of a 3-D vector per element
239 * Floating-point behavior matches standard library function sqrtf4.
241 static inline VmathVector3 vmathV3SqrtPerElem_V( VmathVector3 vec );
244 * Compute the reciprocal square root of a 3-D vector per element
246 * Floating-point behavior matches standard library function rsqrtf4.
248 static inline VmathVector3 vmathV3RsqrtPerElem_V( VmathVector3 vec );
251 * Compute the absolute value of a 3-D vector per element
253 static inline VmathVector3 vmathV3AbsPerElem_V( VmathVector3 vec );
256 * Copy sign from one 3-D vector to another, per element
258 static inline VmathVector3 vmathV3CopySignPerElem_V( VmathVector3 vec0, VmathVector3 vec1 );
261 * Maximum of two 3-D vectors per element
263 static inline VmathVector3 vmathV3MaxPerElem_V( VmathVector3 vec0, VmathVector3 vec1 );
266 * Minimum of two 3-D vectors per element
268 static inline VmathVector3 vmathV3MinPerElem_V( VmathVector3 vec0, VmathVector3 vec1 );
271 * Maximum element of a 3-D vector
273 static inline float vmathV3MaxElem_V( VmathVector3 vec );
276 * Minimum element of a 3-D vector
278 static inline float vmathV3MinElem_V( VmathVector3 vec );
281 * Compute the sum of all elements of a 3-D vector
283 static inline float vmathV3Sum_V( VmathVector3 vec );
286 * Compute the dot product of two 3-D vectors
288 static inline float vmathV3Dot_V( VmathVector3 vec0, VmathVector3 vec1 );
291 * Compute the square of the length of a 3-D vector
293 static inline float vmathV3LengthSqr_V( VmathVector3 vec );
296 * Compute the length of a 3-D vector
298 static inline float vmathV3Length_V( VmathVector3 vec );
301 * Normalize a 3-D vector
303 * The result is unpredictable when all elements of vec are at or near zero.
305 static inline VmathVector3 vmathV3Normalize_V( VmathVector3 vec );
308 * Compute cross product of two 3-D vectors
310 static inline VmathVector3 vmathV3Cross_V( VmathVector3 vec0, VmathVector3 vec1 );
313 * Outer product of two 3-D vectors
315 static inline VmathMatrix3 vmathV3Outer_V( VmathVector3 vec0, VmathVector3 vec1 );
318 * Pre-multiply a row vector by a 3x3 matrix
320 * Slower than column post-multiply.
322 static inline VmathVector3 vmathV3RowMul_V( VmathVector3 vec, VmathMatrix3 mat );
325 * Cross-product matrix of a 3-D vector
327 static inline VmathMatrix3 vmathV3CrossMatrix_V( VmathVector3 vec );
330 * Create cross-product matrix and multiply
332 * Faster than separately creating a cross-product matrix and multiplying.
334 static inline VmathMatrix3 vmathV3CrossMatrixMul_V( VmathVector3 vec, VmathMatrix3 mat );
337 * Linear interpolation between two 3-D vectors
339 * Does not clamp t between 0 and 1.
341 static inline VmathVector3 vmathV3Lerp_V( float t, VmathVector3 vec0, VmathVector3 vec1 );
344 * Spherical linear interpolation between two 3-D vectors
346 * The result is unpredictable if the vectors point in opposite directions.
347 * Does not clamp t between 0 and 1.
349 static inline VmathVector3 vmathV3Slerp_V( float t, VmathVector3 unitVec0, VmathVector3 unitVec1 );
352 * Conditionally select between two 3-D vectors
354 * This function uses a conditional select instruction to avoid a branch.
355 * However, the transfer of select1 to a VMX register may use more processing time than a branch.
357 static inline VmathVector3 vmathV3Select_V( VmathVector3 vec0, VmathVector3 vec1, unsigned int select1 );
360 * Store x, y, and z elements of a 3-D vector in the first three words of a quadword.
361 * The value of the fourth word (the word with the highest address) remains unchanged
363 static inline void vmathV3StoreXYZ_V( VmathVector3 vec, vec_float4 *quad );
366 * Load four three-float 3-D vectors, stored in three quadwords
368 static inline void vmathV3LoadXYZArray_V( VmathVector3 *vec0, VmathVector3 *vec1, VmathVector3 *vec2, VmathVector3 *vec3, const vec_float4 *threeQuads );
371 * Store four 3-D vectors in three quadwords
373 static inline void vmathV3StoreXYZArray_V( VmathVector3 vec0, VmathVector3 vec1, VmathVector3 vec2, VmathVector3 vec3, vec_float4 *threeQuads );
376 * Store eight 3-D vectors as half-floats
378 static inline void vmathV3StoreHalfFloats_V( VmathVector3 vec0, VmathVector3 vec1, VmathVector3 vec2, VmathVector3 vec3, VmathVector3 vec4, VmathVector3 vec5, VmathVector3 vec6, VmathVector3 vec7, vec_ushort8 *threeQuads );
380 #ifdef _VECTORMATH_DEBUG
385 * Function is only defined when _VECTORMATH_DEBUG is defined.
387 static inline void vmathV3Print_V( VmathVector3 vec );
390 * Print a 3-D vector and an associated string identifier
392 * Function is only defined when _VECTORMATH_DEBUG is defined.
394 static inline void vmathV3Prints_V( VmathVector3 vec, const char *name );
399 * Construct a 4-D vector from x, y, z, and w elements
401 static inline VmathVector4 vmathV4MakeFromElems_V( float x, float y, float z, float w );
404 * Construct a 4-D vector from a 3-D vector and a scalar
406 static inline VmathVector4 vmathV4MakeFromV3Scalar_V( VmathVector3 xyz, float w );
409 * Copy x, y, and z from a 3-D vector into a 4-D vector, and set w to 0
411 static inline VmathVector4 vmathV4MakeFromV3_V( VmathVector3 vec );
414 * Copy x, y, and z from a 3-D point into a 4-D vector, and set w to 1
416 static inline VmathVector4 vmathV4MakeFromP3_V( VmathPoint3 pnt );
419 * Copy elements from a quaternion into a 4-D vector
421 static inline VmathVector4 vmathV4MakeFromQ_V( VmathQuat quat );
424 * Set all elements of a 4-D vector to the same scalar value
426 static inline VmathVector4 vmathV4MakeFromScalar_V( float scalar );
429 * Set vector float data in a 4-D vector
431 static inline VmathVector4 vmathV4MakeFrom128_V( vec_float4 vf4 );
434 * Get vector float data from a 4-D vector
436 static inline vec_float4 vmathV4Get128_V( VmathVector4 vec );
439 * Set the x, y, and z elements of a 4-D vector
441 * This function does not change the w element.
443 static inline void vmathV4SetXYZ_V( VmathVector4 *result, VmathVector3 vec );
446 * Get the x, y, and z elements of a 4-D vector
448 static inline VmathVector3 vmathV4GetXYZ_V( VmathVector4 vec );
451 * Set the x element of a 4-D vector
453 static inline void vmathV4SetX_V( VmathVector4 *result, float x );
456 * Set the y element of a 4-D vector
458 static inline void vmathV4SetY_V( VmathVector4 *result, float y );
461 * Set the z element of a 4-D vector
463 static inline void vmathV4SetZ_V( VmathVector4 *result, float z );
466 * Set the w element of a 4-D vector
468 static inline void vmathV4SetW_V( VmathVector4 *result, float w );
471 * Get the x element of a 4-D vector
473 static inline float vmathV4GetX_V( VmathVector4 vec );
476 * Get the y element of a 4-D vector
478 static inline float vmathV4GetY_V( VmathVector4 vec );
481 * Get the z element of a 4-D vector
483 static inline float vmathV4GetZ_V( VmathVector4 vec );
486 * Get the w element of a 4-D vector
488 static inline float vmathV4GetW_V( VmathVector4 vec );
491 * Set an x, y, z, or w element of a 4-D vector by index
493 static inline void vmathV4SetElem_V( VmathVector4 *result, int idx, float value );
496 * Get an x, y, z, or w element of a 4-D vector by index
498 static inline float vmathV4GetElem_V( VmathVector4 vec, int idx );
501 * Add two 4-D vectors
503 static inline VmathVector4 vmathV4Add_V( VmathVector4 vec0, VmathVector4 vec1 );
506 * Subtract a 4-D vector from another 4-D vector
508 static inline VmathVector4 vmathV4Sub_V( VmathVector4 vec0, VmathVector4 vec1 );
511 * Multiply a 4-D vector by a scalar
513 static inline VmathVector4 vmathV4ScalarMul_V( VmathVector4 vec, float scalar );
516 * Divide a 4-D vector by a scalar
518 static inline VmathVector4 vmathV4ScalarDiv_V( VmathVector4 vec, float scalar );
521 * Negate all elements of a 4-D vector
523 static inline VmathVector4 vmathV4Neg_V( VmathVector4 vec );
528 static inline VmathVector4 vmathV4MakeXAxis_V( );
533 static inline VmathVector4 vmathV4MakeYAxis_V( );
538 static inline VmathVector4 vmathV4MakeZAxis_V( );
543 static inline VmathVector4 vmathV4MakeWAxis_V( );
546 * Multiply two 4-D vectors per element
548 static inline VmathVector4 vmathV4MulPerElem_V( VmathVector4 vec0, VmathVector4 vec1 );
551 * Divide two 4-D vectors per element
553 * Floating-point behavior matches standard library function divf4.
555 static inline VmathVector4 vmathV4DivPerElem_V( VmathVector4 vec0, VmathVector4 vec1 );
558 * Compute the reciprocal of a 4-D vector per element
560 * Floating-point behavior matches standard library function recipf4.
562 static inline VmathVector4 vmathV4RecipPerElem_V( VmathVector4 vec );
565 * Compute the square root of a 4-D vector per element
567 * Floating-point behavior matches standard library function sqrtf4.
569 static inline VmathVector4 vmathV4SqrtPerElem_V( VmathVector4 vec );
572 * Compute the reciprocal square root of a 4-D vector per element
574 * Floating-point behavior matches standard library function rsqrtf4.
576 static inline VmathVector4 vmathV4RsqrtPerElem_V( VmathVector4 vec );
579 * Compute the absolute value of a 4-D vector per element
581 static inline VmathVector4 vmathV4AbsPerElem_V( VmathVector4 vec );
584 * Copy sign from one 4-D vector to another, per element
586 static inline VmathVector4 vmathV4CopySignPerElem_V( VmathVector4 vec0, VmathVector4 vec1 );
589 * Maximum of two 4-D vectors per element
591 static inline VmathVector4 vmathV4MaxPerElem_V( VmathVector4 vec0, VmathVector4 vec1 );
594 * Minimum of two 4-D vectors per element
596 static inline VmathVector4 vmathV4MinPerElem_V( VmathVector4 vec0, VmathVector4 vec1 );
599 * Maximum element of a 4-D vector
601 static inline float vmathV4MaxElem_V( VmathVector4 vec );
604 * Minimum element of a 4-D vector
606 static inline float vmathV4MinElem_V( VmathVector4 vec );
609 * Compute the sum of all elements of a 4-D vector
611 static inline float vmathV4Sum_V( VmathVector4 vec );
614 * Compute the dot product of two 4-D vectors
616 static inline float vmathV4Dot_V( VmathVector4 vec0, VmathVector4 vec1 );
619 * Compute the square of the length of a 4-D vector
621 static inline float vmathV4LengthSqr_V( VmathVector4 vec );
624 * Compute the length of a 4-D vector
626 static inline float vmathV4Length_V( VmathVector4 vec );
629 * Normalize a 4-D vector
631 * The result is unpredictable when all elements of vec are at or near zero.
633 static inline VmathVector4 vmathV4Normalize_V( VmathVector4 vec );
636 * Outer product of two 4-D vectors
638 static inline VmathMatrix4 vmathV4Outer_V( VmathVector4 vec0, VmathVector4 vec1 );
641 * Linear interpolation between two 4-D vectors
643 * Does not clamp t between 0 and 1.
645 static inline VmathVector4 vmathV4Lerp_V( float t, VmathVector4 vec0, VmathVector4 vec1 );
648 * Spherical linear interpolation between two 4-D vectors
650 * The result is unpredictable if the vectors point in opposite directions.
651 * Does not clamp t between 0 and 1.
653 static inline VmathVector4 vmathV4Slerp_V( float t, VmathVector4 unitVec0, VmathVector4 unitVec1 );
656 * Conditionally select between two 4-D vectors
658 * This function uses a conditional select instruction to avoid a branch.
659 * However, the transfer of select1 to a VMX register may use more processing time than a branch.
661 static inline VmathVector4 vmathV4Select_V( VmathVector4 vec0, VmathVector4 vec1, unsigned int select1 );
664 * Store four 4-D vectors as half-floats
666 static inline void vmathV4StoreHalfFloats_V( VmathVector4 vec0, VmathVector4 vec1, VmathVector4 vec2, VmathVector4 vec3, vec_ushort8 *twoQuads );
668 #ifdef _VECTORMATH_DEBUG
673 * Function is only defined when _VECTORMATH_DEBUG is defined.
675 static inline void vmathV4Print_V( VmathVector4 vec );
678 * Print a 4-D vector and an associated string identifier
680 * Function is only defined when _VECTORMATH_DEBUG is defined.
682 static inline void vmathV4Prints_V( VmathVector4 vec, const char *name );
687 * Construct a 3-D point from x, y, and z elements
689 static inline VmathPoint3 vmathP3MakeFromElems_V( float x, float y, float z );
692 * Copy elements from a 3-D vector into a 3-D point
694 static inline VmathPoint3 vmathP3MakeFromV3_V( VmathVector3 vec );
697 * Set all elements of a 3-D point to the same scalar value
699 static inline VmathPoint3 vmathP3MakeFromScalar_V( float scalar );
702 * Set vector float data in a 3-D point
704 static inline VmathPoint3 vmathP3MakeFrom128_V( vec_float4 vf4 );
707 * Get vector float data from a 3-D point
709 static inline vec_float4 vmathP3Get128_V( VmathPoint3 pnt );
712 * Set the x element of a 3-D point
714 static inline void vmathP3SetX_V( VmathPoint3 *result, float x );
717 * Set the y element of a 3-D point
719 static inline void vmathP3SetY_V( VmathPoint3 *result, float y );
722 * Set the z element of a 3-D point
724 static inline void vmathP3SetZ_V( VmathPoint3 *result, float z );
727 * Get the x element of a 3-D point
729 static inline float vmathP3GetX_V( VmathPoint3 pnt );
732 * Get the y element of a 3-D point
734 static inline float vmathP3GetY_V( VmathPoint3 pnt );
737 * Get the z element of a 3-D point
739 static inline float vmathP3GetZ_V( VmathPoint3 pnt );
742 * Set an x, y, or z element of a 3-D point by index
744 static inline void vmathP3SetElem_V( VmathPoint3 *result, int idx, float value );
747 * Get an x, y, or z element of a 3-D point by index
749 static inline float vmathP3GetElem_V( VmathPoint3 pnt, int idx );
752 * Subtract a 3-D point from another 3-D point
754 static inline VmathVector3 vmathP3Sub_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
757 * Add a 3-D point to a 3-D vector
759 static inline VmathPoint3 vmathP3AddV3_V( VmathPoint3 pnt, VmathVector3 vec );
762 * Subtract a 3-D vector from a 3-D point
764 static inline VmathPoint3 vmathP3SubV3_V( VmathPoint3 pnt, VmathVector3 vec );
767 * Multiply two 3-D points per element
769 static inline VmathPoint3 vmathP3MulPerElem_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
772 * Divide two 3-D points per element
774 * Floating-point behavior matches standard library function divf4.
776 static inline VmathPoint3 vmathP3DivPerElem_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
779 * Compute the reciprocal of a 3-D point per element
781 * Floating-point behavior matches standard library function recipf4.
783 static inline VmathPoint3 vmathP3RecipPerElem_V( VmathPoint3 pnt );
786 * Compute the square root of a 3-D point per element
788 * Floating-point behavior matches standard library function sqrtf4.
790 static inline VmathPoint3 vmathP3SqrtPerElem_V( VmathPoint3 pnt );
793 * Compute the reciprocal square root of a 3-D point per element
795 * Floating-point behavior matches standard library function rsqrtf4.
797 static inline VmathPoint3 vmathP3RsqrtPerElem_V( VmathPoint3 pnt );
800 * Compute the absolute value of a 3-D point per element
802 static inline VmathPoint3 vmathP3AbsPerElem_V( VmathPoint3 pnt );
805 * Copy sign from one 3-D point to another, per element
807 static inline VmathPoint3 vmathP3CopySignPerElem_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
810 * Maximum of two 3-D points per element
812 static inline VmathPoint3 vmathP3MaxPerElem_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
815 * Minimum of two 3-D points per element
817 static inline VmathPoint3 vmathP3MinPerElem_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
820 * Maximum element of a 3-D point
822 static inline float vmathP3MaxElem_V( VmathPoint3 pnt );
825 * Minimum element of a 3-D point
827 static inline float vmathP3MinElem_V( VmathPoint3 pnt );
830 * Compute the sum of all elements of a 3-D point
832 static inline float vmathP3Sum_V( VmathPoint3 pnt );
835 * Apply uniform scale to a 3-D point
837 static inline VmathPoint3 vmathP3Scale_V( VmathPoint3 pnt, float scaleVal );
840 * Apply non-uniform scale to a 3-D point
842 static inline VmathPoint3 vmathP3NonUniformScale_V( VmathPoint3 pnt, VmathVector3 scaleVec );
845 * Scalar projection of a 3-D point on a unit-length 3-D vector
847 static inline float vmathP3Projection_V( VmathPoint3 pnt, VmathVector3 unitVec );
850 * Compute the square of the distance of a 3-D point from the coordinate-system origin
852 static inline float vmathP3DistSqrFromOrigin_V( VmathPoint3 pnt );
855 * Compute the distance of a 3-D point from the coordinate-system origin
857 static inline float vmathP3DistFromOrigin_V( VmathPoint3 pnt );
860 * Compute the square of the distance between two 3-D points
862 static inline float vmathP3DistSqr_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
865 * Compute the distance between two 3-D points
867 static inline float vmathP3Dist_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
870 * Linear interpolation between two 3-D points
872 * Does not clamp t between 0 and 1.
874 static inline VmathPoint3 vmathP3Lerp_V( float t, VmathPoint3 pnt0, VmathPoint3 pnt1 );
877 * Conditionally select between two 3-D points
879 * This function uses a conditional select instruction to avoid a branch.
880 * However, the transfer of select1 to a VMX register may use more processing time than a branch.
882 static inline VmathPoint3 vmathP3Select_V( VmathPoint3 pnt0, VmathPoint3 pnt1, unsigned int select1 );
885 * Store x, y, and z elements of a 3-D point in the first three words of a quadword.
886 * The value of the fourth word (the word with the highest address) remains unchanged
888 static inline void vmathP3StoreXYZ_V( VmathPoint3 pnt, vec_float4 *quad );
891 * Load four three-float 3-D points, stored in three quadwords
893 static inline void vmathP3LoadXYZArray_V( VmathPoint3 *pnt0, VmathPoint3 *pnt1, VmathPoint3 *pnt2, VmathPoint3 *pnt3, const vec_float4 *threeQuads );
896 * Store four 3-D points in three quadwords
898 static inline void vmathP3StoreXYZArray_V( VmathPoint3 pnt0, VmathPoint3 pnt1, VmathPoint3 pnt2, VmathPoint3 pnt3, vec_float4 *threeQuads );
901 * Store eight 3-D points as half-floats
903 static inline void vmathP3StoreHalfFloats_V( VmathPoint3 pnt0, VmathPoint3 pnt1, VmathPoint3 pnt2, VmathPoint3 pnt3, VmathPoint3 pnt4, VmathPoint3 pnt5, VmathPoint3 pnt6, VmathPoint3 pnt7, vec_ushort8 *threeQuads );
905 #ifdef _VECTORMATH_DEBUG
910 * Function is only defined when _VECTORMATH_DEBUG is defined.
912 static inline void vmathP3Print_V( VmathPoint3 pnt );
915 * Print a 3-D point and an associated string identifier
917 * Function is only defined when _VECTORMATH_DEBUG is defined.
919 static inline void vmathP3Prints_V( VmathPoint3 pnt, const char *name );
924 * Construct a quaternion from x, y, z, and w elements
926 static inline VmathQuat vmathQMakeFromElems_V( float x, float y, float z, float w );
929 * Construct a quaternion from a 3-D vector and a scalar
931 static inline VmathQuat vmathQMakeFromV3Scalar_V( VmathVector3 xyz, float w );
934 * Copy elements from a 4-D vector into a quaternion
936 static inline VmathQuat vmathQMakeFromV4_V( VmathVector4 vec );
939 * Convert a rotation matrix to a unit-length quaternion
941 static inline VmathQuat vmathQMakeFromM3_V( VmathMatrix3 rotMat );
944 * Set all elements of a quaternion to the same scalar value
946 static inline VmathQuat vmathQMakeFromScalar_V( float scalar );
949 * Set vector float data in a quaternion
951 static inline VmathQuat vmathQMakeFrom128_V( vec_float4 vf4 );
954 * Get vector float data from a quaternion
956 static inline vec_float4 vmathQGet128_V( VmathQuat quat );
959 * Set the x, y, and z elements of a quaternion
961 * This function does not change the w element.
963 static inline void vmathQSetXYZ_V( VmathQuat *result, VmathVector3 vec );
966 * Get the x, y, and z elements of a quaternion
968 static inline VmathVector3 vmathQGetXYZ_V( VmathQuat quat );
971 * Set the x element of a quaternion
973 static inline void vmathQSetX_V( VmathQuat *result, float x );
976 * Set the y element of a quaternion
978 static inline void vmathQSetY_V( VmathQuat *result, float y );
981 * Set the z element of a quaternion
983 static inline void vmathQSetZ_V( VmathQuat *result, float z );
986 * Set the w element of a quaternion
988 static inline void vmathQSetW_V( VmathQuat *result, float w );
991 * Get the x element of a quaternion
993 static inline float vmathQGetX_V( VmathQuat quat );
996 * Get the y element of a quaternion
998 static inline float vmathQGetY_V( VmathQuat quat );
1001 * Get the z element of a quaternion
1003 static inline float vmathQGetZ_V( VmathQuat quat );
1006 * Get the w element of a quaternion
1008 static inline float vmathQGetW_V( VmathQuat quat );
1011 * Set an x, y, z, or w element of a quaternion by index
1013 static inline void vmathQSetElem_V( VmathQuat *result, int idx, float value );
1016 * Get an x, y, z, or w element of a quaternion by index
1018 static inline float vmathQGetElem_V( VmathQuat quat, int idx );
1021 * Add two quaternions
1023 static inline VmathQuat vmathQAdd_V( VmathQuat quat0, VmathQuat quat1 );
1026 * Subtract a quaternion from another quaternion
1028 static inline VmathQuat vmathQSub_V( VmathQuat quat0, VmathQuat quat1 );
1031 * Multiply two quaternions
1033 static inline VmathQuat vmathQMul_V( VmathQuat quat0, VmathQuat quat1 );
1036 * Multiply a quaternion by a scalar
1038 static inline VmathQuat vmathQScalarMul_V( VmathQuat quat, float scalar );
1041 * Divide a quaternion by a scalar
1043 static inline VmathQuat vmathQScalarDiv_V( VmathQuat quat, float scalar );
1046 * Negate all elements of a quaternion
1048 static inline VmathQuat vmathQNeg_V( VmathQuat quat );
1051 * Construct an identity quaternion
1053 static inline VmathQuat vmathQMakeIdentity_V( );
1056 * Construct a quaternion to rotate between two unit-length 3-D vectors
1058 * The result is unpredictable if unitVec0 and unitVec1 point in opposite directions.
1060 static inline VmathQuat vmathQMakeRotationArc_V( VmathVector3 unitVec0, VmathVector3 unitVec1 );
1063 * Construct a quaternion to rotate around a unit-length 3-D vector
1065 static inline VmathQuat vmathQMakeRotationAxis_V( float radians, VmathVector3 unitVec );
1068 * Construct a quaternion to rotate around the x axis
1070 static inline VmathQuat vmathQMakeRotationX_V( float radians );
1073 * Construct a quaternion to rotate around the y axis
1075 static inline VmathQuat vmathQMakeRotationY_V( float radians );
1078 * Construct a quaternion to rotate around the z axis
1080 static inline VmathQuat vmathQMakeRotationZ_V( float radians );
1083 * Compute the conjugate of a quaternion
1085 static inline VmathQuat vmathQConj_V( VmathQuat quat );
1088 * Use a unit-length quaternion to rotate a 3-D vector
1090 static inline VmathVector3 vmathQRotate_V( VmathQuat unitQuat, VmathVector3 vec );
1093 * Compute the dot product of two quaternions
1095 static inline float vmathQDot_V( VmathQuat quat0, VmathQuat quat1 );
1098 * Compute the norm of a quaternion
1100 static inline float vmathQNorm_V( VmathQuat quat );
1103 * Compute the length of a quaternion
1105 static inline float vmathQLength_V( VmathQuat quat );
1108 * Normalize a quaternion
1110 * The result is unpredictable when all elements of quat are at or near zero.
1112 static inline VmathQuat vmathQNormalize_V( VmathQuat quat );
1115 * Linear interpolation between two quaternions
1117 * Does not clamp t between 0 and 1.
1119 static inline VmathQuat vmathQLerp_V( float t, VmathQuat quat0, VmathQuat quat1 );
1122 * Spherical linear interpolation between two quaternions
1124 * Interpolates along the shortest path between orientations.
1125 * Does not clamp t between 0 and 1.
1127 static inline VmathQuat vmathQSlerp_V( float t, VmathQuat unitQuat0, VmathQuat unitQuat1 );
1130 * Spherical quadrangle interpolation
1132 static inline VmathQuat vmathQSquad_V( float t, VmathQuat unitQuat0, VmathQuat unitQuat1, VmathQuat unitQuat2, VmathQuat unitQuat3 );
1135 * Conditionally select between two quaternions
1137 * This function uses a conditional select instruction to avoid a branch.
1138 * However, the transfer of select1 to a VMX register may use more processing time than a branch.
1140 static inline VmathQuat vmathQSelect_V( VmathQuat quat0, VmathQuat quat1, unsigned int select1 );
1142 #ifdef _VECTORMATH_DEBUG
1145 * Print a quaternion
1147 * Function is only defined when _VECTORMATH_DEBUG is defined.
1149 static inline void vmathQPrint_V( VmathQuat quat );
1152 * Print a quaternion and an associated string identifier
1154 * Function is only defined when _VECTORMATH_DEBUG is defined.
1156 static inline void vmathQPrints_V( VmathQuat quat, const char *name );
1161 * Construct a 3x3 matrix containing the specified columns
1163 static inline VmathMatrix3 vmathM3MakeFromCols_V( VmathVector3 col0, VmathVector3 col1, VmathVector3 col2 );
1166 * Construct a 3x3 rotation matrix from a unit-length quaternion
1168 static inline VmathMatrix3 vmathM3MakeFromQ_V( VmathQuat unitQuat );
1171 * Set all elements of a 3x3 matrix to the same scalar value
1173 static inline VmathMatrix3 vmathM3MakeFromScalar_V( float scalar );
1176 * Set column 0 of a 3x3 matrix
1178 static inline void vmathM3SetCol0_V( VmathMatrix3 *result, VmathVector3 col0 );
1181 * Set column 1 of a 3x3 matrix
1183 static inline void vmathM3SetCol1_V( VmathMatrix3 *result, VmathVector3 col1 );
1186 * Set column 2 of a 3x3 matrix
1188 static inline void vmathM3SetCol2_V( VmathMatrix3 *result, VmathVector3 col2 );
1191 * Get column 0 of a 3x3 matrix
1193 static inline VmathVector3 vmathM3GetCol0_V( VmathMatrix3 mat );
1196 * Get column 1 of a 3x3 matrix
1198 static inline VmathVector3 vmathM3GetCol1_V( VmathMatrix3 mat );
1201 * Get column 2 of a 3x3 matrix
1203 static inline VmathVector3 vmathM3GetCol2_V( VmathMatrix3 mat );
1206 * Set the column of a 3x3 matrix referred to by the specified index
1208 static inline void vmathM3SetCol_V( VmathMatrix3 *result, int col, VmathVector3 vec );
1211 * Set the row of a 3x3 matrix referred to by the specified index
1213 static inline void vmathM3SetRow_V( VmathMatrix3 *result, int row, VmathVector3 vec );
1216 * Get the column of a 3x3 matrix referred to by the specified index
1218 static inline VmathVector3 vmathM3GetCol_V( VmathMatrix3 mat, int col );
1221 * Get the row of a 3x3 matrix referred to by the specified index
1223 static inline VmathVector3 vmathM3GetRow_V( VmathMatrix3 mat, int row );
1226 * Set the element of a 3x3 matrix referred to by column and row indices
1228 static inline void vmathM3SetElem_V( VmathMatrix3 *result, int col, int row, float val );
1231 * Get the element of a 3x3 matrix referred to by column and row indices
1233 static inline float vmathM3GetElem_V( VmathMatrix3 mat, int col, int row );
1236 * Add two 3x3 matrices
1238 static inline VmathMatrix3 vmathM3Add_V( VmathMatrix3 mat0, VmathMatrix3 mat1 );
1241 * Subtract a 3x3 matrix from another 3x3 matrix
1243 static inline VmathMatrix3 vmathM3Sub_V( VmathMatrix3 mat0, VmathMatrix3 mat1 );
1246 * Negate all elements of a 3x3 matrix
1248 static inline VmathMatrix3 vmathM3Neg_V( VmathMatrix3 mat );
1251 * Multiply a 3x3 matrix by a scalar
1253 static inline VmathMatrix3 vmathM3ScalarMul_V( VmathMatrix3 mat, float scalar );
1256 * Multiply a 3x3 matrix by a 3-D vector
1258 static inline VmathVector3 vmathM3MulV3_V( VmathMatrix3 mat, VmathVector3 vec );
1261 * Multiply two 3x3 matrices
1263 static inline VmathMatrix3 vmathM3Mul_V( VmathMatrix3 mat0, VmathMatrix3 mat1 );
1266 * Construct an identity 3x3 matrix
1268 static inline VmathMatrix3 vmathM3MakeIdentity_V( );
1271 * Construct a 3x3 matrix to rotate around the x axis
1273 static inline VmathMatrix3 vmathM3MakeRotationX_V( float radians );
1276 * Construct a 3x3 matrix to rotate around the y axis
1278 static inline VmathMatrix3 vmathM3MakeRotationY_V( float radians );
1281 * Construct a 3x3 matrix to rotate around the z axis
1283 static inline VmathMatrix3 vmathM3MakeRotationZ_V( float radians );
1286 * Construct a 3x3 matrix to rotate around the x, y, and z axes
1288 static inline VmathMatrix3 vmathM3MakeRotationZYX_V( VmathVector3 radiansXYZ );
1291 * Construct a 3x3 matrix to rotate around a unit-length 3-D vector
1293 static inline VmathMatrix3 vmathM3MakeRotationAxis_V( float radians, VmathVector3 unitVec );
1296 * Construct a rotation matrix from a unit-length quaternion
1298 static inline VmathMatrix3 vmathM3MakeRotationQ_V( VmathQuat unitQuat );
1301 * Construct a 3x3 matrix to perform scaling
1303 static inline VmathMatrix3 vmathM3MakeScale_V( VmathVector3 scaleVec );
1306 * Append (post-multiply) a scale transformation to a 3x3 matrix
1308 * Faster than creating and multiplying a scale transformation matrix.
1310 static inline VmathMatrix3 vmathM3AppendScale_V( VmathMatrix3 mat, VmathVector3 scaleVec );
1313 * Prepend (pre-multiply) a scale transformation to a 3x3 matrix
1315 * Faster than creating and multiplying a scale transformation matrix.
1317 static inline VmathMatrix3 vmathM3PrependScale_V( VmathVector3 scaleVec, VmathMatrix3 mat );
1320 * Multiply two 3x3 matrices per element
1322 static inline VmathMatrix3 vmathM3MulPerElem_V( VmathMatrix3 mat0, VmathMatrix3 mat1 );
1325 * Compute the absolute value of a 3x3 matrix per element
1327 static inline VmathMatrix3 vmathM3AbsPerElem_V( VmathMatrix3 mat );
1330 * Transpose of a 3x3 matrix
1332 static inline VmathMatrix3 vmathM3Transpose_V( VmathMatrix3 mat );
1335 * Compute the inverse of a 3x3 matrix
1337 * Result is unpredictable when the determinant of mat is equal to or near 0.
1339 static inline VmathMatrix3 vmathM3Inverse_V( VmathMatrix3 mat );
1342 * Determinant of a 3x3 matrix
1344 static inline float vmathM3Determinant_V( VmathMatrix3 mat );
1347 * Conditionally select between two 3x3 matrices
1349 * This function uses a conditional select instruction to avoid a branch.
1350 * However, the transfer of select1 to a VMX register may use more processing time than a branch.
1352 static inline VmathMatrix3 vmathM3Select_V( VmathMatrix3 mat0, VmathMatrix3 mat1, unsigned int select1 );
1354 #ifdef _VECTORMATH_DEBUG
1357 * Print a 3x3 matrix
1359 * Function is only defined when _VECTORMATH_DEBUG is defined.
1361 static inline void vmathM3Print_V( VmathMatrix3 mat );
1364 * Print a 3x3 matrix and an associated string identifier
1366 * Function is only defined when _VECTORMATH_DEBUG is defined.
1368 static inline void vmathM3Prints_V( VmathMatrix3 mat, const char *name );
1373 * Construct a 4x4 matrix containing the specified columns
1375 static inline VmathMatrix4 vmathM4MakeFromCols_V( VmathVector4 col0, VmathVector4 col1, VmathVector4 col2, VmathVector4 col3 );
1378 * Construct a 4x4 matrix from a 3x4 transformation matrix
1380 static inline VmathMatrix4 vmathM4MakeFromT3_V( VmathTransform3 mat );
1383 * Construct a 4x4 matrix from a 3x3 matrix and a 3-D vector
1385 static inline VmathMatrix4 vmathM4MakeFromM3V3_V( VmathMatrix3 mat, VmathVector3 translateVec );
1388 * Construct a 4x4 matrix from a unit-length quaternion and a 3-D vector
1390 static inline VmathMatrix4 vmathM4MakeFromQV3_V( VmathQuat unitQuat, VmathVector3 translateVec );
1393 * Set all elements of a 4x4 matrix to the same scalar value
1395 static inline VmathMatrix4 vmathM4MakeFromScalar_V( float scalar );
1398 * Set the upper-left 3x3 submatrix
1400 * This function does not change the bottom row elements.
1402 static inline void vmathM4SetUpper3x3_V( VmathMatrix4 *result, VmathMatrix3 mat3 );
1405 * Get the upper-left 3x3 submatrix of a 4x4 matrix
1407 static inline VmathMatrix3 vmathM4GetUpper3x3_V( VmathMatrix4 mat );
1410 * Set translation component
1412 * This function does not change the bottom row elements.
1414 static inline void vmathM4SetTranslation_V( VmathMatrix4 *result, VmathVector3 translateVec );
1417 * Get the translation component of a 4x4 matrix
1419 static inline VmathVector3 vmathM4GetTranslation_V( VmathMatrix4 mat );
1422 * Set column 0 of a 4x4 matrix
1424 static inline void vmathM4SetCol0_V( VmathMatrix4 *result, VmathVector4 col0 );
1427 * Set column 1 of a 4x4 matrix
1429 static inline void vmathM4SetCol1_V( VmathMatrix4 *result, VmathVector4 col1 );
1432 * Set column 2 of a 4x4 matrix
1434 static inline void vmathM4SetCol2_V( VmathMatrix4 *result, VmathVector4 col2 );
1437 * Set column 3 of a 4x4 matrix
1439 static inline void vmathM4SetCol3_V( VmathMatrix4 *result, VmathVector4 col3 );
1442 * Get column 0 of a 4x4 matrix
1444 static inline VmathVector4 vmathM4GetCol0_V( VmathMatrix4 mat );
1447 * Get column 1 of a 4x4 matrix
1449 static inline VmathVector4 vmathM4GetCol1_V( VmathMatrix4 mat );
1452 * Get column 2 of a 4x4 matrix
1454 static inline VmathVector4 vmathM4GetCol2_V( VmathMatrix4 mat );
1457 * Get column 3 of a 4x4 matrix
1459 static inline VmathVector4 vmathM4GetCol3_V( VmathMatrix4 mat );
1462 * Set the column of a 4x4 matrix referred to by the specified index
1464 static inline void vmathM4SetCol_V( VmathMatrix4 *result, int col, VmathVector4 vec );
1467 * Set the row of a 4x4 matrix referred to by the specified index
1469 static inline void vmathM4SetRow_V( VmathMatrix4 *result, int row, VmathVector4 vec );
1472 * Get the column of a 4x4 matrix referred to by the specified index
1474 static inline VmathVector4 vmathM4GetCol_V( VmathMatrix4 mat, int col );
1477 * Get the row of a 4x4 matrix referred to by the specified index
1479 static inline VmathVector4 vmathM4GetRow_V( VmathMatrix4 mat, int row );
1482 * Set the element of a 4x4 matrix referred to by column and row indices
1484 static inline void vmathM4SetElem_V( VmathMatrix4 *result, int col, int row, float val );
1487 * Get the element of a 4x4 matrix referred to by column and row indices
1489 static inline float vmathM4GetElem_V( VmathMatrix4 mat, int col, int row );
1492 * Add two 4x4 matrices
1494 static inline VmathMatrix4 vmathM4Add_V( VmathMatrix4 mat0, VmathMatrix4 mat1 );
1497 * Subtract a 4x4 matrix from another 4x4 matrix
1499 static inline VmathMatrix4 vmathM4Sub_V( VmathMatrix4 mat0, VmathMatrix4 mat1 );
1502 * Negate all elements of a 4x4 matrix
1504 static inline VmathMatrix4 vmathM4Neg_V( VmathMatrix4 mat );
1507 * Multiply a 4x4 matrix by a scalar
1509 static inline VmathMatrix4 vmathM4ScalarMul_V( VmathMatrix4 mat, float scalar );
1512 * Multiply a 4x4 matrix by a 4-D vector
1514 static inline VmathVector4 vmathM4MulV4_V( VmathMatrix4 mat, VmathVector4 vec );
1517 * Multiply a 4x4 matrix by a 3-D vector
1519 static inline VmathVector4 vmathM4MulV3_V( VmathMatrix4 mat, VmathVector3 vec );
1522 * Multiply a 4x4 matrix by a 3-D point
1524 static inline VmathVector4 vmathM4MulP3_V( VmathMatrix4 mat, VmathPoint3 pnt );
1527 * Multiply two 4x4 matrices
1529 static inline VmathMatrix4 vmathM4Mul_V( VmathMatrix4 mat0, VmathMatrix4 mat1 );
1532 * Multiply a 4x4 matrix by a 3x4 transformation matrix
1534 static inline VmathMatrix4 vmathM4MulT3_V( VmathMatrix4 mat, VmathTransform3 tfrm );
1537 * Construct an identity 4x4 matrix
1539 static inline VmathMatrix4 vmathM4MakeIdentity_V( );
1542 * Construct a 4x4 matrix to rotate around the x axis
1544 static inline VmathMatrix4 vmathM4MakeRotationX_V( float radians );
1547 * Construct a 4x4 matrix to rotate around the y axis
1549 static inline VmathMatrix4 vmathM4MakeRotationY_V( float radians );
1552 * Construct a 4x4 matrix to rotate around the z axis
1554 static inline VmathMatrix4 vmathM4MakeRotationZ_V( float radians );
1557 * Construct a 4x4 matrix to rotate around the x, y, and z axes
1559 static inline VmathMatrix4 vmathM4MakeRotationZYX_V( VmathVector3 radiansXYZ );
1562 * Construct a 4x4 matrix to rotate around a unit-length 3-D vector
1564 static inline VmathMatrix4 vmathM4MakeRotationAxis_V( float radians, VmathVector3 unitVec );
1567 * Construct a rotation matrix from a unit-length quaternion
1569 static inline VmathMatrix4 vmathM4MakeRotationQ_V( VmathQuat unitQuat );
1572 * Construct a 4x4 matrix to perform scaling
1574 static inline VmathMatrix4 vmathM4MakeScale_V( VmathVector3 scaleVec );
1577 * Construct a 4x4 matrix to perform translation
1579 static inline VmathMatrix4 vmathM4MakeTranslation_V( VmathVector3 translateVec );
1582 * Construct viewing matrix based on eye position, position looked at, and up direction
1584 static inline VmathMatrix4 vmathM4MakeLookAt_V( VmathPoint3 eyePos, VmathPoint3 lookAtPos, VmathVector3 upVec );
1587 * Construct a perspective projection matrix
1589 static inline VmathMatrix4 vmathM4MakePerspective_V( float fovyRadians, float aspect, float zNear, float zFar );
1592 * Construct a perspective projection matrix based on frustum
1594 static inline VmathMatrix4 vmathM4MakeFrustum_V( float left, float right, float bottom, float top, float zNear, float zFar );
1597 * Construct an orthographic projection matrix
1599 static inline VmathMatrix4 vmathM4MakeOrthographic_V( float left, float right, float bottom, float top, float zNear, float zFar );
1602 * Append (post-multiply) a scale transformation to a 4x4 matrix
1604 * Faster than creating and multiplying a scale transformation matrix.
1606 static inline VmathMatrix4 vmathM4AppendScale_V( VmathMatrix4 mat, VmathVector3 scaleVec );
1609 * Prepend (pre-multiply) a scale transformation to a 4x4 matrix
1611 * Faster than creating and multiplying a scale transformation matrix.
1613 static inline VmathMatrix4 vmathM4PrependScale_V( VmathVector3 scaleVec, VmathMatrix4 mat );
1616 * Multiply two 4x4 matrices per element
1618 static inline VmathMatrix4 vmathM4MulPerElem_V( VmathMatrix4 mat0, VmathMatrix4 mat1 );
1621 * Compute the absolute value of a 4x4 matrix per element
1623 static inline VmathMatrix4 vmathM4AbsPerElem_V( VmathMatrix4 mat );
1626 * Transpose of a 4x4 matrix
1628 static inline VmathMatrix4 vmathM4Transpose_V( VmathMatrix4 mat );
1631 * Compute the inverse of a 4x4 matrix
1633 * Result is unpredictable when the determinant of mat is equal to or near 0.
1635 static inline VmathMatrix4 vmathM4Inverse_V( VmathMatrix4 mat );
1638 * Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix
1640 * This can be used to achieve better performance than a general inverse when the specified 4x4 matrix meets the given restrictions. The result is unpredictable when the determinant of mat is equal to or near 0.
1642 static inline VmathMatrix4 vmathM4AffineInverse_V( VmathMatrix4 mat );
1645 * Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix with an orthogonal upper-left 3x3 submatrix
1647 * This can be used to achieve better performance than a general inverse when the specified 4x4 matrix meets the given restrictions.
1649 static inline VmathMatrix4 vmathM4OrthoInverse_V( VmathMatrix4 mat );
1652 * Determinant of a 4x4 matrix
1654 static inline float vmathM4Determinant_V( VmathMatrix4 mat );
1657 * Conditionally select between two 4x4 matrices
1659 * This function uses a conditional select instruction to avoid a branch.
1660 * However, the transfer of select1 to a VMX register may use more processing time than a branch.
1662 static inline VmathMatrix4 vmathM4Select_V( VmathMatrix4 mat0, VmathMatrix4 mat1, unsigned int select1 );
1664 #ifdef _VECTORMATH_DEBUG
1667 * Print a 4x4 matrix
1669 * Function is only defined when _VECTORMATH_DEBUG is defined.
1671 static inline void vmathM4Print_V( VmathMatrix4 mat );
1674 * Print a 4x4 matrix and an associated string identifier
1676 * Function is only defined when _VECTORMATH_DEBUG is defined.
1678 static inline void vmathM4Prints_V( VmathMatrix4 mat, const char *name );
1683 * Construct a 3x4 transformation matrix containing the specified columns
1685 static inline VmathTransform3 vmathT3MakeFromCols_V( VmathVector3 col0, VmathVector3 col1, VmathVector3 col2, VmathVector3 col3 );
1688 * Construct a 3x4 transformation matrix from a 3x3 matrix and a 3-D vector
1690 static inline VmathTransform3 vmathT3MakeFromM3V3_V( VmathMatrix3 tfrm, VmathVector3 translateVec );
1693 * Construct a 3x4 transformation matrix from a unit-length quaternion and a 3-D vector
1695 static inline VmathTransform3 vmathT3MakeFromQV3_V( VmathQuat unitQuat, VmathVector3 translateVec );
1698 * Set all elements of a 3x4 transformation matrix to the same scalar value
1700 static inline VmathTransform3 vmathT3MakeFromScalar_V( float scalar );
1703 * Set the upper-left 3x3 submatrix
1705 static inline void vmathT3SetUpper3x3_V( VmathTransform3 *result, VmathMatrix3 mat3 );
1708 * Get the upper-left 3x3 submatrix of a 3x4 transformation matrix
1710 static inline VmathMatrix3 vmathT3GetUpper3x3_V( VmathTransform3 tfrm );
1713 * Set translation component
1715 static inline void vmathT3SetTranslation_V( VmathTransform3 *result, VmathVector3 translateVec );
1718 * Get the translation component of a 3x4 transformation matrix
1720 static inline VmathVector3 vmathT3GetTranslation_V( VmathTransform3 tfrm );
1723 * Set column 0 of a 3x4 transformation matrix
1725 static inline void vmathT3SetCol0_V( VmathTransform3 *result, VmathVector3 col0 );
1728 * Set column 1 of a 3x4 transformation matrix
1730 static inline void vmathT3SetCol1_V( VmathTransform3 *result, VmathVector3 col1 );
1733 * Set column 2 of a 3x4 transformation matrix
1735 static inline void vmathT3SetCol2_V( VmathTransform3 *result, VmathVector3 col2 );
1738 * Set column 3 of a 3x4 transformation matrix
1740 static inline void vmathT3SetCol3_V( VmathTransform3 *result, VmathVector3 col3 );
1743 * Get column 0 of a 3x4 transformation matrix
1745 static inline VmathVector3 vmathT3GetCol0_V( VmathTransform3 tfrm );
1748 * Get column 1 of a 3x4 transformation matrix
1750 static inline VmathVector3 vmathT3GetCol1_V( VmathTransform3 tfrm );
1753 * Get column 2 of a 3x4 transformation matrix
1755 static inline VmathVector3 vmathT3GetCol2_V( VmathTransform3 tfrm );
1758 * Get column 3 of a 3x4 transformation matrix
1760 static inline VmathVector3 vmathT3GetCol3_V( VmathTransform3 tfrm );
1763 * Set the column of a 3x4 transformation matrix referred to by the specified index
1765 static inline void vmathT3SetCol_V( VmathTransform3 *result, int col, VmathVector3 vec );
1768 * Set the row of a 3x4 transformation matrix referred to by the specified index
1770 static inline void vmathT3SetRow_V( VmathTransform3 *result, int row, VmathVector4 vec );
1773 * Get the column of a 3x4 transformation matrix referred to by the specified index
1775 static inline VmathVector3 vmathT3GetCol_V( VmathTransform3 tfrm, int col );
1778 * Get the row of a 3x4 transformation matrix referred to by the specified index
1780 static inline VmathVector4 vmathT3GetRow_V( VmathTransform3 tfrm, int row );
1783 * Set the element of a 3x4 transformation matrix referred to by column and row indices
1785 static inline void vmathT3SetElem_V( VmathTransform3 *result, int col, int row, float val );
1788 * Get the element of a 3x4 transformation matrix referred to by column and row indices
1790 static inline float vmathT3GetElem_V( VmathTransform3 tfrm, int col, int row );
1793 * Multiply a 3x4 transformation matrix by a 3-D vector
1795 static inline VmathVector3 vmathT3MulV3_V( VmathTransform3 tfrm, VmathVector3 vec );
1798 * Multiply a 3x4 transformation matrix by a 3-D point
1800 static inline VmathPoint3 vmathT3MulP3_V( VmathTransform3 tfrm, VmathPoint3 pnt );
1803 * Multiply two 3x4 transformation matrices
1805 static inline VmathTransform3 vmathT3Mul_V( VmathTransform3 tfrm0, VmathTransform3 tfrm1 );
1808 * Construct an identity 3x4 transformation matrix
1810 static inline VmathTransform3 vmathT3MakeIdentity_V( );
1813 * Construct a 3x4 transformation matrix to rotate around the x axis
1815 static inline VmathTransform3 vmathT3MakeRotationX_V( float radians );
1818 * Construct a 3x4 transformation matrix to rotate around the y axis
1820 static inline VmathTransform3 vmathT3MakeRotationY_V( float radians );
1823 * Construct a 3x4 transformation matrix to rotate around the z axis
1825 static inline VmathTransform3 vmathT3MakeRotationZ_V( float radians );
1828 * Construct a 3x4 transformation matrix to rotate around the x, y, and z axes
1830 static inline VmathTransform3 vmathT3MakeRotationZYX_V( VmathVector3 radiansXYZ );
1833 * Construct a 3x4 transformation matrix to rotate around a unit-length 3-D vector
1835 static inline VmathTransform3 vmathT3MakeRotationAxis_V( float radians, VmathVector3 unitVec );
1838 * Construct a rotation matrix from a unit-length quaternion
1840 static inline VmathTransform3 vmathT3MakeRotationQ_V( VmathQuat unitQuat );
1843 * Construct a 3x4 transformation matrix to perform scaling
1845 static inline VmathTransform3 vmathT3MakeScale_V( VmathVector3 scaleVec );
1848 * Construct a 3x4 transformation matrix to perform translation
1850 static inline VmathTransform3 vmathT3MakeTranslation_V( VmathVector3 translateVec );
1853 * Append (post-multiply) a scale transformation to a 3x4 transformation matrix
1855 * Faster than creating and multiplying a scale transformation matrix.
1857 static inline VmathTransform3 vmathT3AppendScale_V( VmathTransform3 tfrm, VmathVector3 scaleVec );
1860 * Prepend (pre-multiply) a scale transformation to a 3x4 transformation matrix
1862 * Faster than creating and multiplying a scale transformation matrix.
1864 static inline VmathTransform3 vmathT3PrependScale_V( VmathVector3 scaleVec, VmathTransform3 tfrm );
1867 * Multiply two 3x4 transformation matrices per element
1869 static inline VmathTransform3 vmathT3MulPerElem_V( VmathTransform3 tfrm0, VmathTransform3 tfrm1 );
1872 * Compute the absolute value of a 3x4 transformation matrix per element
1874 static inline VmathTransform3 vmathT3AbsPerElem_V( VmathTransform3 tfrm );
1877 * Inverse of a 3x4 transformation matrix
1879 * Result is unpredictable when the determinant of the left 3x3 submatrix is equal to or near 0.
1881 static inline VmathTransform3 vmathT3Inverse_V( VmathTransform3 tfrm );
1884 * Compute the inverse of a 3x4 transformation matrix, expected to have an orthogonal upper-left 3x3 submatrix
1886 * This can be used to achieve better performance than a general inverse when the specified 3x4 transformation matrix meets the given restrictions.
1888 static inline VmathTransform3 vmathT3OrthoInverse_V( VmathTransform3 tfrm );
1891 * Conditionally select between two 3x4 transformation matrices
1893 * This function uses a conditional select instruction to avoid a branch.
1894 * However, the transfer of select1 to a VMX register may use more processing time than a branch.
1896 static inline VmathTransform3 vmathT3Select_V( VmathTransform3 tfrm0, VmathTransform3 tfrm1, unsigned int select1 );
1898 #ifdef _VECTORMATH_DEBUG
1901 * Print a 3x4 transformation matrix
1903 * Function is only defined when _VECTORMATH_DEBUG is defined.
1905 static inline void vmathT3Print_V( VmathTransform3 tfrm );
1908 * Print a 3x4 transformation matrix and an associated string identifier
1910 * Function is only defined when _VECTORMATH_DEBUG is defined.
1912 static inline void vmathT3Prints_V( VmathTransform3 tfrm, const char *name );
1918 #endif /* __cplusplus */
1920 #include "vectormath_aos.h"
1921 #include "vec_aos_v.h"
1922 #include "quat_aos_v.h"
1923 #include "mat_aos_v.h"