00001 /*=auto======================================================================== 00002 00003 (c) Copyright 2006 Brigham and Women's Hospital (BWH) All Rights Reserved. 00004 00005 Project: ZLinAlg 00006 Description: General Linear Algebra functions and operators required by 00007 ZTrackerTransform. 00008 Author: Simon DiMaio, simond@bwh.harvard.edu 00009 Version: $Id: ZLinAlg.h,v 1.2 2007/01/17 12:44:08 simond Exp $ 00010 00011 =========================================================================auto=*/ 00012 00013 00014 /*= INCLUDE ==================================================================*/ 00015 00016 #ifndef _ZLINALG_H 00017 #define _ZLINALG_H 00018 00019 #include "math.h" 00020 #include <iostream> 00021 //#include "ZLogger.h" 00022 00023 00024 /*= DEFINE ===================================================================*/ 00025 00026 // Tolerance for vector operations. 00027 #define VEPSILON (1e-10) 00028 00029 00030 /*= GLOBAL ===================================================================*/ 00031 00032 //extern ZLogger ZLog; 00033 00034 00035 /*= CLASS: Column2Vector =====================================================*/ 00036 00041 class Column2Vector 00042 { 00043 public: 00044 Column2Vector(); 00045 ~Column2Vector(); 00046 00047 float getX(); 00048 float getY(); 00049 00050 void setvalues(float X, float Y); 00051 void setX(float X); 00052 void setY(float Y); 00053 00054 bool normalize(); 00055 float norm(); 00056 00057 Column2Vector operator+(Column2Vector Vright); 00058 Column2Vector operator-(Column2Vector Vright); 00059 Column2Vector operator*(float); 00060 Column2Vector operator/(float); 00061 Column2Vector& operator=(Column2Vector); 00062 00063 void PrintSelf(); 00064 00065 private: 00066 float VectorArray[2]; 00067 }; 00068 00069 00070 /*= CLASS: Column3Vector =====================================================*/ 00071 00076 class Column3Vector 00077 { 00078 public: 00079 Column3Vector(); 00080 ~Column3Vector(); 00081 00082 float getX(); 00083 float getY(); 00084 float getZ(); 00085 00086 void setvalues(float X, float Y, float Z); 00087 void setX(float X); 00088 void setY(float Y); 00089 void setZ(float Z); 00090 00091 bool normalize(); 00092 float norm(); 00093 00094 Column3Vector operator+(Column3Vector Vright); 00095 Column3Vector operator-(Column3Vector Vright); 00096 Column3Vector operator*(Column3Vector Vright); 00097 Column3Vector operator*(float); 00098 Column3Vector operator/(float); 00099 Column3Vector& operator=(Column3Vector); 00100 00101 void PrintSelf(); 00102 00103 private: 00104 float VectorArray[3]; 00105 }; 00106 00107 00108 /*= CLASS: Quaternion ========================================================*/ 00109 00114 class Quaternion 00115 { 00116 public: 00117 Quaternion(); 00118 ~Quaternion(); 00119 00120 float getX(); 00121 float getY(); 00122 float getZ(); 00123 float getW(); 00124 00125 void setvalues(float X, float Y, float Z, float W); 00126 void setX(float X); 00127 void setY(float Y); 00128 void setZ(float Z); 00129 void setW(float W); 00130 00131 float norm(); 00132 bool normalize(); 00133 bool conjugate(); 00134 bool ComputeFromRotationMatrix(Column3Vector C0, Column3Vector C1, 00135 Column3Vector C2); 00136 00137 Column3Vector RotateVector(Column3Vector P1); 00138 00139 Quaternion operator*(Quaternion Qright); 00140 Quaternion operator/(Quaternion Qright); 00141 Quaternion& operator=(Quaternion Qnew); 00142 00143 void PrintSelf(); 00144 00145 private: 00146 float QuaternionArray[4]; 00147 }; 00148 00149 #endif 00150 00151 /*= END ZLinAlg.h ============================================================*/
1.4.6