00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GLLOCALCOORDINATESYSTEM_H
00019 #define GLLOCALCOORDINATESYSTEM_H
00020
00021 #include "glvector.h"
00022 #include "glquaternion.h"
00023
00029 class GLLocalCoordinateSystem
00030 {
00031 GLVector localX, localY, localZ;
00032 public:
00033 static char startTag[20];
00034 static char endTag[20];
00035
00036 TYPE_NAME(GLLocalCoordinateSystem);
00037
00039 GLLocalCoordinateSystem();
00041 GLLocalCoordinateSystem(const GLVector& front, const GLVector& up);
00042 GLLocalCoordinateSystem(const GLLocalCoordinateSystem&);
00043
00044 virtual ~GLLocalCoordinateSystem();
00045
00046 const GLVector& getLocalX() const;
00047 const GLVector& getLocalY() const;
00048 const GLVector& getLocalZ() const;
00049
00050 inline void copyLCS(const GLLocalCoordinateSystem* lcs)
00051 { localX = lcs->localX; localY = lcs->localY; localZ = lcs->localZ; }
00052
00054 void set(const GLVector& front, const GLVector& up);
00056 void set(const GLVector& z, const GLVector& y, const GLVector& x);
00057
00059 virtual void rotate(GLfloat p, GLfloat y, GLfloat r);
00060
00062 inline GLVector toLocal(const GLVector& v)
00063 { return GLVector(localX.dot(v), localY.dot(v), localZ.dot(v) ); };
00064
00066 inline GLVector toGlobal(const GLVector& v)
00067 { return localX*v.getX() + localY*v.getY() + localZ*v.getZ(); };
00068
00069 void loadFromStream(std::istream&);
00070 void saveToStream(std::ostream&);
00071
00073 void glRotate(void);
00076 void glRotate(GLfloat t);
00077
00078 private:
00081 const GLVector getYawAboutVector();
00082
00083 };
00084
00085 #endif