diff options
| author | Franklin Wei <me@fwei.tk> | 2019-03-08 10:17:19 -0500 |
|---|---|---|
| committer | Franklin Wei <me@fwei.tk> | 2019-03-08 10:17:19 -0500 |
| commit | cdfd5b37012935f7b0fb0a41ea8ca119ef8313b6 (patch) | |
| tree | c93a775cbbf4bee69c73eb887e56bbc3d584b11b /src/quat.cpp | |
| parent | 7975d798bab79156c82d02a21158fc698b500a4a (diff) | |
| download | fieldviz-cdfd5b37012935f7b0fb0a41ea8ca119ef8313b6.zip fieldviz-cdfd5b37012935f7b0fb0a41ea8ca119ef8313b6.tar.gz fieldviz-cdfd5b37012935f7b0fb0a41ea8ca119ef8313b6.tar.bz2 fieldviz-cdfd5b37012935f7b0fb0a41ea8ca119ef8313b6.tar.xz | |
Remove old math code
Diffstat (limited to 'src/quat.cpp')
| -rw-r--r-- | src/quat.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/quat.cpp b/src/quat.cpp deleted file mode 100644 index df117d0..0000000 --- a/src/quat.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "quat.h" -#include <cmath> - -quat::quat(scalar w_, scalar x_, scalar y_, scalar z_) : w(w_), x(x_), y(y_), z(z_) { } -quat::quat(scalar x_, scalar y_, scalar z_) : w(0), x(x_), y(y_), z(z_) { } -quat::quat(scalar w_, vec3 vec) : w(w_), x(vec[0]), y(vec[1]), z(vec[2]) { } -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() -{ - return vec3(this->x, this->y, this->z); -} - -quat operator*(const quat &lhs, const quat &rhs) -{ - return quat(lhs.w * rhs.w - lhs.x * rhs.x - lhs.y * rhs.y - lhs.z * rhs.z, - lhs.w * rhs.x + lhs.x * rhs.w + lhs.y * rhs.z - lhs.z * rhs.y, - lhs.w * rhs.y - lhs.x * rhs.z + lhs.y * rhs.w + lhs.z * rhs.x, - lhs.w * rhs.z + lhs.x * rhs.y - lhs.y * rhs.x + lhs.z * rhs.w); -} - -quat quat::conjugate() const -{ - return quat(this->w, -this->x, -this->y, -this->z); -} - -quat quat::from_angleaxis(scalar angle, vec3 axis) -{ - scalar si = std::sin(angle / 2); - scalar co = std::cos(angle / 2); - return quat(co, si * axis[0], si * axis[1], si * axis[2]); -} - -std::ostream &operator<<(std::ostream &os, const quat &q) -{ - return os << "(" << q.w << ", " << q.x << ", " << q.y << ", " << q.z << ")"; -} |