root/trunk/orca/math3d.h
| Revision 42, 2.2 kB (checked in by krobillard, 3 years ago) |
|---|
| Line | |
|---|---|
| 1 | #ifndef MATH3D_H |
| 2 | #define MATH3D_H |
| 3 | /*============================================================================ |
| 4 | ORCA Interpreter |
| 5 | Copyright (C) 2005-2006 Karl Robillard |
| 6 | |
| 7 | This library is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU Lesser General Public |
| 9 | License as published by the Free Software Foundation; either |
| 10 | version 2.1 of the License, or (at your option) any later version. |
| 11 | |
| 12 | This library is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | Lesser General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU Lesser General Public |
| 18 | License along with this library; if not, write to the Free Software |
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | ===========================================================================*/ |
| 21 | |
| 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | |
| 28 | #define OR_PI 3.14159265358979323846 |
| 29 | #define degToRad(deg) ((OR_PI/180.0)*(double)(deg)) |
| 30 | #define radToDeg(rad) ((180.0/OR_PI)*(double)(rad)) |
| 31 | |
| 32 | |
| 33 | /* Matrix functions */ |
| 34 | |
| 35 | void orLoadIdentity( float* ); |
| 36 | void orLoadRotation( float* mat, const float* axis, float radians ); |
| 37 | void orMatrixMult( const float* a, const float* b, float* result ); |
| 38 | void orTransLocal( float* mat, float x, float y, float z ); |
| 39 | void orMatrixTranspose( float* mat, const float* a ); |
| 40 | void orMatrixInverse( float* mat, const float* a ); |
| 41 | |
| 42 | |
| 43 | /* Vector functions */ |
| 44 | |
| 45 | float orDistance( const float* vecA, const float* vecB ); |
| 46 | void orTransform( float* pnt, const float* mat ); |
| 47 | void orTransform3x3( float* pnt, const float* mat ); |
| 48 | void orReflect( const float* a, const float* b, float* result ); |
| 49 | void orNormalize( float* vec ); |
| 50 | |
| 51 | #define orDot(a,b) ((a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2])) |
| 52 | |
| 53 | #define orCross(a,b,res) \ |
| 54 | res[0] = (a[1] * b[2]) - (a[2] * b[1]); \ |
| 55 | res[1] = (a[2] * b[0]) - (a[0] * b[2]); \ |
| 56 | res[2] = (a[0] * b[1]) - (a[1] * b[0]) |
| 57 | |
| 58 | |
| 59 | /* ORCA integration functions */ |
| 60 | |
| 61 | int orLoadVectorBlock( float*, int count, OValue* blkV ); |
| 62 | |
| 63 | |
| 64 | #ifdef __cplusplus |
| 65 | } |
| 66 | #endif |
| 67 | |
| 68 | |
| 69 | #endif /* MATH3D_H */ |
Note: See TracBrowser
for help on using the browser.
