Gustavo Jose de Sousa
4398e1e49b
AP_Math: AP_GeodesicGrid: change order of triangles
...
- Change the order of the icosahedron triangles so that there's a uniform way of
finding the opposite triangle. The order visually still makes sense.
- Change test to accommodate the order change.
9 years ago
Gustavo Jose de Sousa
ea412ad629
AP_Math: benchmark_geodesic_grid: add benchmark
...
That will help to benchmark improvements on the section search algorithm.
9 years ago
Gustavo Jose de Sousa
797a2da031
AP_Math: test_geodesic_grid: test when inclusive=true
9 years ago
Gustavo Jose de Sousa
b299261ad4
AP_Math: AP_GeodesicGrid: add first implementation
...
The search for the geodesic section is still naive in this version.
Additionally, add unit tests.
9 years ago
Gustavo Jose de Sousa
3f2ad764ca
AP_Math: Matrix3: add inverse() and invert() functions
...
Additionally, add unit tests.
9 years ago
Gustavo Jose de Sousa
06eea2838f
AP_Math: Matrix3: add det() function
...
Function to calculate determinant. Additionally, add unit tests.
9 years ago
Gustavo Jose de Sousa
26959f1448
AP_Math: define golden ratio constant
9 years ago
dgrat
7ff8004f8f
AP_Math: Replace is_zero() with a template function
...
This function only makes sense for floating point types. However this
function was also used for ints.
9 years ago
Ricardo de Almeida Gonzaga
481e3a2af6
AP_Math: Fix typos
9 years ago
Lucas De Marchi
aa974399d0
AP_Math: use inline wrappers for constrain_* functions
...
This avoids some warnings about "constrain_float defined but not used"
in some compilers.
9 years ago
Lucas De Marchi
bd6e268122
AP_Math: fix coding style
...
- cleanup whitespace
- function reorder
- fix brace position
9 years ago
Lucas De Marchi
1dbffef7ea
AP_Math: remove trailing whitespace on headers
9 years ago
Lucas De Marchi
ab1fa4b435
AP_Math: reorganize headers
...
Sort and add pragma once where needed.
9 years ago
dgrat
6d3b491c02
AP_Math: Replace is_equal with a type safe template function
...
It makes sense to consider also other floating point types.
9 years ago
dgrat
503867b7dc
AP_Math: Replace safe_sqrt() by template function
9 years ago
dgrat
5deb0e8e03
AP_Math: Replace safe_asin() by template function
9 years ago
Lucas De Marchi
846b4927ec
AP_Math: use if/else chain instead of 2 ternary operators
9 years ago
dgrat
174f899a29
AP_Math: Replace the constrain_* functions by a single template
...
Besides being simpler this reduces ~4k in the binary size for PX4.
9 years ago
Lucas De Marchi
348b07609c
AP_Math: remove macros from unit tests
...
Avoid warnings like:
[2130/2168] Compiling libraries/AP_Math/tests/test_math.cpp
../../libraries/AP_Math/tests/test_math.cpp: In member function ‘virtual void MathTest_IsZero_Test::TestBody()’:
../../libraries/AP_Math/tests/test_math.cpp:73:196: warning: converting ‘false’ to pointer type for argument 1 of ‘char
testing::internal::IsNullLiteralHelper(testing::internal::Secret*)’ [-Wconversion-null]
../../libraries/AP_Math/tests/test_math.cpp:74:199: warning: converting ‘false’ to pointer type for argument 1 of ‘char
testing::internal::IsNullLiteralHelper(testing::internal::Secret*)’ [-Wconversion-null]
Use EXPECT_TRUE() and EXPECT_FALSE() from gtest instead.
9 years ago
dgrat
41661f815f
AP_Math: Replace the pythagorous* functions with a variadic template
...
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
9 years ago
Lucas De Marchi
880f130670
AP_Math: fix loss of precision on float addition
...
When using wrap_180_cd() we are adding a small float (180 * 100) to a
possibly big number. This may lose float precision as illustrated by the
unit test failing:
OUT: ../../libraries/AP_Math/tests/test_math.cpp:195: Failure
OUT: Value of: wrap_180_cd(-3600000000.f)
OUT: Actual: -80
OUT: Expected: 0.f
OUT: Which is: 0
9 years ago
dgrat
76362caee0
AP_Math: Replace wrap_* functions with template versions
9 years ago
dgrat
49cfd6fd9b
AP_Math: Add gtest support for some functions
...
These functions (or variants thereof) now have unit tests:
- is_zero()
- is_equal()
- sq()
- pythagorous()
- constrain()
- wrap_180()
- wrap_360()
Some tests in wrap_180_cd are failing: -180 should be wrapped to 180,
not -180.
9 years ago
Lucas De Marchi
ceea7540fd
AP_Math: rename test file
...
This will be reused for more math tests.
9 years ago
Gustavo Jose de Sousa
b594b5a08b
AP_Math: matrix_alg: disable FE_OVERFLOW in inverse4x4() for SITL
...
There are occasional overflows on the determinant calculation in inverse4x4()
when using calibration SITL model.
9 years ago
Gustavo Jose de Sousa
a7543d369f
AP_Math: matrix_alg: protect inverseixi() against overflow
...
Fail on inverse3x3() and inverse4x4() if there's float overflow during the
determinant calculation.
9 years ago
Gustavo Jose de Sousa
39f72610e2
AP_Math: quaternion: fix style
...
Remove trailing spaces and run astyle.
9 years ago
Andrew Tridgell
e8142b0b5b
AP_Math: added wrap_360()
9 years ago
Andrew Tridgell
97d27ce58f
AP_Math: fixed memory leak
...
found by coverity
9 years ago
Andrew Tridgell
6165c42535
AP_Math: added from_axis_angle() method on Matrix3f
...
for arbitrary rotations in simulator
9 years ago
Michael du Breuil
bb7cf6c0b6
AP_Math: Update location_sanitize to sanitize for lat/lng
9 years ago
Ricardo de Almeida Gonzaga
5bd034a5a8
Global: start using cmath instead of math.h
9 years ago
Andrew Tridgell
6bff07397e
AP_Math: added linear_interpolate() function
9 years ago
Lucas De Marchi
b4a8a0b961
AP_Math: replace header guard with pragma once
9 years ago
Gustavo Jose de Sousa
6729475b25
AP_Math: fix eulers example for PX4
9 years ago
Gustavo Jose de Sousa
d9bb696fa3
AP_Math: avoid bias in rand_num() in eulers example
...
Use RAND_MAX to avoid bias.
9 years ago
Tom Pittenger
278fb2e60d
AP_Math: add location sanity checker/fixer util
9 years ago
dgrat
672acdc8ef
AP_Math: Created location.h header for location functions
...
Helps to order AP_Math functions by purpose.
9 years ago
Lucas De Marchi
7f685a12bd
AP_Math: remove trailing whitespaces and tabs
9 years ago
dgrat
5148e41c1a
AP_Math: Cleaned macro definitions
...
Moved Definitions into a separate header. Replaced PI with M_PI and
removed the M_PI_*_F macros.
9 years ago
dgrat
7c4c8ea579
AP_Math: Remove ROTATION_COMBINATION_SUPPORT
...
This function is not used.
9 years ago
Daniel Frenzel
ead51a9d19
AP_Math: Removed useless "undef INLINE"
9 years ago
Daniel Frenzel
ef7cf7c4aa
AP_Math: Removed useless header
...
"float.h" does not exist. It is useless and wrong to include it.
9 years ago
Peter Barker
80bc7a50d7
AP_Math: define MATH_CHECK_INDEXES
...
Wrapped in ifndefs so the top-level Makefile can override
Assume MATH_CHECK_INDEXES is always defined
9 years ago
Gustavo Jose de Sousa
c2e3f05dbf
waf: ardupilotwaf: prefix build context methods with ap_
...
It helps to distinguish between things from waf and things from ardupilotwaf.
9 years ago
Gustavo Jose de Sousa
a2d2661765
waf: use methods from bld instead of ardupilotwaf for the remaining
9 years ago
Gustavo Jose de Sousa
3d22490397
waf: examples: use methods from bld instead of ardupilotwaf
9 years ago
Gustavo Jose de Sousa
d281067bcc
waf: make example binaries be placed in 'examples' dir
...
This commit makes examples' wscripts use ardupilotwaf.example() instead of
ardupilot.program().
9 years ago
Andrew Tridgell
60af7a6087
AP_Math: removed matrix3 parameter support
9 years ago
Andrew Tridgell
16e0a6d7b0
AP_Math: fixed angle between two vector3s
9 years ago