cleaned up the quaternion implementation prior to making pixwerx rely on it

This commit is contained in:
Hartmut Seichter 2018-04-08 00:21:45 +02:00
parent 3013bdd59a
commit c207493454
17 changed files with 331 additions and 79 deletions

View file

@ -5,11 +5,26 @@
int main(int argc,char **argv) {
pw::quaternion<float> qf = pw::quaternionf::rotate_180_degree_around_x();
pw::quaternion<float> qf = pw::quaternionf::rotate_90_degree_around_x();
std::cout << "qf = " << pw::serialize::matrix(qf.as_vector()) << std::endl;
std::cout << "qf.matrix() = " << pw::serialize::matrix(qf.to_matrix()) << std::endl;
std::cout << "qf.squared_norm() = " << qf.squared_norm() << std::endl;
std::cout << "qf.dot(qf) = " << qf.dot(qf) << std::endl;
std::cout << "qf.conjugate() = " << pw::serialize::matrix(qf.conjugate().as_vector()) << std::endl;
pw::quaternionf qi = qf.inverse();
std::cout << "qf.inverse() (qi) = " << pw::serialize::matrix(qi.as_vector()) << std::endl;
pw::quaternionf qmid = pw::quaternionf::normalized_lerp(qi,qf,0.5f);
std::cout << "qmid.dot() (half between qf and qi) = " << pw::rad_to_deg(std::acos(qmid.dot(qf))) << std::endl;
return 0;
}

View file

@ -24,6 +24,8 @@ int main(int argc,char **argv) {
std::cout << "v3 = " << pw::serialize::matrix(v3) << std::endl;
std::cout << "v3.normalized() = " << pw::serialize::matrix(v3.normalized()) << std::endl;
return 0;
}