![]() |
University of Murcia, Spain ![]() |
src/qvmath/qvquaternion.hGo to the documentation of this file.00001 /* 00002 * Copyright (C) 2007, 2008. PARP Research Group. 00003 * <http://perception.inf.um.es> 00004 * University of Murcia, Spain. 00005 * 00006 * This file is part of the QVision library. 00007 * 00008 * QVision is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as 00010 * published by the Free Software Foundation, version 3 of the License. 00011 * 00012 * QVision 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 Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with QVision. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00024 00025 #ifndef QVQUATERNION_H 00026 #define QVQUATERNION_H 00027 00028 #include <math.h> 00029 #include <iostream> 00030 #include <QVVector> 00031 00032 class QVMatrix; 00033 00043 class QVQuaternion: public QVVector 00044 { 00045 public: 00047 // Constructors 00048 00052 QVQuaternion(); 00053 00060 QVQuaternion(QVVector direction, float phi); 00061 00070 QVQuaternion(const double q1, const double q2, const double q3, const double q4); 00071 00077 QVQuaternion(const QVMatrix matrix); 00078 00080 00085 QVQuaternion operator*(const QVQuaternion &quaternion) const { return quaternionProduct(quaternion); }; 00086 00092 QVQuaternion(const QVQuaternion &quaternion): QVVector(quaternion) {} 00093 00104 static QVQuaternion trackball(float p1x, float p1y, float p2x, float p2y); 00105 00113 QVQuaternion quaternionProduct(const QVQuaternion &quaternion) const; 00114 00115 private: 00116 QVQuaternion normalizeQuaternion() const; 00117 }; 00118 00119 std::ostream& operator << ( std::ostream &os, const QVQuaternion &quaternion ); 00120 00121 #endif 00122 |