PX4 Firmware
PX4 Autopilot Software http://px4.io
vectorAssignment.cpp
Go to the documentation of this file.
1
#include <
matrix/math.hpp
>
2
3
#include "
test_macros.hpp
"
4
5
using namespace
matrix
;
6
7
int
main
()
8
{
9
Vector3f
v;
10
v(0) = 1;
11
v(1) = 2;
12
v(2) = 3;
13
14
static
const
float
eps = 1e-7
f
;
15
16
TEST
(fabs(v(0) - 1) < eps);
17
TEST
(fabs(v(1) - 2) < eps);
18
TEST
(fabs(v(2) - 3) < eps);
19
20
Vector3f
v2(4, 5, 6);
21
22
TEST
(fabs(v2(0) - 4) < eps);
23
TEST
(fabs(v2(1) - 5) < eps);
24
TEST
(fabs(v2(2) - 6) < eps);
25
26
SquareMatrix<float, 3>
m =
diag
(
Vector3f
(1,2,3));
27
TEST
(fabs(m(0, 0) - 1) < eps);
28
TEST
(fabs(m(1, 1) - 2) < eps);
29
TEST
(fabs(m(2, 2) - 3) < eps);
30
31
return
0;
32
}
33
34
/* vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 : */
matrix::SquareMatrix
Definition:
SquareMatrix.hpp:26
matrix::Vector3
Definition:
Vector3.hpp:29
matrix
Definition:
AxisAngle.hpp:11
math.hpp
f
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
Definition:
integration.cpp:8
matrix::diag
SquareMatrix< Type, M > diag(Vector< Type, M > d)
Definition:
SquareMatrix.hpp:133
matrix::Vector3f
Vector3< float > Vector3f
Definition:
Vector3.hpp:136
test_macros.hpp
TEST
#define TEST(X)
Definition:
test_macros.hpp:14
main
int main()
Definition:
vectorAssignment.cpp:7
src
lib
matrix
test
vectorAssignment.cpp
Generated by
1.8.13