From a175afd49f3ac4a40900c7748365ccc4c73b7b41 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Mon, 5 Aug 2019 10:07:56 -0700 Subject: [PATCH] Complex conjugate started. --- include/wrmath/geom/quaternion.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/wrmath/geom/quaternion.h b/include/wrmath/geom/quaternion.h index 8e86df9..37470e0 100644 --- a/include/wrmath/geom/quaternion.h +++ b/include/wrmath/geom/quaternion.h @@ -38,6 +38,18 @@ public: this->w = std::fmod(this->w, this->maxRotation); }; + /** + * A Quaternion may be initialised with a Vector comprised of the axis of rotation + * followed by the angle of rotation. + * @param vector A vector in the form . + */ + Quaternion(Vector vector) : + v(Vector {vector[0], vector[1], vector[2]}), + w(vector[3]) + { + wr::math::DefaultEpsilon(this->eps); + this->w = std::fmod(this->w, this->m + } /** * Return the axis of rotation of this quaternion. @@ -80,6 +92,17 @@ public: } + Quaternion + complexConj() + { + return Quaternion(Vector {this->v[0], this->v[1], this->v[2], this->w}) + } + + /** + * Return the quaternion as a Vector, with the axis of rotation + * followed by the angle of rotation. + * @return A vector representation of the quaternion. + */ Vector asVector() {