![]() |
http://www.sim.no http://www.coin3d.org |
00001 #ifndef COIN_SBMATRIX_H 00002 #define COIN_SBMATRIX_H 00003 00004 /**************************************************************************\ 00005 * 00006 * This file is part of the Coin 3D visualization library. 00007 * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved. 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * ("GPL") version 2 as published by the Free Software Foundation. 00012 * See the file LICENSE.GPL at the root directory of this source 00013 * distribution for additional information about the GNU GPL. 00014 * 00015 * For using Coin with software that can not be combined with the GNU 00016 * GPL, and for taking advantage of the additional benefits of our 00017 * support services, please contact Systems in Motion about acquiring 00018 * a Coin Professional Edition License. 00019 * 00020 * See http://www.coin3d.org/ for more information. 00021 * 00022 * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY. 00023 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 00024 * 00025 \**************************************************************************/ 00026 00027 #include <stdio.h> 00028 #include <Inventor/SbBasic.h> 00029 00030 class SbLine; 00031 class SbRotation; 00032 class SbVec3f; 00033 class SbVec4f; 00034 00035 typedef float SbMat[4][4]; 00036 00037 class COIN_DLL_API SbMatrix { 00038 public: 00039 SbMatrix(void); 00040 SbMatrix(const float a11, const float a12, const float a13, const float a14, 00041 const float a21, const float a22, const float a23, const float a24, 00042 const float a31, const float a32, const float a33, const float a34, 00043 const float a41, const float a42, const float a43, const float a44); 00044 SbMatrix(const SbMat & matrix); 00045 SbMatrix(const SbMat * matrix); 00046 ~SbMatrix(void); 00047 00048 SbMatrix & operator =(const SbMat & m); 00049 00050 operator float*(void); 00051 SbMatrix & operator =(const SbMatrix & m); 00052 void setValue(const SbMat & m); 00053 const SbMat & getValue(void) const; 00054 00055 void makeIdentity(void); 00056 void setRotate(const SbRotation & q); 00057 SbMatrix inverse(void) const; 00058 float det3(int r1, int r2, int r3, 00059 int c1, int c2, int c3) const; 00060 float det3(void) const; 00061 float det4(void) const; 00062 00063 SbBool equals(const SbMatrix & m, float tolerance) const; 00064 00065 00066 operator SbMat&(void); 00067 float * operator [](int i); 00068 const float * operator [](int i) const; 00069 SbMatrix & operator =(const SbRotation & q); 00070 SbMatrix & operator *=(const SbMatrix & m); 00071 friend COIN_DLL_API SbMatrix operator *(const SbMatrix & m1, const SbMatrix & m2); 00072 friend COIN_DLL_API int operator ==(const SbMatrix & m1, const SbMatrix & m2); 00073 friend COIN_DLL_API int operator !=(const SbMatrix & m1, const SbMatrix & m2); 00074 void getValue(SbMat & m) const; 00075 static SbMatrix identity(void); 00076 void setScale(const float s); 00077 void setScale(const SbVec3f & s); 00078 void setTranslate(const SbVec3f & t); 00079 void setTransform(const SbVec3f & t, const SbRotation & r, const SbVec3f & s); 00080 void setTransform(const SbVec3f & t, const SbRotation & r, const SbVec3f & s, 00081 const SbRotation & so); 00082 void setTransform(const SbVec3f & translation, 00083 const SbRotation & rotation, const SbVec3f & scaleFactor, 00084 const SbRotation & scaleOrientation, const SbVec3f & center); 00085 void getTransform(SbVec3f & t, SbRotation & r, 00086 SbVec3f & s, SbRotation & so) const; 00087 void getTransform(SbVec3f & translation, SbRotation & rotation, 00088 SbVec3f & scaleFactor, SbRotation & scaleOrientation, 00089 const SbVec3f & center) const; 00090 SbBool factor(SbMatrix & r, SbVec3f & s, SbMatrix & u, SbVec3f & t, 00091 SbMatrix & proj); 00092 SbBool LUDecomposition(int index[4], float & d); 00093 void LUBackSubstitution(int index[4], float b[4]) const; 00094 SbMatrix transpose(void) const; 00095 SbMatrix & multRight(const SbMatrix & m); 00096 SbMatrix & multLeft(const SbMatrix & m); 00097 void multMatrixVec(const SbVec3f & src, SbVec3f & dst) const; 00098 void multVecMatrix(const SbVec3f & src, SbVec3f & dst) const; 00099 void multDirMatrix(const SbVec3f & src, SbVec3f & dst) const; 00100 void multLineMatrix(const SbLine & src, SbLine & dst) const; 00101 void multVecMatrix(const SbVec4f & src, SbVec4f & dst) const; 00102 00103 void print(FILE * fp) const; 00104 00105 private: 00106 float matrix[4][4]; 00107 00108 void operator /=(const float v); 00109 void operator *=(const float v); 00110 }; 00111 00112 COIN_DLL_API SbMatrix operator *(const SbMatrix & m1, const SbMatrix & m2); 00113 COIN_DLL_API int operator ==(const SbMatrix & m1, const SbMatrix & m2); 00114 COIN_DLL_API int operator !=(const SbMatrix & m1, const SbMatrix & m2); 00115 00116 #endif // !COIN_SBMATRIX_H
Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.
Generated on Mon Feb 23 16:33:09 2009 for Coin by Doxygen. 1.5.8