+++ /dev/null
-/****************************************************************************************/\r
-/* XFORM3D.H */\r
-/* */\r
-/* Author: */\r
-/* Description: 3D transform interface */\r
-/* */\r
-/* The contents of this file are subject to the Genesis3D Public License */\r
-/* Version 1.01 (the "License"); you may not use this file except in */\r
-/* compliance with the License. You may obtain a copy of the License at */\r
-/* http://www.genesis3d.com */\r
-/* */\r
-/* Software distributed under the License is distributed on an "AS IS" */\r
-/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */\r
-/* the License for the specific language governing rights and limitations */\r
-/* under the License. */\r
-/* */\r
-/* The Original Code is Genesis3D, released March 25, 1999. */\r
-/* Genesis3D Version 1.1 released November 15, 1999 */\r
-/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */\r
-/* */\r
-/****************************************************************************************/\r
-#ifndef GE_XFORM_H\r
-#define GE_XFORM_H\r
-\r
-\r
-#include "Vec3d.h"\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-typedef struct\r
-{ \r
- geFloat AX,AY,AZ; // e[0][0],e[0][1],e[0][2]\r
- geFloat BX,BY,BZ; // e[1][0],e[1][1],e[1][2]\r
- geFloat CX,CY,CZ; // e[2][0],e[2][1],e[2][2]\r
- geVec3d Translation; // e[0][3],e[1][3],e[2][3]\r
- // 0,0,0,1 // e[3][0],e[3][1],e[3][2]\r
-} geXForm3d;\r
-\r
-/* this is essentially a 'standard' 4x4 transform matrix,\r
- with the bottom row always 0,0,0,1\r
-\r
- | AX, AY, AZ, Translation.X | \r
- | BX, BY, BZ, Translation.Y | \r
- | CX, CY, CZ, Translation.Z | \r
- | 0, 0, 0, 1 | \r
-*/\r
-\r
-// all geXForm3d_Set* functions return a right-handed transform.\r
-\r
-#define GEXFORM3D_MINIMUM_SCALE (0.00001f)\r
-\r
-\r
-GENESISAPI void GENESISCC geXForm3d_Copy(\r
- const geXForm3d *Src, \r
- geXForm3d *Dst);\r
- // copies Src to Dst. \r
-\r
-GENESISAPI geBoolean GENESISCC geXForm3d_IsValid(const geXForm3d *M);\r
- // returns GE_TRUE if M is 'valid' \r
- // 'valid' means that M is non NULL, and there are no NAN's in the matrix.\r
-\r
-//MRB BEGIN\r
-GENESISAPI geBoolean GENESISCC geXForm3d_IsIdentity(const geXForm3d *M);\r
- // returns GE_TRUE if M is an identity matrix \r
-//MRB END\r
-\r
-GENESISAPI geBoolean GENESISCC geXForm3d_IsOrthonormal(const geXForm3d *M);\r
- // returns GE_TRUE if M is orthonormal \r
- // (if the rows and columns are all normalized (transform has no scaling or shearing)\r
- // and is orthogonal (row1 cross row2 = row3 & col1 cross col2 = col3)\r
- // * does not check for right-handed convention *\r
-\r
-GENESISAPI geBoolean GENESISCC geXForm3d_IsOrthogonal(const geXForm3d *M);\r
- // returns GE_TRUE if M is orthogonal\r
- // (row1 cross row2 = row3 & col1 cross col2 = col3)\r
- // * does not check for right-handed convention *\r
-\r
-GENESISAPI void GENESISCC geXForm3d_Orthonormalize(geXForm3d *M);\r
- // essentially removes scaling (or other distortions) from \r
- // an orthogonal (or nearly orthogonal) matrix \r
- // returns a right-handed matrix\r
-\r
-\r
-GENESISAPI void GENESISCC geXForm3d_SetIdentity(geXForm3d *M); \r
- // sets M to an identity matrix (clears it)\r
- \r
-GENESISAPI void GENESISCC geXForm3d_SetXRotation(geXForm3d *M,geFloat RadianAngle);\r
- // sets up a transform that rotates RadianAngle about X axis\r
- // all existing contents of M are replaced\r
- \r
-GENESISAPI void GENESISCC geXForm3d_SetYRotation(geXForm3d *M,geFloat RadianAngle);\r
- // sets up a transform that rotates RadianAngle about Y axis\r
- // all existing contents of M are replaced\r
-\r
-GENESISAPI void GENESISCC geXForm3d_SetZRotation(geXForm3d *M,geFloat RadianAngle);\r
- // sets up a transform that rotates RadianAngle about Z axis\r
- // all existing contents of M are replaced\r
-\r
-GENESISAPI void GENESISCC geXForm3d_SetTranslation(geXForm3d *M,geFloat x, geFloat y, geFloat z);\r
- // sets up a transform that translates x,y,z\r
- // all existing contents of M are replaced\r
-\r
-GENESISAPI void GENESISCC geXForm3d_SetScaling(geXForm3d *M,geFloat x, geFloat y, geFloat z);\r
- // sets up a transform that scales by x,y,z\r
- // all existing contents of M are replaced\r
-\r
-GENESISAPI void GENESISCC geXForm3d_RotateX(geXForm3d *M,geFloat RadianAngle); \r
- // Rotates M by RadianAngle about X axis \r
- // applies the rotation to the existing contents of M\r
-\r
-GENESISAPI void GENESISCC geXForm3d_RotateY(geXForm3d *M,geFloat RadianAngle);\r
- // Rotates M by RadianAngle about Y axis\r
- // applies the rotation to the existing contents of M\r
-\r
-GENESISAPI void GENESISCC geXForm3d_RotateZ(geXForm3d *M,geFloat RadianAngle);\r
- // Rotates M by RadianAngle about Z axis\r
- // applies the rotation to the existing contents of M\r
-\r
-GENESISAPI void GENESISCC geXForm3d_Translate(geXForm3d *M,geFloat x, geFloat y, geFloat z); \r
- // Translates M by x,y,z\r
- // applies the translation to the existing contents of M\r
-\r
-GENESISAPI void GENESISCC geXForm3d_Scale(geXForm3d *M,geFloat x, geFloat y, geFloat z); \r
- // Scales M by x,y,z\r
- // applies the scale to the existing contents of M\r
-\r
-GENESISAPI void GENESISCC geXForm3d_Multiply(\r
- const geXForm3d *M1, \r
- const geXForm3d *M2, \r
- geXForm3d *MProduct);\r
- // MProduct = matrix multiply of M1*M2\r
- // Concatenates the transformation in the M2 matrix onto the transformation in M1\r
-\r
-GENESISAPI void GENESISCC geXForm3d_Transform(\r
- const geXForm3d *M,\r
- const geVec3d *V, \r
- geVec3d *Result);\r
- // Result is Matrix M * Vector V: V Tranformed by M\r
-\r
-GENESISAPI void GENESISCC geXForm3d_TransformArray( const geXForm3d *XForm, \r
- const geVec3d *Source, \r
- geVec3d *Dest, \r
- int32 Count);\r
-\r
-GENESISAPI void GENESISCC geXForm3d_Rotate(\r
- const geXForm3d *M,\r
- const geVec3d *V, \r
- geVec3d *Result);\r
- // Result is Matrix M * Vector V: V Rotated by M (no translation)\r
-\r
-\r
-/***\r
-*\r
- "Left,Up,In" are just the basis vectors in the new coordinate space.\r
- You can get them by multiplying the unit bases into the transforms.\r
-*\r
-******/\r
-\r
-GENESISAPI void GENESISCC geXForm3d_GetLeft(const geXForm3d *M, geVec3d *Left);\r
- // Gets a vector that is 'left' in the frame of reference of M (facing -Z)\r
-\r
-GENESISAPI void GENESISCC geXForm3d_GetUp(const geXForm3d *M, geVec3d *Up);\r
- // Gets a vector that is 'up' in the frame of reference of M (facing -Z)\r
-\r
-GENESISAPI void GENESISCC geXForm3d_GetIn(const geXForm3d *M, geVec3d *In);\r
- // Gets a vector that is 'in' in the frame of reference of M (facing -Z)\r
-\r
-GENESISAPI void GENESISCC geXForm3d_GetTranspose(const geXForm3d *M, geXForm3d *MTranspose);\r
- // Gets the Transpose transform of M (M^T) \r
- // Transpose of a matrix is the switch of the rows and columns\r
- // The transpose is usefull because it is rapidly computed and is equal to the inverse \r
- // transform for orthonormal transforms [inverse is (M') where M*M' = Identity ]\r
-\r
-GENESISAPI void GENESISCC geXForm3d_TransposeTransform(\r
- const geXForm3d *M, \r
- const geVec3d *V, \r
- geVec3d *Result);\r
- // applies the transpose transform of M to V. Result = (M^T) * V\r
-\r
-/*****\r
-*\r
- the Euler angles are subsequent rotations :\r
- by Angles->Z around the Z axis\r
- then by Angles->Y around the Y axis, in the newly rotate coordinates\r
- then by Angles->X around the X axis\r
-*\r
-******/ \r
-\r
-GENESISAPI void GENESISCC geXForm3d_GetEulerAngles(const geXForm3d *M, geVec3d *Angles);\r
- // Finds Euler angles from M and puts them into Angles\r
- \r
-GENESISAPI void GENESISCC geXForm3d_SetEulerAngles(geXForm3d *M, const geVec3d *Angles);\r
- // Applies Euler angles to build M\r
-\r
-GENESISAPI void GENESISCC geXForm3d_SetFromLeftUpIn(\r
- geXForm3d *M,\r
- const geVec3d *Left, \r
- const geVec3d *Up, \r
- const geVec3d *In);\r
- // Builds an geXForm3d from orthonormal Left, Up and In vectors\r
-\r
-GENESISAPI void GENESISCC geXForm3d_Mirror(\r
- const geXForm3d *Source, \r
- const geVec3d *PlaneNormal, \r
- geFloat PlaneDist, \r
- geXForm3d *Dest);\r
- // Mirrors a XForm3d about a plane\r
-\r
-\r
-//--------------\r
-\r
-#ifndef NDEBUG\r
- GENESISAPI void GENESISCC geXForm3d_SetMaximalAssertionMode( geBoolean Enable );\r
-#else\r
- #define geXForm3d_SetMaximalAssertionMode(Enable)\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
-\r