Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

gllocalcoordinatesystem.h

00001 /***************************************************************************
00002                           gllocalcoordinatesystem.h  -  description
00003                              -------------------
00004     begin                : Fri Jul 18 2003
00005     copyright            : (C) 2003 by Jacques Gasselin de Richebourg
00006     email                : jacquesgasselin@hotmail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU Lesser General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
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

Generated on Wed Feb 4 23:11:33 2004 by doxygen 1.3.3