PX4 Firmware
PX4 Autopilot Software http://px4.io
vector2.cpp
Go to the documentation of this file.
1
2
3
#include <
matrix/math.hpp
>
4
5
#include "
test_macros.hpp
"
6
7
using namespace
matrix
;
8
9
int
main
()
10
{
11
Vector2f
a(1, 0);
12
Vector2f
b(0, 1);
13
TEST
(fabs(a % b - 1.0
f
) <
FLT_EPSILON
);
14
15
Vector2f
c;
16
TEST
(fabs(c(0) - 0) <
FLT_EPSILON
);
17
TEST
(fabs(c(1) - 0) <
FLT_EPSILON
);
18
19
Matrix<float, 2, 1>
d(a);
20
TEST
(fabs(d(0,0) - 1) <
FLT_EPSILON
);
21
TEST
(fabs(d(1,0) - 0) <
FLT_EPSILON
);
22
23
Vector2f
e(d);
24
TEST
(fabs(e(0) - 1) <
FLT_EPSILON
);
25
TEST
(fabs(e(1) - 0) <
FLT_EPSILON
);
26
27
float
data
[] = {4,5};
28
Vector2f
f
(data);
29
TEST
(fabs(
f
(0) - 4) <
FLT_EPSILON
);
30
TEST
(fabs(
f
(1) - 5) <
FLT_EPSILON
);
31
32
Vector3f
g(1.23f, 423.4f, 3221.f);
33
Vector2f
h(g);
34
TEST
(fabs(h(0) - 1.23f) <
FLT_EPSILON
);
35
TEST
(fabs(h(1) - 423.4f) <
FLT_EPSILON
);
36
37
return
0;
38
}
39
40
/* vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 : */
matrix::Vector2
Definition:
Vector2.hpp:20
FLT_EPSILON
#define FLT_EPSILON
Definition:
stdlib_imports.hpp:26
matrix::Vector3
Definition:
Vector3.hpp:29
matrix
Definition:
AxisAngle.hpp:11
math.hpp
data
uint8_t * data
Definition:
dataman.cpp:149
f
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
Definition:
integration.cpp:8
test_macros.hpp
TEST
#define TEST(X)
Definition:
test_macros.hpp:14
matrix::Matrix
Definition:
Matrix.hpp:36
main
int main()
Definition:
vector2.cpp:9
src
lib
matrix
test
vector2.cpp
Generated by
1.8.13