aboutsummaryrefslogtreecommitdiff
path: root/tools/planetest/linmath.h
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2016-12-13 20:56:35 -0500
committercnlohr <lohr85@gmail.com>2016-12-13 20:56:35 -0500
commit3da18b263cb0cf1814cef374771d242c9591ed2d (patch)
treecedb69518f6361417d74faa05eebc0805ed731f3 /tools/planetest/linmath.h
parentcebb93ee6b927f277d9f1d33c8b354aa440ebf44 (diff)
downloadlibsurvive-3da18b263cb0cf1814cef374771d242c9591ed2d.tar.gz
libsurvive-3da18b263cb0cf1814cef374771d242c9591ed2d.tar.bz2
Add charles' camfind (DOES NOT WORK!!!)
Diffstat (limited to 'tools/planetest/linmath.h')
-rw-r--r--tools/planetest/linmath.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/tools/planetest/linmath.h b/tools/planetest/linmath.h
new file mode 100644
index 0000000..344a547
--- /dev/null
+++ b/tools/planetest/linmath.h
@@ -0,0 +1,59 @@
+//Copyright 2013 <>< C. N. Lohr. This file licensed under the terms of the MIT license.
+
+#ifndef _LINMATH_H
+#define _LINMATH_H
+
+//Yes, I know it's kind of arbitrary.
+#define DEFAULT_EPSILON 0.001
+
+
+//NOTE: Inputs may never be output with cross product.
+void cross3d( float * out, const float * a, const float * b );
+
+void sub3d( float * out, const float * a, const float * b );
+
+void add3d( float * out, const float * a, const float * b );
+
+void scale3d( float * out, const float * a, float scalar );
+
+void normalize3d( float * out, const float * in );
+
+float dot3d( const float * a, const float * b );
+
+//Returns 0 if equal. If either argument is null, 0 will ALWAYS be returned.
+int compare3d( const float * a, const float * b, float epsilon );
+
+void copy3d( float * out, const float * in );
+
+
+
+
+//Quaternion things...
+
+void quatsetnone( float * q );
+void quatcopy( float * qout, const float * qin );
+void quatfromeuler( float * q, const float * euler );
+void quattoeuler( float * euler, const float * q );
+void quatfromaxisangle( float * q, const float * axis, float radians );
+float quatmagnitude( const float * q );
+float quatinvsqmagnitude( const float * q );
+void quatnormalize( float * qout, const float * qin ); //Safe for in to be same as out.
+void quattomatrix( float * matrix44, const float * q );
+void quatgetconjugate( float * qout, const float * qin );
+void quatgetreciprocal( float * qout, const float * qin );
+void quatsub( float * qout, const float * a, const float * b );
+void quatadd( float * qout, const float * a, const float * b );
+void quatrotateabout( float * qout, const float * a, const float * b ); //same as quat multiply, not piecewise multiply.
+void quatscale( float * qout, const float * qin, float s );
+float quatinnerproduct( const float * qa, const float * qb );
+void quatouterproduct( float * outvec3, float * qa, float * qb );
+void quatevenproduct( float * q, float * qa, float * qb );
+void quatoddproduct( float * outvec3, float * qa, float * qb );
+void quatslerp( float * q, const float * qa, const float * qb, float t );
+void quatrotatevector( float * vec3out, const float * quat, const float * vec3in );
+
+
+#endif
+
+
+