![]() |
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) by Kongsberg Oil & Gas Technologies. 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 Kongsberg Oil & Gas Technologies 00018 * about acquiring a Coin Professional Edition License. 00019 * 00020 * See http://www.coin3d.org/ for more information. 00021 * 00022 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, 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 void setValue(const class SbDPMatrix & m); 00054 const SbMat & getValue(void) const; 00055 00056 void makeIdentity(void); 00057 void setRotate(const SbRotation & q); 00058 SbMatrix inverse(void) const; 00059 float det3(int r1, int r2, int r3, 00060 int c1, int c2, int c3) const; 00061 float det3(void) const; 00062 float det4(void) const; 00063 00064 SbBool equals(const SbMatrix & m, float tolerance) const; 00065 00066 00067 operator SbMat&(void); 00068 float * operator [](int i); 00069 const float * operator [](int i) const; 00070 SbMatrix & operator =(const SbRotation & q); 00071 SbMatrix & operator *=(const SbMatrix & m); 00072 friend COIN_DLL_API SbMatrix operator *(const SbMatrix & m1, const SbMatrix & m2); 00073 friend COIN_DLL_API int operator ==(const SbMatrix & m1, const SbMatrix & m2); 00074 friend COIN_DLL_API int operator !=(const SbMatrix & m1, const SbMatrix & m2); 00075 void getValue(SbMat & m) const; 00076 static SbMatrix identity(void); 00077 void setScale(const float s); 00078 void setScale(const SbVec3f & s); 00079 void setTranslate(const SbVec3f & t); 00080 void setTransform(const SbVec3f & t, const SbRotation & r, const SbVec3f & s); 00081 void setTransform(const SbVec3f & t, const SbRotation & r, const SbVec3f & s, 00082 const SbRotation & so); 00083 void setTransform(const SbVec3f & translation, 00084 const SbRotation & rotation, const SbVec3f & scaleFactor, 00085 const SbRotation & scaleOrientation, const SbVec3f & center); 00086 void getTransform(SbVec3f & t, SbRotation & r, 00087 SbVec3f & s, SbRotation & so) const; 00088 void getTransform(SbVec3f & translation, SbRotation & rotation, 00089 SbVec3f & scaleFactor, SbRotation & scaleOrientation, 00090 const SbVec3f & center) const; 00091 SbBool factor(SbMatrix & r, SbVec3f & s, SbMatrix & u, SbVec3f & t, 00092 SbMatrix & proj); 00093 SbBool LUDecomposition(int index[4], float & d); 00094 void LUBackSubstitution(int index[4], float b[4]) const; 00095 SbMatrix transpose(void) const; 00096 SbMatrix & multRight(const SbMatrix & m); 00097 SbMatrix & multLeft(const SbMatrix & m); 00098 void multMatrixVec(const SbVec3f & src, SbVec3f & dst) const; 00099 void multVecMatrix(const SbVec3f & src, SbVec3f & dst) const; 00100 void multDirMatrix(const SbVec3f & src, SbVec3f & dst) const; 00101 void multLineMatrix(const SbLine & src, SbLine & dst) const; 00102 void multVecMatrix(const SbVec4f & src, SbVec4f & dst) const; 00103 00104 void print(FILE * fp) const; 00105 00106 private: 00107 float matrix[4][4]; 00108 00109 void operator /=(const float v); 00110 void operator *=(const float v); 00111 }; 00112 00113 COIN_DLL_API SbMatrix operator *(const SbMatrix & m1, const SbMatrix & m2); 00114 COIN_DLL_API int operator ==(const SbMatrix & m1, const SbMatrix & m2); 00115 COIN_DLL_API int operator !=(const SbMatrix & m1, const SbMatrix & m2); 00116 00117 #endif // !COIN_SBMATRIX_H
Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated for Coin by Doxygen 1.5.6.