A bunch of note and code on the topic of Quaternion: applications in graphics and vision
A quaternion is a ring of number which can be written as
The quaternion is a vector sapce in terms of adding, scalaring and norming, which means,
So that we can proof,
We denote a quaternion
And naturally, a vector from
Actually, every
Where the true background mean of that can be represented as,
The meaning behind it is,
And it is natual to to think of rotation matrices, here we explore the relation ship between the two objects.
Suppose
So that,
Note that,
Since then, there equation can be viewed as a linear equation to
[Environment]. We support c++, which depend on eigen3` (but which can be replaced, for the main usage is the structure of vector, matrix and implementation of linear solver and eigen solver).
The enironment is initially set on an archlinux machine, the procedure of setting environment could be,
sudo pacman -S eigen3 g++ python3 And for other systems (e.g. Ubuntu, MacOS, Windows), the environmet could be broken (solving currently), the eigen3 in submodule is not working...
For c++ compilation, you can use
make compileTo compile the binary file, and we support clean for remove, all for build and run (as test).
The python bnding is depended on pybind11, you can install it like,
python -m pip install pybind11 ## install it
python -m pip install 'pybind11[global]' ## install it system wideAnd to run the installation, you should go to python directory by cd python.
and go with
python -m pip install . --verbose ## of course if you want more details
Currently, this is quite troblesome...
[Under developing]. This could be super cool!
-
Wikipedia: Quaternions, Quaternions and saptial rotation.
-
Courses: CMU15.462: Computer Graphics, GAMES105.
This is a result of main.test().
q1 = (1,2i,3j,4k), norm = 5.47723
q2 = (0.866025,0.288675i,0.288675j,0.288675k), norm = 1
q1 + q2 = (1.86603,2.28868i,3.28868j,4.28868k)
12 * q1 = (12,24i,36j,48k)
q1.normalize()(0.182574,0.365148i,0.547723j,0.730297k)
q2.to_mat(): m =
0.666667 -0.333333 0.666667
0.666667 0.666667 -0.333333
-0.333333 0.666667 0.666667
m.T * m =
1 -2.77556e-17 -2.77556e-17
-2.77556e-17 1 0
-2.77556e-17 0 1
mat_to_quat(m): (0.866025,0.288675i,0.288675j,0.288675k)