aboutsummaryrefslogtreecommitdiff
path: root/src/quat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quat.cpp')
-rw-r--r--src/quat.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/quat.cpp b/src/quat.cpp
index dfb2823..140256a 100644
--- a/src/quat.cpp
+++ b/src/quat.cpp
@@ -10,7 +10,7 @@ namespace fml {
quat::quat(vec3 vec) : w(0), x(vec[0]), y(vec[1]), z(vec[2]) { }
quat::quat() : w(0), x(0), y(0), z(0) { }
- quat::operator vec3()
+ quat::operator vec3() const
{
return vec3(this->x, this->y, this->z);
}
@@ -28,6 +28,11 @@ namespace fml {
return quat(this->w, -this->x, -this->y, -this->z);
}
+ quat quat::rotateby(const quat &rotquat) const
+ {
+ return rotquat * (*this) * rotquat.conjugate();
+ }
+
quat quat::from_angleaxis(scalar angle, vec3 axis)
{
scalar si = std::sin(angle / 2);