PX4 Firmware
PX4 Autopilot Software http://px4.io
setIdentity.cpp
Go to the documentation of this file.
1
#include "
test_macros.hpp
"
2
#include <
matrix/math.hpp
>
3
4
using namespace
matrix
;
5
6
int
main
()
7
{
8
Matrix3f
A;
9
A.
setIdentity
();
10
11
for
(
size_t
i = 0; i < 3; i++) {
12
for
(
size_t
j = 0; j < 3; j++) {
13
if
(i == j) {
14
TEST
(fabs(A(i, j) - 1) <
FLT_EPSILON
);
15
16
}
else
{
17
TEST
(fabs(A(i, j) - 0) <
FLT_EPSILON
);
18
}
19
}
20
}
21
22
Matrix3f
B;
23
B.
identity
();
24
25
for
(
size_t
i = 0; i < 3; i++) {
26
for
(
size_t
j = 0; j < 3; j++) {
27
if
(i == j) {
28
TEST
(fabs(B(i, j) - 1) <
FLT_EPSILON
);
29
30
}
else
{
31
TEST
(fabs(B(i, j) - 0) <
FLT_EPSILON
);
32
}
33
}
34
}
35
36
return
0;
37
}
38
39
/* vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 : */
main
int main()
Definition:
setIdentity.cpp:6
matrix::SquareMatrix
Definition:
SquareMatrix.hpp:26
FLT_EPSILON
#define FLT_EPSILON
Definition:
stdlib_imports.hpp:26
matrix
Definition:
AxisAngle.hpp:11
matrix::Matrix::setIdentity
void setIdentity()
Definition:
Matrix.hpp:447
math.hpp
test_macros.hpp
TEST
#define TEST(X)
Definition:
test_macros.hpp:14
matrix::Matrix::identity
void identity()
Definition:
Matrix.hpp:457
src
lib
matrix
test
setIdentity.cpp
Generated by
1.8.13