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

CQuat.h

Go to the documentation of this file.
00001 /*
00002  * CQuat.h
00003  * $Id: CQuat.h,v 1.2 2001/09/28 11:06:08 mjanich Exp $
00004  *
00005  * Copyright (C) 1999, 2000 R. Klein, Michael Meissner
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 #ifndef CQUAT_H
00024 #define CQUAT_H
00025 
00026 #include <math.h>
00027 #include "GeoGeneric.h"
00028 
00029 
00030 class CV4D;
00031 class CV3D;
00032 class CMat4D;
00033 
00034 
00039 class CQuat
00040 { 
00041    friend class CMat4D;
00042    double w,x,y,z;
00043 public:
00044    // Konstruktoren
00045    CQuat(CMat4D &mat);
00046    CQuat(double qW,double qX, double qY,double qZ);
00047    CQuat(double qW,CV3D &vec);
00048    CQuat(void);
00049 
00050    void setQuat(double qW,double qX, double qY,double qZ) { w=qW; x=qX; y=qY; z=qZ; }
00051 
00052    // Initialisierung
00053    CQuat(const CQuat& );
00054 
00055    // Zuweisung
00056    void operator=(const CQuat& );
00057 
00058    // Addition-Operatoren
00059    CQuat operator+(CQuat&);
00060    CQuat operator-(CQuat&);
00061    CQuat operator-();
00062    
00063    // Multiplikation
00064    CQuat operator*(CQuat&);
00065    CQuat operator*(double&);
00066    friend CQuat operator*(double a,CQuat& q)
00067    { CQuat r; r.w=a*q.w; r.x=a*q.x;r.y=a*q.y;r.z=a*q.z; return r; }
00068 
00069    // Konjugation
00070    CQuat conj();
00071    CQuat inv();
00072  
00073    // Skalarprodukt
00074    double operator|(CQuat&);
00075 
00076    // Norm bzw. Normalisierung von Quaternionen
00077    double norm();
00078    CQuat normalize();
00079  
00080    // Zugriff auf Real- bzw. Imaginaerteil
00081    double re();
00082    CV3D im();
00083 
00084    double xv() const;
00085    double yv() const;
00086    double zv() const;
00087    double wv() const;
00088 
00089    // Beschleunigte Berechnung von Rotationen
00090    CQuat QVQ(CQuat&);
00091 
00092    CV3D rotate(CV3D& vec);
00093 
00094    
00095    // Ausgabe
00096    void print();
00097    /*
00098    Mat getRotMat();
00099    Mat3D getRotMat3D() const;
00100    */
00101 };
00102 
00103 inline 
00104 double 
00105 CQuat :: xv () const
00106 {
00107    return x;
00108 }
00109 
00110 inline 
00111 double 
00112 CQuat :: yv () const
00113 {
00114    return y;
00115 }
00116 
00117 inline 
00118 double 
00119 CQuat :: zv () const
00120 {
00121    return z;
00122 }
00123 
00124 inline 
00125 double 
00126 CQuat :: wv () const
00127 {
00128    return w;
00129 }
00130 
00131 #endif

Generated at Thu Oct 4 17:17:25 2001 for QGLViewer by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001