Commit Graph

738 Commits

Author SHA1 Message Date
Andrew Tridgell 4d65cda0ea AP_Math: added quaternion->matrix and earth frame routines
this will be used for 3d acceleration
2012-03-10 10:34:31 +11:00
Andrew Tridgell 8abbbe5713 AP_Math: better way of handling safe_sqrt()
better to test the result, than predict it
2012-03-10 10:34:31 +11:00
Andrew Tridgell 1ec4c0777c Math: added comment on quaternion constructor 2012-03-10 10:34:30 +11:00
Andrew Tridgell f5e6dc0757 Math: added is_inf() on vector3f 2012-03-10 10:34:30 +11:00
Andrew Tridgell c7d5f06b21 AP_Math: added quaternion helper functions and a test suite 2012-03-10 10:34:30 +11:00
Andrew Tridgell 145fc91701 AP_Math: added a .zero() method to Vector3f 2012-03-10 10:34:28 +11:00
Andrew Tridgell 16ed8bc8f6 AP_Math: added rotmat <-> euler functions
these will make the dcm matrix manipulation easier to understand
2012-02-24 11:52:55 +11:00
Andrew Tridgell 17d16bc8c6 AP_Math: added safe_sqrt() function
this function will never return NAN. It will return zero for negative
numbers.
2012-02-24 11:52:55 +11:00
Andrew Tridgell 502fbf6e17 AP_Math: added a safe_asin() function
this adds range checking to asin()
2012-02-24 11:52:55 +11:00
Andrew Tridgell 17170da96e AP_Math: added is_nan() methods to vector3f and matrix3f 2012-02-24 11:52:55 +11:00
Andrew Tridgell 882cd4ea83 AP_Param: moved AP_Vector3f and AP_Matrix3f declarations to AP_Math.h
this avoids us needing AP_Math.h in every utility sketch and example
2012-02-18 10:51:57 +11:00
Andrew Tridgell 11b8d56434 added comment in polygon code 2011-12-21 23:31:38 +11:00
Andrew Tridgell e7568db237 fixed comment 2011-12-19 20:52:59 +11:00
Andrew Tridgell 6efa2e53cb AP_Math: re-work polygon algorithm for perfect precision
using sign checking and 64 bit integer math only when needed results
in an algorithm that is just as fast as the floating point version,
but has perfect results for any representable lat/lng
2011-12-19 18:52:56 +11:00
Andrew Tridgell a3a0e5646f polygon: improve the speed and precision of the polygon algorithm
now takes 156 usec per test, with a 11 point boundary
2011-12-18 12:59:50 +11:00
Andrew Tridgell 42522baf9f geofence: store fence points as int32_t
this keeps maximum precision in fence boundaries
2011-12-16 20:11:51 +11:00
Andrew Tridgell 9b6bab8904 AP_Math: better polygon algorithm
this one seems to do better with single precision floating point
2011-12-16 20:11:51 +11:00
Andrew Tridgell 62e92f406e AP_Math: make out vector and matrix elements used types with fixed sizes
this prevents differences between CPU types
2011-12-16 20:09:11 +11:00
Andrew Tridgell 85e295332f AP_Math: added Polygon_complete() function
used to veryify user supplied boundaries
2011-12-15 14:42:34 +11:00
Andrew Tridgell 117a98f9a2 AP_Math: added a Polygon_outside() function
this tests if a point is outside of a polygon. This will be used as
part of our geo-fencing support, and also for a new 'fenced mode'
2011-12-15 14:34:58 +11:00
James Goppert 0c7c508541 Optional recursion added. 2011-09-30 17:17:51 -04:00
James Goppert 5489b84f8e Improvements to cmake. 2011-09-29 21:23:26 -04:00
James Goppert d887a28b91 Added ArduBoat/ ArduRover/ and APO library. 2011-09-29 14:12:15 -04:00
unknown a4e001bbcf Adding CMake support 2011-09-14 15:44:55 +02:00
jasonshort 7521ceed61 Vector3<T>() { x = y = x = 0; }
changed to :
	Vector3<T>() { x = y = z = 0; }

git-svn-id: https://arducopter.googlecode.com/svn/trunk@2600 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-06-20 16:31:31 +00:00
DrZiplok@gmail.com f10cbb011f ::transposed does not change the matrix; make it const.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1648 f9c3cf11-9bcb-44bc-f272-b75c42450872
2011-02-14 04:26:05 +00:00
DrZiplok@gmail.com 75e78dabae Back out the memset optimisation. It helps with code size but causes inexplicable link-time failures (undefined references to __cxa_pure_virtual).
Thank you very much Mr GCC.  Can I have my evening back?


git-svn-id: https://arducopter.googlecode.com/svn/trunk@1352 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-29 03:09:29 +00:00
DrZiplok@gmail.com 290635b354 Minor code size optimisation; use memset to zero *this rather than explicitly assigning zero to the vector elements. Still not quite optimal for matrix3 as it gets three memsets, but still cheaper in terms of code size.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1212 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-12-20 01:52:23 +00:00
rmackay9@yahoo.com e930dacb4d AP_Math - initialise vector2 and vector3 x,y,z values to zero. Doug found (and I confirmed) that if vectors or matrices were declared in a function (i.e. a local variable), they would often have non-zero values. Global declarations don't have this problem - it's a C++ performance thing it seems.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@878 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-11-22 02:29:15 +00:00
rmackay9@yahoo.com 8708675b1f added constructor with 9 elements to matrix3.h
corrected matrix * vector function.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@551 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-25 02:43:11 +00:00
DrZiplok@gmail.com 7721e622aa Rather than subclassing from the templated classes, just typedef directly to them.
This should solve the issues related to assigning to the convenience types.


git-svn-id: https://arducopter.googlecode.com/svn/trunk@543 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-23 05:45:43 +00:00
rmackay9@yahoo.com 15e6469ca9 added downcasting to MATRIX3_CTORS. this fixes some problems with setting the results from a formula to a variable (i..e m1 = m2*2).
git-svn-id: https://arducopter.googlecode.com/svn/trunk@541 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-23 05:39:50 +00:00
rmackay9@yahoo.com b3e1b6c57d minor corrections to the operator *= and constructor so that matrix can be more easily created from vector objects
git-svn-id: https://arducopter.googlecode.com/svn/trunk@540 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-23 03:14:15 +00:00
DrZiplok@gmail.com ac2e14c4ec Remove a bunch of probably wrong const cruft. Ditch the dubious array index operators from vector2.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@538 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-22 17:41:49 +00:00
DrZiplok@gmail.com 815e5f871a Remove the trivial operator= implementations, the default shallow copy is fine.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@537 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-22 16:32:38 +00:00
DrZiplok@gmail.com 646045ef44 Some minor fixes prompted while looking at the code for other reasons.
Return non-const values from assignment.  Fix operator* for matrix3.



git-svn-id: https://arducopter.googlecode.com/svn/trunk@536 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-22 16:15:26 +00:00
DrZiplok@gmail.com b918f21567 Replace the questionable rotation operation with a conventional transposition.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@442 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-08 08:41:29 +00:00
DrZiplok@gmail.com 097161cd8d Beginnings of a math library for ArduPilot(Mega) systems.
The vector classes are light adaptations of work by Bill Perone
(billperone@yahoo.com), the Matrix3 class draws on them for
inspiration.

Bill's matrix classes are too heavyweight and not templated, so
they're less suitable for us here.

This code compiles, and some trivial tests seem to work, but
it should not be considered "golden" yet.



git-svn-id: https://arducopter.googlecode.com/svn/trunk@441 f9c3cf11-9bcb-44bc-f272-b75c42450872
2010-09-08 08:21:46 +00:00