31 #ifndef __I6ENGINE_MATH_I6EQUATERNION_H__
32 #define __I6ENGINE_MATH_I6EQUATERNION_H__
59 static const double EPSILON;
74 i6eQuaternion(
const double w,
const double x,
const double y,
const double z) : _w(w), _x(x), _y(y), _z(z) {
104 i6eQuaternion(
const std::map<std::string, std::string> & params,
const std::string & prefix);
122 double getW()
const {
return _w; }
123 double getX()
const {
return _x; }
124 double getY()
const {
return _y; }
125 double getZ()
const {
return _z; }
130 void setW(
const double w) { _w = w; }
131 void setX(
const double x) { _x = x; }
132 void setY(
const double y) { _y = y; }
133 void setZ(
const double z) { _z = z; }
178 setW(getW() + b.
getW());
179 setX(getX() + b.
getX());
180 setY(getY() + b.
getY());
181 setZ(getZ() + b.
getZ());
188 void insertInMap(
const std::string & prefix, std::map<std::string, std::string> & map)
const;
200 double length()
const;
212 bool equals(
const i6eQuaternion & q,
double eps = i6eQuaternion::EPSILON)
const;
219 void toAxisAngle(
i6eVector & axis,
double & angle)
const;
230 return !(*
this == b);
251 btQuaternion toBullet()
const;
256 std::string toString()
const;
261 template<
class Archive>
270 double _w, _x, _y, _z;
ISIXE_MATH_API double scalProd(const i6eQuaternion &p, const i6eQuaternion &q)
calculates scalar product of current Quaternion and p
Class describing a 3d rotation.
std::enable_if< std::is_integral< T >::value, bool >::type operator==(const i6eVector2< T > &first, const i6eVector2< T > &second)
i6eQuaternion operator+=(const i6eQuaternion &b)
Operator '+=' for Quaternions.
i6eQuaternion operator/(const double &v) const
divides a quaternion by a scalar
i6eQuaternion inverse() const
return the inverted vector of the quaternion
i6e::math::i6eQuaternion Quaternion
double getW() const
getters for the values of the quaternion
i6eQuaternion(const double w, const double x, const double y, const double z)
Creates a new vector with given values. Be careful with the ordering. i6eQuaternion expects W first...
Implements 3-dimensional vectors.
i6eQuaternion operator-(const i6eQuaternion &b) const
Operator '-' for Quaternions.
ISIXE_MATH_API i6eQuaternion operator*(const i6eQuaternion &q, const i6eVector &w)
multiplies quaternion with i6eVector
bool operator!=(const i6eQuaternion &b) const
Operator '!=' for Quaternions.
i6eQuaternion()
Creates a new vector with all values set to 0.
i6eQuaternion operator+(const i6eQuaternion &b) const
Operator '+' for Quaternions.
static const i6eQuaternion IDENTITY
ISIXE_MATH_API double dotProduct(const i6eQuaternion &p, const i6eQuaternion &q)
creates dot product out of two quaternions
void serialize(Archive &ar, const unsigned int)
serialize method for quaternion;
void setX(const double x)
i6eQuaternion operator*(const double &v) const
multiplies a quaternion with a scalar
void setY(const double y)
void setZ(const double z)
ISIXE_MATH_API std::ostream & operator<<(std::ostream &stream, const i6eQuaternion &q)
stream operator for quaternion
void setW(const double w)
setters for the values of the quaternion
i6eQuaternion operator*(const i6eQuaternion &q) const
Operator '*' for Quaternions.