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_SPU_H
31 #define _VECTORMATH_AOS_C_V_SPU_H
34 #include <spu_intrinsics.h>
36 #ifdef _VECTORMATH_DEBUG
41 #endif /* __cplusplus */
43 #ifndef _VECTORMATH_AOS_C_TYPES_H
44 #define _VECTORMATH_AOS_C_TYPES_H
46 /* A 3-D vector in array-of-structures format
48 typedef struct _VmathVector3
53 /* A 4-D vector in array-of-structures format
55 typedef struct _VmathVector4
60 /* A 3-D point in array-of-structures format
62 typedef struct _VmathPoint3
67 /* A quaternion in array-of-structures format
69 typedef struct _VmathQuat
74 /* A 3x3 matrix in array-of-structures format
76 typedef struct _VmathMatrix3
83 /* A 4x4 matrix in array-of-structures format
85 typedef struct _VmathMatrix4
93 /* A 3x4 transformation matrix in array-of-structures format
95 typedef struct _VmathTransform3
106 * Construct a 3-D vector from x, y, and z elements
108 static inline VmathVector3 vmathV3MakeFromElems_V( float x, float y, float z );
111 * Copy elements from a 3-D point into a 3-D vector
113 static inline VmathVector3 vmathV3MakeFromP3_V( VmathPoint3 pnt );
116 * Set all elements of a 3-D vector to the same scalar value
118 static inline VmathVector3 vmathV3MakeFromScalar_V( float scalar );
121 * Set vector float data in a 3-D vector
123 static inline VmathVector3 vmathV3MakeFrom128_V( vec_float4 vf4 );
126 * Get vector float data from a 3-D vector
128 static inline vec_float4 vmathV3Get128_V( VmathVector3 vec );
131 * Set the x element of a 3-D vector
133 static inline void vmathV3SetX_V( VmathVector3 *result, float x );
136 * Set the y element of a 3-D vector
138 static inline void vmathV3SetY_V( VmathVector3 *result, float y );
141 * Set the z element of a 3-D vector
143 static inline void vmathV3SetZ_V( VmathVector3 *result, float z );
146 * Get the x element of a 3-D vector
148 static inline float vmathV3GetX_V( VmathVector3 vec );
151 * Get the y element of a 3-D vector
153 static inline float vmathV3GetY_V( VmathVector3 vec );
156 * Get the z element of a 3-D vector
158 static inline float vmathV3GetZ_V( VmathVector3 vec );
161 * Set an x, y, or z element of a 3-D vector by index
163 static inline void vmathV3SetElem_V( VmathVector3 *result, int idx, float value );
166 * Get an x, y, or z element of a 3-D vector by index
168 static inline float vmathV3GetElem_V( VmathVector3 vec, int idx );
171 * Add two 3-D vectors
173 static inline VmathVector3 vmathV3Add_V( VmathVector3 vec0, VmathVector3 vec1 );
176 * Subtract a 3-D vector from another 3-D vector
178 static inline VmathVector3 vmathV3Sub_V( VmathVector3 vec0, VmathVector3 vec1 );
181 * Add a 3-D vector to a 3-D point
183 static inline VmathPoint3 vmathV3AddP3_V( VmathVector3 vec, VmathPoint3 pnt );
186 * Multiply a 3-D vector by a scalar
188 static inline VmathVector3 vmathV3ScalarMul_V( VmathVector3 vec, float scalar );
191 * Divide a 3-D vector by a scalar
193 static inline VmathVector3 vmathV3ScalarDiv_V( VmathVector3 vec, float scalar );
196 * Negate all elements of a 3-D vector
198 static inline VmathVector3 vmathV3Neg_V( VmathVector3 vec );
203 static inline VmathVector3 vmathV3MakeXAxis_V( );
208 static inline VmathVector3 vmathV3MakeYAxis_V( );
213 static inline VmathVector3 vmathV3MakeZAxis_V( );
216 * Multiply two 3-D vectors per element
218 static inline VmathVector3 vmathV3MulPerElem_V( VmathVector3 vec0, VmathVector3 vec1 );
221 * Divide two 3-D vectors per element
223 * Floating-point behavior matches standard library function divf4.
225 static inline VmathVector3 vmathV3DivPerElem_V( VmathVector3 vec0, VmathVector3 vec1 );
228 * Compute the reciprocal of a 3-D vector per element
230 * Floating-point behavior matches standard library function recipf4.
232 static inline VmathVector3 vmathV3RecipPerElem_V( VmathVector3 vec );
235 * Compute the square root of a 3-D vector per element
237 * Floating-point behavior matches standard library function sqrtf4.
239 static inline VmathVector3 vmathV3SqrtPerElem_V( VmathVector3 vec );
242 * Compute the reciprocal square root of a 3-D vector per element
244 * Floating-point behavior matches standard library function rsqrtf4.
246 static inline VmathVector3 vmathV3RsqrtPerElem_V( VmathVector3 vec );
249 * Compute the absolute value of a 3-D vector per element
251 static inline VmathVector3 vmathV3AbsPerElem_V( VmathVector3 vec );
254 * Copy sign from one 3-D vector to another, per element
256 static inline VmathVector3 vmathV3CopySignPerElem_V( VmathVector3 vec0, VmathVector3 vec1 );
259 * Maximum of two 3-D vectors per element
261 static inline VmathVector3 vmathV3MaxPerElem_V( VmathVector3 vec0, VmathVector3 vec1 );
264 * Minimum of two 3-D vectors per element
266 static inline VmathVector3 vmathV3MinPerElem_V( VmathVector3 vec0, VmathVector3 vec1 );
269 * Maximum element of a 3-D vector
271 static inline float vmathV3MaxElem_V( VmathVector3 vec );
274 * Minimum element of a 3-D vector
276 static inline float vmathV3MinElem_V( VmathVector3 vec );
279 * Compute the sum of all elements of a 3-D vector
281 static inline float vmathV3Sum_V( VmathVector3 vec );
284 * Compute the dot product of two 3-D vectors
286 static inline float vmathV3Dot_V( VmathVector3 vec0, VmathVector3 vec1 );
289 * Compute the square of the length of a 3-D vector
291 static inline float vmathV3LengthSqr_V( VmathVector3 vec );
294 * Compute the length of a 3-D vector
296 static inline float vmathV3Length_V( VmathVector3 vec );
299 * Normalize a 3-D vector
301 * The result is unpredictable when all elements of vec are at or near zero.
303 static inline VmathVector3 vmathV3Normalize_V( VmathVector3 vec );
306 * Compute cross product of two 3-D vectors
308 static inline VmathVector3 vmathV3Cross_V( VmathVector3 vec0, VmathVector3 vec1 );
311 * Outer product of two 3-D vectors
313 static inline VmathMatrix3 vmathV3Outer_V( VmathVector3 vec0, VmathVector3 vec1 );
316 * Pre-multiply a row vector by a 3x3 matrix
318 * Slower than column post-multiply.
320 static inline VmathVector3 vmathV3RowMul_V( VmathVector3 vec, VmathMatrix3 mat );
323 * Cross-product matrix of a 3-D vector
325 static inline VmathMatrix3 vmathV3CrossMatrix_V( VmathVector3 vec );
328 * Create cross-product matrix and multiply
330 * Faster than separately creating a cross-product matrix and multiplying.
332 static inline VmathMatrix3 vmathV3CrossMatrixMul_V( VmathVector3 vec, VmathMatrix3 mat );
335 * Linear interpolation between two 3-D vectors
337 * Does not clamp t between 0 and 1.
339 static inline VmathVector3 vmathV3Lerp_V( float t, VmathVector3 vec0, VmathVector3 vec1 );
342 * Spherical linear interpolation between two 3-D vectors
344 * The result is unpredictable if the vectors point in opposite directions.
345 * Does not clamp t between 0 and 1.
347 static inline VmathVector3 vmathV3Slerp_V( float t, VmathVector3 unitVec0, VmathVector3 unitVec1 );
350 * Conditionally select between two 3-D vectors
352 * This function uses a conditional select instruction to avoid a branch.
354 static inline VmathVector3 vmathV3Select_V( VmathVector3 vec0, VmathVector3 vec1, unsigned int select1 );
357 * Store x, y, and z elements of a 3-D vector in the first three words of a quadword.
358 * The value of the fourth word (the word with the highest address) remains unchanged
360 static inline void vmathV3StoreXYZ_V( VmathVector3 vec, vec_float4 *quad );
363 * Load four three-float 3-D vectors, stored in three quadwords
365 static inline void vmathV3LoadXYZArray_V( VmathVector3 *vec0, VmathVector3 *vec1, VmathVector3 *vec2, VmathVector3 *vec3, const vec_float4 *threeQuads );
368 * Store four 3-D vectors in three quadwords
370 static inline void vmathV3StoreXYZArray_V( VmathVector3 vec0, VmathVector3 vec1, VmathVector3 vec2, VmathVector3 vec3, vec_float4 *threeQuads );
373 * Store eight 3-D vectors as half-floats
375 static inline void vmathV3StoreHalfFloats_V( VmathVector3 vec0, VmathVector3 vec1, VmathVector3 vec2, VmathVector3 vec3, VmathVector3 vec4, VmathVector3 vec5, VmathVector3 vec6, VmathVector3 vec7, vec_ushort8 *threeQuads );
377 #ifdef _VECTORMATH_DEBUG
382 * Function is only defined when _VECTORMATH_DEBUG is defined.
384 static inline void vmathV3Print_V( VmathVector3 vec );
387 * Print a 3-D vector and an associated string identifier
389 * Function is only defined when _VECTORMATH_DEBUG is defined.
391 static inline void vmathV3Prints_V( VmathVector3 vec, const char *name );
396 * Construct a 4-D vector from x, y, z, and w elements
398 static inline VmathVector4 vmathV4MakeFromElems_V( float x, float y, float z, float w );
401 * Construct a 4-D vector from a 3-D vector and a scalar
403 static inline VmathVector4 vmathV4MakeFromV3Scalar_V( VmathVector3 xyz, float w );
406 * Copy x, y, and z from a 3-D vector into a 4-D vector, and set w to 0
408 static inline VmathVector4 vmathV4MakeFromV3_V( VmathVector3 vec );
411 * Copy x, y, and z from a 3-D point into a 4-D vector, and set w to 1
413 static inline VmathVector4 vmathV4MakeFromP3_V( VmathPoint3 pnt );
416 * Copy elements from a quaternion into a 4-D vector
418 static inline VmathVector4 vmathV4MakeFromQ_V( VmathQuat quat );
421 * Set all elements of a 4-D vector to the same scalar value
423 static inline VmathVector4 vmathV4MakeFromScalar_V( float scalar );
426 * Set vector float data in a 4-D vector
428 static inline VmathVector4 vmathV4MakeFrom128_V( vec_float4 vf4 );
431 * Get vector float data from a 4-D vector
433 static inline vec_float4 vmathV4Get128_V( VmathVector4 vec );
436 * Set the x, y, and z elements of a 4-D vector
438 * This function does not change the w element.
440 static inline void vmathV4SetXYZ_V( VmathVector4 *result, VmathVector3 vec );
443 * Get the x, y, and z elements of a 4-D vector
445 static inline VmathVector3 vmathV4GetXYZ_V( VmathVector4 vec );
448 * Set the x element of a 4-D vector
450 static inline void vmathV4SetX_V( VmathVector4 *result, float x );
453 * Set the y element of a 4-D vector
455 static inline void vmathV4SetY_V( VmathVector4 *result, float y );
458 * Set the z element of a 4-D vector
460 static inline void vmathV4SetZ_V( VmathVector4 *result, float z );
463 * Set the w element of a 4-D vector
465 static inline void vmathV4SetW_V( VmathVector4 *result, float w );
468 * Get the x element of a 4-D vector
470 static inline float vmathV4GetX_V( VmathVector4 vec );
473 * Get the y element of a 4-D vector
475 static inline float vmathV4GetY_V( VmathVector4 vec );
478 * Get the z element of a 4-D vector
480 static inline float vmathV4GetZ_V( VmathVector4 vec );
483 * Get the w element of a 4-D vector
485 static inline float vmathV4GetW_V( VmathVector4 vec );
488 * Set an x, y, z, or w element of a 4-D vector by index
490 static inline void vmathV4SetElem_V( VmathVector4 *result, int idx, float value );
493 * Get an x, y, z, or w element of a 4-D vector by index
495 static inline float vmathV4GetElem_V( VmathVector4 vec, int idx );
498 * Add two 4-D vectors
500 static inline VmathVector4 vmathV4Add_V( VmathVector4 vec0, VmathVector4 vec1 );
503 * Subtract a 4-D vector from another 4-D vector
505 static inline VmathVector4 vmathV4Sub_V( VmathVector4 vec0, VmathVector4 vec1 );
508 * Multiply a 4-D vector by a scalar
510 static inline VmathVector4 vmathV4ScalarMul_V( VmathVector4 vec, float scalar );
513 * Divide a 4-D vector by a scalar
515 static inline VmathVector4 vmathV4ScalarDiv_V( VmathVector4 vec, float scalar );
518 * Negate all elements of a 4-D vector
520 static inline VmathVector4 vmathV4Neg_V( VmathVector4 vec );
525 static inline VmathVector4 vmathV4MakeXAxis_V( );
530 static inline VmathVector4 vmathV4MakeYAxis_V( );
535 static inline VmathVector4 vmathV4MakeZAxis_V( );
540 static inline VmathVector4 vmathV4MakeWAxis_V( );
543 * Multiply two 4-D vectors per element
545 static inline VmathVector4 vmathV4MulPerElem_V( VmathVector4 vec0, VmathVector4 vec1 );
548 * Divide two 4-D vectors per element
550 * Floating-point behavior matches standard library function divf4.
552 static inline VmathVector4 vmathV4DivPerElem_V( VmathVector4 vec0, VmathVector4 vec1 );
555 * Compute the reciprocal of a 4-D vector per element
557 * Floating-point behavior matches standard library function recipf4.
559 static inline VmathVector4 vmathV4RecipPerElem_V( VmathVector4 vec );
562 * Compute the square root of a 4-D vector per element
564 * Floating-point behavior matches standard library function sqrtf4.
566 static inline VmathVector4 vmathV4SqrtPerElem_V( VmathVector4 vec );
569 * Compute the reciprocal square root of a 4-D vector per element
571 * Floating-point behavior matches standard library function rsqrtf4.
573 static inline VmathVector4 vmathV4RsqrtPerElem_V( VmathVector4 vec );
576 * Compute the absolute value of a 4-D vector per element
578 static inline VmathVector4 vmathV4AbsPerElem_V( VmathVector4 vec );
581 * Copy sign from one 4-D vector to another, per element
583 static inline VmathVector4 vmathV4CopySignPerElem_V( VmathVector4 vec0, VmathVector4 vec1 );
586 * Maximum of two 4-D vectors per element
588 static inline VmathVector4 vmathV4MaxPerElem_V( VmathVector4 vec0, VmathVector4 vec1 );
591 * Minimum of two 4-D vectors per element
593 static inline VmathVector4 vmathV4MinPerElem_V( VmathVector4 vec0, VmathVector4 vec1 );
596 * Maximum element of a 4-D vector
598 static inline float vmathV4MaxElem_V( VmathVector4 vec );
601 * Minimum element of a 4-D vector
603 static inline float vmathV4MinElem_V( VmathVector4 vec );
606 * Compute the sum of all elements of a 4-D vector
608 static inline float vmathV4Sum_V( VmathVector4 vec );
611 * Compute the dot product of two 4-D vectors
613 static inline float vmathV4Dot_V( VmathVector4 vec0, VmathVector4 vec1 );
616 * Compute the square of the length of a 4-D vector
618 static inline float vmathV4LengthSqr_V( VmathVector4 vec );
621 * Compute the length of a 4-D vector
623 static inline float vmathV4Length_V( VmathVector4 vec );
626 * Normalize a 4-D vector
628 * The result is unpredictable when all elements of vec are at or near zero.
630 static inline VmathVector4 vmathV4Normalize_V( VmathVector4 vec );
633 * Outer product of two 4-D vectors
635 static inline VmathMatrix4 vmathV4Outer_V( VmathVector4 vec0, VmathVector4 vec1 );
638 * Linear interpolation between two 4-D vectors
640 * Does not clamp t between 0 and 1.
642 static inline VmathVector4 vmathV4Lerp_V( float t, VmathVector4 vec0, VmathVector4 vec1 );
645 * Spherical linear interpolation between two 4-D vectors
647 * The result is unpredictable if the vectors point in opposite directions.
648 * Does not clamp t between 0 and 1.
650 static inline VmathVector4 vmathV4Slerp_V( float t, VmathVector4 unitVec0, VmathVector4 unitVec1 );
653 * Conditionally select between two 4-D vectors
655 * This function uses a conditional select instruction to avoid a branch.
657 static inline VmathVector4 vmathV4Select_V( VmathVector4 vec0, VmathVector4 vec1, unsigned int select1 );
660 * Store four 4-D vectors as half-floats
662 static inline void vmathV4StoreHalfFloats_V( VmathVector4 vec0, VmathVector4 vec1, VmathVector4 vec2, VmathVector4 vec3, vec_ushort8 *twoQuads );
664 #ifdef _VECTORMATH_DEBUG
669 * Function is only defined when _VECTORMATH_DEBUG is defined.
671 static inline void vmathV4Print_V( VmathVector4 vec );
674 * Print a 4-D vector and an associated string identifier
676 * Function is only defined when _VECTORMATH_DEBUG is defined.
678 static inline void vmathV4Prints_V( VmathVector4 vec, const char *name );
683 * Construct a 3-D point from x, y, and z elements
685 static inline VmathPoint3 vmathP3MakeFromElems_V( float x, float y, float z );
688 * Copy elements from a 3-D vector into a 3-D point
690 static inline VmathPoint3 vmathP3MakeFromV3_V( VmathVector3 vec );
693 * Set all elements of a 3-D point to the same scalar value
695 static inline VmathPoint3 vmathP3MakeFromScalar_V( float scalar );
698 * Set vector float data in a 3-D point
700 static inline VmathPoint3 vmathP3MakeFrom128_V( vec_float4 vf4 );
703 * Get vector float data from a 3-D point
705 static inline vec_float4 vmathP3Get128_V( VmathPoint3 pnt );
708 * Set the x element of a 3-D point
710 static inline void vmathP3SetX_V( VmathPoint3 *result, float x );
713 * Set the y element of a 3-D point
715 static inline void vmathP3SetY_V( VmathPoint3 *result, float y );
718 * Set the z element of a 3-D point
720 static inline void vmathP3SetZ_V( VmathPoint3 *result, float z );
723 * Get the x element of a 3-D point
725 static inline float vmathP3GetX_V( VmathPoint3 pnt );
728 * Get the y element of a 3-D point
730 static inline float vmathP3GetY_V( VmathPoint3 pnt );
733 * Get the z element of a 3-D point
735 static inline float vmathP3GetZ_V( VmathPoint3 pnt );
738 * Set an x, y, or z element of a 3-D point by index
740 static inline void vmathP3SetElem_V( VmathPoint3 *result, int idx, float value );
743 * Get an x, y, or z element of a 3-D point by index
745 static inline float vmathP3GetElem_V( VmathPoint3 pnt, int idx );
748 * Subtract a 3-D point from another 3-D point
750 static inline VmathVector3 vmathP3Sub_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
753 * Add a 3-D point to a 3-D vector
755 static inline VmathPoint3 vmathP3AddV3_V( VmathPoint3 pnt, VmathVector3 vec );
758 * Subtract a 3-D vector from a 3-D point
760 static inline VmathPoint3 vmathP3SubV3_V( VmathPoint3 pnt, VmathVector3 vec );
763 * Multiply two 3-D points per element
765 static inline VmathPoint3 vmathP3MulPerElem_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
768 * Divide two 3-D points per element
770 * Floating-point behavior matches standard library function divf4.
772 static inline VmathPoint3 vmathP3DivPerElem_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
775 * Compute the reciprocal of a 3-D point per element
777 * Floating-point behavior matches standard library function recipf4.
779 static inline VmathPoint3 vmathP3RecipPerElem_V( VmathPoint3 pnt );
782 * Compute the square root of a 3-D point per element
784 * Floating-point behavior matches standard library function sqrtf4.
786 static inline VmathPoint3 vmathP3SqrtPerElem_V( VmathPoint3 pnt );
789 * Compute the reciprocal square root of a 3-D point per element
791 * Floating-point behavior matches standard library function rsqrtf4.
793 static inline VmathPoint3 vmathP3RsqrtPerElem_V( VmathPoint3 pnt );
796 * Compute the absolute value of a 3-D point per element
798 static inline VmathPoint3 vmathP3AbsPerElem_V( VmathPoint3 pnt );
801 * Copy sign from one 3-D point to another, per element
803 static inline VmathPoint3 vmathP3CopySignPerElem_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
806 * Maximum of two 3-D points per element
808 static inline VmathPoint3 vmathP3MaxPerElem_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
811 * Minimum of two 3-D points per element
813 static inline VmathPoint3 vmathP3MinPerElem_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
816 * Maximum element of a 3-D point
818 static inline float vmathP3MaxElem_V( VmathPoint3 pnt );
821 * Minimum element of a 3-D point
823 static inline float vmathP3MinElem_V( VmathPoint3 pnt );
826 * Compute the sum of all elements of a 3-D point
828 static inline float vmathP3Sum_V( VmathPoint3 pnt );
831 * Apply uniform scale to a 3-D point
833 static inline VmathPoint3 vmathP3Scale_V( VmathPoint3 pnt, float scaleVal );
836 * Apply non-uniform scale to a 3-D point
838 static inline VmathPoint3 vmathP3NonUniformScale_V( VmathPoint3 pnt, VmathVector3 scaleVec );
841 * Scalar projection of a 3-D point on a unit-length 3-D vector
843 static inline float vmathP3Projection_V( VmathPoint3 pnt, VmathVector3 unitVec );
846 * Compute the square of the distance of a 3-D point from the coordinate-system origin
848 static inline float vmathP3DistSqrFromOrigin_V( VmathPoint3 pnt );
851 * Compute the distance of a 3-D point from the coordinate-system origin
853 static inline float vmathP3DistFromOrigin_V( VmathPoint3 pnt );
856 * Compute the square of the distance between two 3-D points
858 static inline float vmathP3DistSqr_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
861 * Compute the distance between two 3-D points
863 static inline float vmathP3Dist_V( VmathPoint3 pnt0, VmathPoint3 pnt1 );
866 * Linear interpolation between two 3-D points
868 * Does not clamp t between 0 and 1.
870 static inline VmathPoint3 vmathP3Lerp_V( float t, VmathPoint3 pnt0, VmathPoint3 pnt1 );
873 * Conditionally select between two 3-D points
875 * This function uses a conditional select instruction to avoid a branch.
877 static inline VmathPoint3 vmathP3Select_V( VmathPoint3 pnt0, VmathPoint3 pnt1, unsigned int select1 );
880 * Store x, y, and z elements of a 3-D point in the first three words of a quadword.
881 * The value of the fourth word (the word with the highest address) remains unchanged
883 static inline void vmathP3StoreXYZ_V( VmathPoint3 pnt, vec_float4 *quad );
886 * Load four three-float 3-D points, stored in three quadwords
888 static inline void vmathP3LoadXYZArray_V( VmathPoint3 *pnt0, VmathPoint3 *pnt1, VmathPoint3 *pnt2, VmathPoint3 *pnt3, const vec_float4 *threeQuads );
891 * Store four 3-D points in three quadwords
893 static inline void vmathP3StoreXYZArray_V( VmathPoint3 pnt0, VmathPoint3 pnt1, VmathPoint3 pnt2, VmathPoint3 pnt3, vec_float4 *threeQuads );
896 * Store eight 3-D points as half-floats
898 static inline void vmathP3StoreHalfFloats_V( VmathPoint3 pnt0, VmathPoint3 pnt1, VmathPoint3 pnt2, VmathPoint3 pnt3, VmathPoint3 pnt4, VmathPoint3 pnt5, VmathPoint3 pnt6, VmathPoint3 pnt7, vec_ushort8 *threeQuads );
900 #ifdef _VECTORMATH_DEBUG
905 * Function is only defined when _VECTORMATH_DEBUG is defined.
907 static inline void vmathP3Print_V( VmathPoint3 pnt );
910 * Print a 3-D point and an associated string identifier
912 * Function is only defined when _VECTORMATH_DEBUG is defined.
914 static inline void vmathP3Prints_V( VmathPoint3 pnt, const char *name );
919 * Construct a quaternion from x, y, z, and w elements
921 static inline VmathQuat vmathQMakeFromElems_V( float x, float y, float z, float w );
924 * Construct a quaternion from a 3-D vector and a scalar
926 static inline VmathQuat vmathQMakeFromV3Scalar_V( VmathVector3 xyz, float w );
929 * Copy elements from a 4-D vector into a quaternion
931 static inline VmathQuat vmathQMakeFromV4_V( VmathVector4 vec );
934 * Convert a rotation matrix to a unit-length quaternion
936 static inline VmathQuat vmathQMakeFromM3_V( VmathMatrix3 rotMat );
939 * Set all elements of a quaternion to the same scalar value
941 static inline VmathQuat vmathQMakeFromScalar_V( float scalar );
944 * Set vector float data in a quaternion
946 static inline VmathQuat vmathQMakeFrom128_V( vec_float4 vf4 );
949 * Get vector float data from a quaternion
951 static inline vec_float4 vmathQGet128_V( VmathQuat quat );
954 * Set the x, y, and z elements of a quaternion
956 * This function does not change the w element.
958 static inline void vmathQSetXYZ_V( VmathQuat *result, VmathVector3 vec );
961 * Get the x, y, and z elements of a quaternion
963 static inline VmathVector3 vmathQGetXYZ_V( VmathQuat quat );
966 * Set the x element of a quaternion
968 static inline void vmathQSetX_V( VmathQuat *result, float x );
971 * Set the y element of a quaternion
973 static inline void vmathQSetY_V( VmathQuat *result, float y );
976 * Set the z element of a quaternion
978 static inline void vmathQSetZ_V( VmathQuat *result, float z );
981 * Set the w element of a quaternion
983 static inline void vmathQSetW_V( VmathQuat *result, float w );
986 * Get the x element of a quaternion
988 static inline float vmathQGetX_V( VmathQuat quat );
991 * Get the y element of a quaternion
993 static inline float vmathQGetY_V( VmathQuat quat );
996 * Get the z element of a quaternion
998 static inline float vmathQGetZ_V( VmathQuat quat );
1001 * Get the w element of a quaternion
1003 static inline float vmathQGetW_V( VmathQuat quat );
1006 * Set an x, y, z, or w element of a quaternion by index
1008 static inline void vmathQSetElem_V( VmathQuat *result, int idx, float value );
1011 * Get an x, y, z, or w element of a quaternion by index
1013 static inline float vmathQGetElem_V( VmathQuat quat, int idx );
1016 * Add two quaternions
1018 static inline VmathQuat vmathQAdd_V( VmathQuat quat0, VmathQuat quat1 );
1021 * Subtract a quaternion from another quaternion
1023 static inline VmathQuat vmathQSub_V( VmathQuat quat0, VmathQuat quat1 );
1026 * Multiply two quaternions
1028 static inline VmathQuat vmathQMul_V( VmathQuat quat0, VmathQuat quat1 );
1031 * Multiply a quaternion by a scalar
1033 static inline VmathQuat vmathQScalarMul_V( VmathQuat quat, float scalar );
1036 * Divide a quaternion by a scalar
1038 static inline VmathQuat vmathQScalarDiv_V( VmathQuat quat, float scalar );
1041 * Negate all elements of a quaternion
1043 static inline VmathQuat vmathQNeg_V( VmathQuat quat );
1046 * Construct an identity quaternion
1048 static inline VmathQuat vmathQMakeIdentity_V( );
1051 * Construct a quaternion to rotate between two unit-length 3-D vectors
1053 * The result is unpredictable if unitVec0 and unitVec1 point in opposite directions.
1055 static inline VmathQuat vmathQMakeRotationArc_V( VmathVector3 unitVec0, VmathVector3 unitVec1 );
1058 * Construct a quaternion to rotate around a unit-length 3-D vector
1060 static inline VmathQuat vmathQMakeRotationAxis_V( float radians, VmathVector3 unitVec );
1063 * Construct a quaternion to rotate around the x axis
1065 static inline VmathQuat vmathQMakeRotationX_V( float radians );
1068 * Construct a quaternion to rotate around the y axis
1070 static inline VmathQuat vmathQMakeRotationY_V( float radians );
1073 * Construct a quaternion to rotate around the z axis
1075 static inline VmathQuat vmathQMakeRotationZ_V( float radians );
1078 * Compute the conjugate of a quaternion
1080 static inline VmathQuat vmathQConj_V( VmathQuat quat );
1083 * Use a unit-length quaternion to rotate a 3-D vector
1085 static inline VmathVector3 vmathQRotate_V( VmathQuat unitQuat, VmathVector3 vec );
1088 * Compute the dot product of two quaternions
1090 static inline float vmathQDot_V( VmathQuat quat0, VmathQuat quat1 );
1093 * Compute the norm of a quaternion
1095 static inline float vmathQNorm_V( VmathQuat quat );
1098 * Compute the length of a quaternion
1100 static inline float vmathQLength_V( VmathQuat quat );
1103 * Normalize a quaternion
1105 * The result is unpredictable when all elements of quat are at or near zero.
1107 static inline VmathQuat vmathQNormalize_V( VmathQuat quat );
1110 * Linear interpolation between two quaternions
1112 * Does not clamp t between 0 and 1.
1114 static inline VmathQuat vmathQLerp_V( float t, VmathQuat quat0, VmathQuat quat1 );
1117 * Spherical linear interpolation between two quaternions
1119 * Interpolates along the shortest path between orientations.
1120 * Does not clamp t between 0 and 1.
1122 static inline VmathQuat vmathQSlerp_V( float t, VmathQuat unitQuat0, VmathQuat unitQuat1 );
1125 * Spherical quadrangle interpolation
1127 static inline VmathQuat vmathQSquad_V( float t, VmathQuat unitQuat0, VmathQuat unitQuat1, VmathQuat unitQuat2, VmathQuat unitQuat3 );
1130 * Conditionally select between two quaternions
1132 * This function uses a conditional select instruction to avoid a branch.
1134 static inline VmathQuat vmathQSelect_V( VmathQuat quat0, VmathQuat quat1, unsigned int select1 );
1136 #ifdef _VECTORMATH_DEBUG
1139 * Print a quaternion
1141 * Function is only defined when _VECTORMATH_DEBUG is defined.
1143 static inline void vmathQPrint_V( VmathQuat quat );
1146 * Print a quaternion and an associated string identifier
1148 * Function is only defined when _VECTORMATH_DEBUG is defined.
1150 static inline void vmathQPrints_V( VmathQuat quat, const char *name );
1155 * Construct a 3x3 matrix containing the specified columns
1157 static inline VmathMatrix3 vmathM3MakeFromCols_V( VmathVector3 col0, VmathVector3 col1, VmathVector3 col2 );
1160 * Construct a 3x3 rotation matrix from a unit-length quaternion
1162 static inline VmathMatrix3 vmathM3MakeFromQ_V( VmathQuat unitQuat );
1165 * Set all elements of a 3x3 matrix to the same scalar value
1167 static inline VmathMatrix3 vmathM3MakeFromScalar_V( float scalar );
1170 * Set column 0 of a 3x3 matrix
1172 static inline void vmathM3SetCol0_V( VmathMatrix3 *result, VmathVector3 col0 );
1175 * Set column 1 of a 3x3 matrix
1177 static inline void vmathM3SetCol1_V( VmathMatrix3 *result, VmathVector3 col1 );
1180 * Set column 2 of a 3x3 matrix
1182 static inline void vmathM3SetCol2_V( VmathMatrix3 *result, VmathVector3 col2 );
1185 * Get column 0 of a 3x3 matrix
1187 static inline VmathVector3 vmathM3GetCol0_V( VmathMatrix3 mat );
1190 * Get column 1 of a 3x3 matrix
1192 static inline VmathVector3 vmathM3GetCol1_V( VmathMatrix3 mat );
1195 * Get column 2 of a 3x3 matrix
1197 static inline VmathVector3 vmathM3GetCol2_V( VmathMatrix3 mat );
1200 * Set the column of a 3x3 matrix referred to by the specified index
1202 static inline void vmathM3SetCol_V( VmathMatrix3 *result, int col, VmathVector3 vec );
1205 * Set the row of a 3x3 matrix referred to by the specified index
1207 static inline void vmathM3SetRow_V( VmathMatrix3 *result, int row, VmathVector3 vec );
1210 * Get the column of a 3x3 matrix referred to by the specified index
1212 static inline VmathVector3 vmathM3GetCol_V( VmathMatrix3 mat, int col );
1215 * Get the row of a 3x3 matrix referred to by the specified index
1217 static inline VmathVector3 vmathM3GetRow_V( VmathMatrix3 mat, int row );
1220 * Set the element of a 3x3 matrix referred to by column and row indices
1222 static inline void vmathM3SetElem_V( VmathMatrix3 *result, int col, int row, float val );
1225 * Get the element of a 3x3 matrix referred to by column and row indices
1227 static inline float vmathM3GetElem_V( VmathMatrix3 mat, int col, int row );
1230 * Add two 3x3 matrices
1232 static inline VmathMatrix3 vmathM3Add_V( VmathMatrix3 mat0, VmathMatrix3 mat1 );
1235 * Subtract a 3x3 matrix from another 3x3 matrix
1237 static inline VmathMatrix3 vmathM3Sub_V( VmathMatrix3 mat0, VmathMatrix3 mat1 );
1240 * Negate all elements of a 3x3 matrix
1242 static inline VmathMatrix3 vmathM3Neg_V( VmathMatrix3 mat );
1245 * Multiply a 3x3 matrix by a scalar
1247 static inline VmathMatrix3 vmathM3ScalarMul_V( VmathMatrix3 mat, float scalar );
1250 * Multiply a 3x3 matrix by a 3-D vector
1252 static inline VmathVector3 vmathM3MulV3_V( VmathMatrix3 mat, VmathVector3 vec );
1255 * Multiply two 3x3 matrices
1257 static inline VmathMatrix3 vmathM3Mul_V( VmathMatrix3 mat0, VmathMatrix3 mat1 );
1260 * Construct an identity 3x3 matrix
1262 static inline VmathMatrix3 vmathM3MakeIdentity_V( );
1265 * Construct a 3x3 matrix to rotate around the x axis
1267 static inline VmathMatrix3 vmathM3MakeRotationX_V( float radians );
1270 * Construct a 3x3 matrix to rotate around the y axis
1272 static inline VmathMatrix3 vmathM3MakeRotationY_V( float radians );
1275 * Construct a 3x3 matrix to rotate around the z axis
1277 static inline VmathMatrix3 vmathM3MakeRotationZ_V( float radians );
1280 * Construct a 3x3 matrix to rotate around the x, y, and z axes
1282 static inline VmathMatrix3 vmathM3MakeRotationZYX_V( VmathVector3 radiansXYZ );
1285 * Construct a 3x3 matrix to rotate around a unit-length 3-D vector
1287 static inline VmathMatrix3 vmathM3MakeRotationAxis_V( float radians, VmathVector3 unitVec );
1290 * Construct a rotation matrix from a unit-length quaternion
1292 static inline VmathMatrix3 vmathM3MakeRotationQ_V( VmathQuat unitQuat );
1295 * Construct a 3x3 matrix to perform scaling
1297 static inline VmathMatrix3 vmathM3MakeScale_V( VmathVector3 scaleVec );
1300 * Append (post-multiply) a scale transformation to a 3x3 matrix
1302 * Faster than creating and multiplying a scale transformation matrix.
1304 static inline VmathMatrix3 vmathM3AppendScale_V( VmathMatrix3 mat, VmathVector3 scaleVec );
1307 * Prepend (pre-multiply) a scale transformation to a 3x3 matrix
1309 * Faster than creating and multiplying a scale transformation matrix.
1311 static inline VmathMatrix3 vmathM3PrependScale_V( VmathVector3 scaleVec, VmathMatrix3 mat );
1314 * Multiply two 3x3 matrices per element
1316 static inline VmathMatrix3 vmathM3MulPerElem_V( VmathMatrix3 mat0, VmathMatrix3 mat1 );
1319 * Compute the absolute value of a 3x3 matrix per element
1321 static inline VmathMatrix3 vmathM3AbsPerElem_V( VmathMatrix3 mat );
1324 * Transpose of a 3x3 matrix
1326 static inline VmathMatrix3 vmathM3Transpose_V( VmathMatrix3 mat );
1329 * Compute the inverse of a 3x3 matrix
1331 * Result is unpredictable when the determinant of mat is equal to or near 0.
1333 static inline VmathMatrix3 vmathM3Inverse_V( VmathMatrix3 mat );
1336 * Determinant of a 3x3 matrix
1338 static inline float vmathM3Determinant_V( VmathMatrix3 mat );
1341 * Conditionally select between two 3x3 matrices
1343 * This function uses a conditional select instruction to avoid a branch.
1345 static inline VmathMatrix3 vmathM3Select_V( VmathMatrix3 mat0, VmathMatrix3 mat1, unsigned int select1 );
1347 #ifdef _VECTORMATH_DEBUG
1350 * Print a 3x3 matrix
1352 * Function is only defined when _VECTORMATH_DEBUG is defined.
1354 static inline void vmathM3Print_V( VmathMatrix3 mat );
1357 * Print a 3x3 matrix and an associated string identifier
1359 * Function is only defined when _VECTORMATH_DEBUG is defined.
1361 static inline void vmathM3Prints_V( VmathMatrix3 mat, const char *name );
1366 * Construct a 4x4 matrix containing the specified columns
1368 static inline VmathMatrix4 vmathM4MakeFromCols_V( VmathVector4 col0, VmathVector4 col1, VmathVector4 col2, VmathVector4 col3 );
1371 * Construct a 4x4 matrix from a 3x4 transformation matrix
1373 static inline VmathMatrix4 vmathM4MakeFromT3_V( VmathTransform3 mat );
1376 * Construct a 4x4 matrix from a 3x3 matrix and a 3-D vector
1378 static inline VmathMatrix4 vmathM4MakeFromM3V3_V( VmathMatrix3 mat, VmathVector3 translateVec );
1381 * Construct a 4x4 matrix from a unit-length quaternion and a 3-D vector
1383 static inline VmathMatrix4 vmathM4MakeFromQV3_V( VmathQuat unitQuat, VmathVector3 translateVec );
1386 * Set all elements of a 4x4 matrix to the same scalar value
1388 static inline VmathMatrix4 vmathM4MakeFromScalar_V( float scalar );
1391 * Set the upper-left 3x3 submatrix
1393 * This function does not change the bottom row elements.
1395 static inline void vmathM4SetUpper3x3_V( VmathMatrix4 *result, VmathMatrix3 mat3 );
1398 * Get the upper-left 3x3 submatrix of a 4x4 matrix
1400 static inline VmathMatrix3 vmathM4GetUpper3x3_V( VmathMatrix4 mat );
1403 * Set translation component
1405 * This function does not change the bottom row elements.
1407 static inline void vmathM4SetTranslation_V( VmathMatrix4 *result, VmathVector3 translateVec );
1410 * Get the translation component of a 4x4 matrix
1412 static inline VmathVector3 vmathM4GetTranslation_V( VmathMatrix4 mat );
1415 * Set column 0 of a 4x4 matrix
1417 static inline void vmathM4SetCol0_V( VmathMatrix4 *result, VmathVector4 col0 );
1420 * Set column 1 of a 4x4 matrix
1422 static inline void vmathM4SetCol1_V( VmathMatrix4 *result, VmathVector4 col1 );
1425 * Set column 2 of a 4x4 matrix
1427 static inline void vmathM4SetCol2_V( VmathMatrix4 *result, VmathVector4 col2 );
1430 * Set column 3 of a 4x4 matrix
1432 static inline void vmathM4SetCol3_V( VmathMatrix4 *result, VmathVector4 col3 );
1435 * Get column 0 of a 4x4 matrix
1437 static inline VmathVector4 vmathM4GetCol0_V( VmathMatrix4 mat );
1440 * Get column 1 of a 4x4 matrix
1442 static inline VmathVector4 vmathM4GetCol1_V( VmathMatrix4 mat );
1445 * Get column 2 of a 4x4 matrix
1447 static inline VmathVector4 vmathM4GetCol2_V( VmathMatrix4 mat );
1450 * Get column 3 of a 4x4 matrix
1452 static inline VmathVector4 vmathM4GetCol3_V( VmathMatrix4 mat );
1455 * Set the column of a 4x4 matrix referred to by the specified index
1457 static inline void vmathM4SetCol_V( VmathMatrix4 *result, int col, VmathVector4 vec );
1460 * Set the row of a 4x4 matrix referred to by the specified index
1462 static inline void vmathM4SetRow_V( VmathMatrix4 *result, int row, VmathVector4 vec );
1465 * Get the column of a 4x4 matrix referred to by the specified index
1467 static inline VmathVector4 vmathM4GetCol_V( VmathMatrix4 mat, int col );
1470 * Get the row of a 4x4 matrix referred to by the specified index
1472 static inline VmathVector4 vmathM4GetRow_V( VmathMatrix4 mat, int row );
1475 * Set the element of a 4x4 matrix referred to by column and row indices
1477 static inline void vmathM4SetElem_V( VmathMatrix4 *result, int col, int row, float val );
1480 * Get the element of a 4x4 matrix referred to by column and row indices
1482 static inline float vmathM4GetElem_V( VmathMatrix4 mat, int col, int row );
1485 * Add two 4x4 matrices
1487 static inline VmathMatrix4 vmathM4Add_V( VmathMatrix4 mat0, VmathMatrix4 mat1 );
1490 * Subtract a 4x4 matrix from another 4x4 matrix
1492 static inline VmathMatrix4 vmathM4Sub_V( VmathMatrix4 mat0, VmathMatrix4 mat1 );
1495 * Negate all elements of a 4x4 matrix
1497 static inline VmathMatrix4 vmathM4Neg_V( VmathMatrix4 mat );
1500 * Multiply a 4x4 matrix by a scalar
1502 static inline VmathMatrix4 vmathM4ScalarMul_V( VmathMatrix4 mat, float scalar );
1505 * Multiply a 4x4 matrix by a 4-D vector
1507 static inline VmathVector4 vmathM4MulV4_V( VmathMatrix4 mat, VmathVector4 vec );
1510 * Multiply a 4x4 matrix by a 3-D vector
1512 static inline VmathVector4 vmathM4MulV3_V( VmathMatrix4 mat, VmathVector3 vec );
1515 * Multiply a 4x4 matrix by a 3-D point
1517 static inline VmathVector4 vmathM4MulP3_V( VmathMatrix4 mat, VmathPoint3 pnt );
1520 * Multiply two 4x4 matrices
1522 static inline VmathMatrix4 vmathM4Mul_V( VmathMatrix4 mat0, VmathMatrix4 mat1 );
1525 * Multiply a 4x4 matrix by a 3x4 transformation matrix
1527 static inline VmathMatrix4 vmathM4MulT3_V( VmathMatrix4 mat, VmathTransform3 tfrm );
1530 * Construct an identity 4x4 matrix
1532 static inline VmathMatrix4 vmathM4MakeIdentity_V( );
1535 * Construct a 4x4 matrix to rotate around the x axis
1537 static inline VmathMatrix4 vmathM4MakeRotationX_V( float radians );
1540 * Construct a 4x4 matrix to rotate around the y axis
1542 static inline VmathMatrix4 vmathM4MakeRotationY_V( float radians );
1545 * Construct a 4x4 matrix to rotate around the z axis
1547 static inline VmathMatrix4 vmathM4MakeRotationZ_V( float radians );
1550 * Construct a 4x4 matrix to rotate around the x, y, and z axes
1552 static inline VmathMatrix4 vmathM4MakeRotationZYX_V( VmathVector3 radiansXYZ );
1555 * Construct a 4x4 matrix to rotate around a unit-length 3-D vector
1557 static inline VmathMatrix4 vmathM4MakeRotationAxis_V( float radians, VmathVector3 unitVec );
1560 * Construct a rotation matrix from a unit-length quaternion
1562 static inline VmathMatrix4 vmathM4MakeRotationQ_V( VmathQuat unitQuat );
1565 * Construct a 4x4 matrix to perform scaling
1567 static inline VmathMatrix4 vmathM4MakeScale_V( VmathVector3 scaleVec );
1570 * Construct a 4x4 matrix to perform translation
1572 static inline VmathMatrix4 vmathM4MakeTranslation_V( VmathVector3 translateVec );
1575 * Construct viewing matrix based on eye position, position looked at, and up direction
1577 static inline VmathMatrix4 vmathM4MakeLookAt_V( VmathPoint3 eyePos, VmathPoint3 lookAtPos, VmathVector3 upVec );
1580 * Construct a perspective projection matrix
1582 static inline VmathMatrix4 vmathM4MakePerspective_V( float fovyRadians, float aspect, float zNear, float zFar );
1585 * Construct a perspective projection matrix based on frustum
1587 static inline VmathMatrix4 vmathM4MakeFrustum_V( float left, float right, float bottom, float top, float zNear, float zFar );
1590 * Construct an orthographic projection matrix
1592 static inline VmathMatrix4 vmathM4MakeOrthographic_V( float left, float right, float bottom, float top, float zNear, float zFar );
1595 * Append (post-multiply) a scale transformation to a 4x4 matrix
1597 * Faster than creating and multiplying a scale transformation matrix.
1599 static inline VmathMatrix4 vmathM4AppendScale_V( VmathMatrix4 mat, VmathVector3 scaleVec );
1602 * Prepend (pre-multiply) a scale transformation to a 4x4 matrix
1604 * Faster than creating and multiplying a scale transformation matrix.
1606 static inline VmathMatrix4 vmathM4PrependScale_V( VmathVector3 scaleVec, VmathMatrix4 mat );
1609 * Multiply two 4x4 matrices per element
1611 static inline VmathMatrix4 vmathM4MulPerElem_V( VmathMatrix4 mat0, VmathMatrix4 mat1 );
1614 * Compute the absolute value of a 4x4 matrix per element
1616 static inline VmathMatrix4 vmathM4AbsPerElem_V( VmathMatrix4 mat );
1619 * Transpose of a 4x4 matrix
1621 static inline VmathMatrix4 vmathM4Transpose_V( VmathMatrix4 mat );
1624 * Compute the inverse of a 4x4 matrix
1626 * Result is unpredictable when the determinant of mat is equal to or near 0.
1628 static inline VmathMatrix4 vmathM4Inverse_V( VmathMatrix4 mat );
1631 * Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix
1633 * 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.
1635 static inline VmathMatrix4 vmathM4AffineInverse_V( VmathMatrix4 mat );
1638 * Compute the inverse of a 4x4 matrix, which is expected to be an affine matrix with an orthogonal upper-left 3x3 submatrix
1640 * This can be used to achieve better performance than a general inverse when the specified 4x4 matrix meets the given restrictions.
1642 static inline VmathMatrix4 vmathM4OrthoInverse_V( VmathMatrix4 mat );
1645 * Determinant of a 4x4 matrix
1647 static inline float vmathM4Determinant_V( VmathMatrix4 mat );
1650 * Conditionally select between two 4x4 matrices
1652 * This function uses a conditional select instruction to avoid a branch.
1654 static inline VmathMatrix4 vmathM4Select_V( VmathMatrix4 mat0, VmathMatrix4 mat1, unsigned int select1 );
1656 #ifdef _VECTORMATH_DEBUG
1659 * Print a 4x4 matrix
1661 * Function is only defined when _VECTORMATH_DEBUG is defined.
1663 static inline void vmathM4Print_V( VmathMatrix4 mat );
1666 * Print a 4x4 matrix and an associated string identifier
1668 * Function is only defined when _VECTORMATH_DEBUG is defined.
1670 static inline void vmathM4Prints_V( VmathMatrix4 mat, const char *name );
1675 * Construct a 3x4 transformation matrix containing the specified columns
1677 static inline VmathTransform3 vmathT3MakeFromCols_V( VmathVector3 col0, VmathVector3 col1, VmathVector3 col2, VmathVector3 col3 );
1680 * Construct a 3x4 transformation matrix from a 3x3 matrix and a 3-D vector
1682 static inline VmathTransform3 vmathT3MakeFromM3V3_V( VmathMatrix3 tfrm, VmathVector3 translateVec );
1685 * Construct a 3x4 transformation matrix from a unit-length quaternion and a 3-D vector
1687 static inline VmathTransform3 vmathT3MakeFromQV3_V( VmathQuat unitQuat, VmathVector3 translateVec );
1690 * Set all elements of a 3x4 transformation matrix to the same scalar value
1692 static inline VmathTransform3 vmathT3MakeFromScalar_V( float scalar );
1695 * Set the upper-left 3x3 submatrix
1697 static inline void vmathT3SetUpper3x3_V( VmathTransform3 *result, VmathMatrix3 mat3 );
1700 * Get the upper-left 3x3 submatrix of a 3x4 transformation matrix
1702 static inline VmathMatrix3 vmathT3GetUpper3x3_V( VmathTransform3 tfrm );
1705 * Set translation component
1707 static inline void vmathT3SetTranslation_V( VmathTransform3 *result, VmathVector3 translateVec );
1710 * Get the translation component of a 3x4 transformation matrix
1712 static inline VmathVector3 vmathT3GetTranslation_V( VmathTransform3 tfrm );
1715 * Set column 0 of a 3x4 transformation matrix
1717 static inline void vmathT3SetCol0_V( VmathTransform3 *result, VmathVector3 col0 );
1720 * Set column 1 of a 3x4 transformation matrix
1722 static inline void vmathT3SetCol1_V( VmathTransform3 *result, VmathVector3 col1 );
1725 * Set column 2 of a 3x4 transformation matrix
1727 static inline void vmathT3SetCol2_V( VmathTransform3 *result, VmathVector3 col2 );
1730 * Set column 3 of a 3x4 transformation matrix
1732 static inline void vmathT3SetCol3_V( VmathTransform3 *result, VmathVector3 col3 );
1735 * Get column 0 of a 3x4 transformation matrix
1737 static inline VmathVector3 vmathT3GetCol0_V( VmathTransform3 tfrm );
1740 * Get column 1 of a 3x4 transformation matrix
1742 static inline VmathVector3 vmathT3GetCol1_V( VmathTransform3 tfrm );
1745 * Get column 2 of a 3x4 transformation matrix
1747 static inline VmathVector3 vmathT3GetCol2_V( VmathTransform3 tfrm );
1750 * Get column 3 of a 3x4 transformation matrix
1752 static inline VmathVector3 vmathT3GetCol3_V( VmathTransform3 tfrm );
1755 * Set the column of a 3x4 transformation matrix referred to by the specified index
1757 static inline void vmathT3SetCol_V( VmathTransform3 *result, int col, VmathVector3 vec );
1760 * Set the row of a 3x4 transformation matrix referred to by the specified index
1762 static inline void vmathT3SetRow_V( VmathTransform3 *result, int row, VmathVector4 vec );
1765 * Get the column of a 3x4 transformation matrix referred to by the specified index
1767 static inline VmathVector3 vmathT3GetCol_V( VmathTransform3 tfrm, int col );
1770 * Get the row of a 3x4 transformation matrix referred to by the specified index
1772 static inline VmathVector4 vmathT3GetRow_V( VmathTransform3 tfrm, int row );
1775 * Set the element of a 3x4 transformation matrix referred to by column and row indices
1777 static inline void vmathT3SetElem_V( VmathTransform3 *result, int col, int row, float val );
1780 * Get the element of a 3x4 transformation matrix referred to by column and row indices
1782 static inline float vmathT3GetElem_V( VmathTransform3 tfrm, int col, int row );
1785 * Multiply a 3x4 transformation matrix by a 3-D vector
1787 static inline VmathVector3 vmathT3MulV3_V( VmathTransform3 tfrm, VmathVector3 vec );
1790 * Multiply a 3x4 transformation matrix by a 3-D point
1792 static inline VmathPoint3 vmathT3MulP3_V( VmathTransform3 tfrm, VmathPoint3 pnt );
1795 * Multiply two 3x4 transformation matrices
1797 static inline VmathTransform3 vmathT3Mul_V( VmathTransform3 tfrm0, VmathTransform3 tfrm1 );
1800 * Construct an identity 3x4 transformation matrix
1802 static inline VmathTransform3 vmathT3MakeIdentity_V( );
1805 * Construct a 3x4 transformation matrix to rotate around the x axis
1807 static inline VmathTransform3 vmathT3MakeRotationX_V( float radians );
1810 * Construct a 3x4 transformation matrix to rotate around the y axis
1812 static inline VmathTransform3 vmathT3MakeRotationY_V( float radians );
1815 * Construct a 3x4 transformation matrix to rotate around the z axis
1817 static inline VmathTransform3 vmathT3MakeRotationZ_V( float radians );
1820 * Construct a 3x4 transformation matrix to rotate around the x, y, and z axes
1822 static inline VmathTransform3 vmathT3MakeRotationZYX_V( VmathVector3 radiansXYZ );
1825 * Construct a 3x4 transformation matrix to rotate around a unit-length 3-D vector
1827 static inline VmathTransform3 vmathT3MakeRotationAxis_V( float radians, VmathVector3 unitVec );
1830 * Construct a rotation matrix from a unit-length quaternion
1832 static inline VmathTransform3 vmathT3MakeRotationQ_V( VmathQuat unitQuat );
1835 * Construct a 3x4 transformation matrix to perform scaling
1837 static inline VmathTransform3 vmathT3MakeScale_V( VmathVector3 scaleVec );
1840 * Construct a 3x4 transformation matrix to perform translation
1842 static inline VmathTransform3 vmathT3MakeTranslation_V( VmathVector3 translateVec );
1845 * Append (post-multiply) a scale transformation to a 3x4 transformation matrix
1847 * Faster than creating and multiplying a scale transformation matrix.
1849 static inline VmathTransform3 vmathT3AppendScale_V( VmathTransform3 tfrm, VmathVector3 scaleVec );
1852 * Prepend (pre-multiply) a scale transformation to a 3x4 transformation matrix
1854 * Faster than creating and multiplying a scale transformation matrix.
1856 static inline VmathTransform3 vmathT3PrependScale_V( VmathVector3 scaleVec, VmathTransform3 tfrm );
1859 * Multiply two 3x4 transformation matrices per element
1861 static inline VmathTransform3 vmathT3MulPerElem_V( VmathTransform3 tfrm0, VmathTransform3 tfrm1 );
1864 * Compute the absolute value of a 3x4 transformation matrix per element
1866 static inline VmathTransform3 vmathT3AbsPerElem_V( VmathTransform3 tfrm );
1869 * Inverse of a 3x4 transformation matrix
1871 * Result is unpredictable when the determinant of the left 3x3 submatrix is equal to or near 0.
1873 static inline VmathTransform3 vmathT3Inverse_V( VmathTransform3 tfrm );
1876 * Compute the inverse of a 3x4 transformation matrix, expected to have an orthogonal upper-left 3x3 submatrix
1878 * This can be used to achieve better performance than a general inverse when the specified 3x4 transformation matrix meets the given restrictions.
1880 static inline VmathTransform3 vmathT3OrthoInverse_V( VmathTransform3 tfrm );
1883 * Conditionally select between two 3x4 transformation matrices
1885 * This function uses a conditional select instruction to avoid a branch.
1887 static inline VmathTransform3 vmathT3Select_V( VmathTransform3 tfrm0, VmathTransform3 tfrm1, unsigned int select1 );
1889 #ifdef _VECTORMATH_DEBUG
1892 * Print a 3x4 transformation matrix
1894 * Function is only defined when _VECTORMATH_DEBUG is defined.
1896 static inline void vmathT3Print_V( VmathTransform3 tfrm );
1899 * Print a 3x4 transformation matrix and an associated string identifier
1901 * Function is only defined when _VECTORMATH_DEBUG is defined.
1903 static inline void vmathT3Prints_V( VmathTransform3 tfrm, const char *name );
1909 #endif /* __cplusplus */
1911 #include "vectormath_aos.h"
1912 #include "vec_aos_v.h"
1913 #include "quat_aos_v.h"
1914 #include "mat_aos_v.h"