Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
Takin
tlibs
Commits
acb72939
Commit
acb72939
authored
Nov 20, 2019
by
Tobias WEBER
Browse files
quat test
parent
631ee715
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/test/quat2.cpp
0 → 100644
View file @
acb72939
/**
* tlibs test file
* @author Tobias Weber <tweber@ill.fr>
* @license GPLv2 or GPLv3
* @date 20-nov-2019
*/
// g++ -I../.. -o quat2 quat2.cpp -std=c++11
#include
"math/quat.h"
#include
"math/linalg.h"
#include
<iostream>
using
namespace
tl
;
using
T
=
double
;
int
main
()
{
ublas
::
matrix
<
T
>
matX
=
rotation_matrix_3d_x
(
45.
/
180.
*
M_PI
);
ublas
::
matrix
<
T
>
matY
=
rotation_matrix_3d_y
(
66.
/
180.
*
M_PI
);
math
::
quaternion
<
T
>
quatX
=
rot3_to_quat
(
matX
);
math
::
quaternion
<
T
>
quatY
=
rot3_to_quat
(
matY
);
math
::
quaternion
<
T
>
quat
=
slerp
(
quatX
,
quatY
,
0.25
);
ublas
::
matrix
<
T
>
mat
=
quat_to_rot3
(
quat
);
std
::
cout
<<
"matX = "
<<
matX
<<
std
::
endl
;
std
::
cout
<<
"matY = "
<<
matY
<<
std
::
endl
;
std
::
cout
<<
"mat = "
<<
mat
<<
std
::
endl
;
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment