ShQuaternion.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00027
#ifndef SHQUATERNION_HPP
00028
#define SHQUATERNION_HPP
00029
00030
#include <iostream>
00031
#include "ShLib.hpp"
00032
00033
namespace SH {
00034
00037
template<ShBindingType B,
typename T=
float>
00038 class ShQuaternion
00039 {
00040
template <ShBindingType B2,
typename T2>
00041
friend std::ostream&
operator<<(std::ostream& out,
00042
const ShQuaternion<B2, T2>& q);
00043
public:
00044
00049
ShQuaternion();
00050
00057
template<ShBindingType B2>
00058
ShQuaternion(
const ShQuaternion<B2, T>& other);
00059
00060
00067
template<ShBindingType B2>
00068
ShQuaternion(
const ShVector<4, B2, T>& values);
00069
00070
00077
template<ShBindingType B2, ShBindingType B3>
00078
ShQuaternion(
const ShAttrib<1, B2, T>& angle,
00079
const ShVector<3, B3, T>& axis);
00080
00081
00088
template<ShBindingType B2>
00089
ShQuaternion(
const ShMatrix<4, 4, B2, T>& mat);
00090
00097
template<ShBindingType B2>
00098
ShQuaternion&
operator=(
const ShQuaternion<B2, T>& other);
00099
00106
template<ShBindingType B2>
00107
ShQuaternion&
operator+=(
const ShQuaternion<B2, T>& right);
00108
00115
template<ShBindingType B2>
00116
ShQuaternion&
operator-=(
const ShQuaternion<B2, T>& right);
00117
00124
template<ShBindingType B2>
00125
ShQuaternion& operator*=(
const ShQuaternion<B2, T>& right);
00126
00127
00134
template<ShBindingType B2>
00135
ShQuaternion& operator*=(
const ShAttrib<1, B2, T>& right);
00136
00143
template<ShBindingType B2>
00144
ShQuaternion& operator*=(
const ShVector<3, B2, T>& right);
00145
00152
template<ShBindingType B2>
00153
ShQuaternion& operator*=(
const ShNormal<3, B2, T>& right);
00154
00160
template<ShBindingType B2>
00161
ShQuaternion<SH_TEMP, T> operator+(
const ShQuaternion<B2, T>& q2);
00162
00168
template<ShBindingType B2>
00169
ShQuaternion<SH_TEMP, T> operator-(
const ShQuaternion<B2, T>& q2);
00170
00176
template<ShBindingType B2>
00177
ShQuaternion<SH_TEMP, T> operator*(
const ShQuaternion<B2, T>& q2);
00178
00184
template<ShBindingType B2>
00185
ShQuaternion<SH_TEMP, T> operator*(
const ShAttrib<1, B2, T>& c);
00186
00193
template<ShBindingType B2>
00194
ShQuaternion<SH_TEMP, T> operator*(
const ShVector<3, B2, T>& q2);
00195
00202
template<ShBindingType B2>
00203
ShQuaternion<SH_TEMP, T> operator*(
const ShNormal<3, B2, T>& q2);
00204
00209
void normalize();
00210
00216
void getValues(T values [])
const;
00217
00223
void setUnit(
bool flag);
00224
00231
void name(
const std::string& name);
00232
00237 std::string
name()
const;
00238
00244
template<ShBindingType B2>
00245
ShAttrib<1, SH_TEMP, T> dot(
const ShQuaternion<B2, T>& q)
const;
00246
00251
ShQuaternion<SH_TEMP, T> conjugate()
const;
00252
00257
ShQuaternion<SH_TEMP, T> inverse()
const;
00258
00264
ShMatrix<4, 4, SH_TEMP, T> getMatrix()
const;
00265
00270
ShVector<4, SH_TEMP, T> getVector()
const;
00271
private:
00272
ShVector<4, B, T> m_data;
00273 };
00274
00275
template<ShBindingType B,
typename T, ShBindingType B2>
00276
extern ShQuaternion<SH_TEMP, T>
00277
operator*(
const ShAttrib<1, B2, T>& c,
const ShQuaternion<B, T>& q);
00278
00279
template<ShBindingType B1, ShBindingType B2,
typename T>
00280
extern ShQuaternion<SH_TEMP, T>
00281 slerp(
const ShQuaternion<B1, T>& q1,
const ShQuaternion<B2, T>& q2,
00282
const ShAttrib1f& t);
00283
00284
typedef ShQuaternion<SH_INPUT, float> ShInputQuaternionf;
00285
typedef ShQuaternion<SH_OUTPUT, float> ShOutputQuaternionf;
00286
typedef ShQuaternion<SH_TEMP, float> ShQuaternionf;
00287 }
00288
00289
#include "ShQuaternionImpl.hpp"
00290
00291
#endif
Generated on Mon Oct 18 14:17:40 2004 for Sh by
1.3.7