-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathquat.cpp
More file actions
31 lines (24 loc) · 723 Bytes
/
quat.cpp
File metadata and controls
31 lines (24 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstdlib>
#include <iostream>
#include "rotation.hpp"
int main()
{
vxl::quat<float> a{0.f, 1.f, 0.f, 1.f};
vxl::quat<float> b{.5f, .5f, .75f, 1.f};
std::cout << a * b << std::endl;
//(.87 - .5k)(i + 2j)(.87 + .5k) = (2.25, .14, 0)
std::cout << vxl::rotated(vxl::quat<float>{.0f, .0f, -.5f, .87f},
vxl::vector<float, 3u>{1.f, 2.f, 0.f}) <<
std::endl;
std::cout << vxl::quat<float>{.0f, .0f, -.5f, .87f} *
vxl::quat<float>{1.f, 2.f, 0.f} *
vxl::quat<float>{.0f, .0f, .5f, .87f} <<
std::endl;
std::cout <<
vxl::to_quat(vxl::vector<float, 3>{1.f, .0f, .0f}, 2.f) <<
std::endl;
std::cout <<
vxl::norm2(vxl::quat<float>{1, 1, 1, 1}) <<
std::endl;
return 0;
}