Commit Graph

53 Commits

Author SHA1 Message Date
Andrew Tridgell 24d0804249 AP_Math: added rotate() method to Vector2f 2020-07-06 14:46:48 +10:00
Peter Barker dad5b4e903 AP_Math: remove use of Vector2 as function 2020-06-16 11:00:44 +10:00
Randy Mackay f87ae7d445 AP_Math: add vector2f::offset_bearing 2020-01-01 13:38:41 +09:00
Randy Mackay c7ca9c04f8 AP_Math: add comment to vector2f::point_on_segment 2019-08-10 12:21:01 +09:00
Peter Barker 4c434c2df9 AP_Math: add WARN_IF_UNUSED to bool methods 2019-07-26 09:26:02 +09:00
Peter Barker da5d5c9203 AP_Math: add tests for Vector2 2019-06-13 19:36:49 +10:00
Andrew Tridgell a5fd7ac5ca AP_Math: add vector2f::closest_distance_between_line_and_point_squared
also add vector2f::closest_distance_between_line_and_point and vector2f::closest_distance_between_lines_squared
2019-06-11 13:13:22 +09:00
Andrew Tridgell 2457bf71d4 AP_Math: add simplified vector2f::closest_point
this simpler version assumes the line segment originates at the origin
2019-06-11 13:13:22 +09:00
Andrew Tridgell c8e49259a0 AP_Math: add vector2f::closest_distance_between_radian_and_point_squared 2019-06-11 13:13:22 +09:00
Andrew Tridgell dbf337e1b3 AP_Math: move closest_point to cpp 2019-06-11 13:13:22 +09:00
Andrew Tridgell bfc28dfde9 AP_Math: move normalize, reflect, project and perpendicular to cpp 2019-06-11 13:13:22 +09:00
Andrew Tridgell 01e541b7d1 AP_Math: minor formatting changes to length method 2019-06-11 13:13:22 +09:00
Andrew Tridgell 4c4de1f021 AP_Math: vector2f::length_squared always returns float 2019-06-11 13:13:22 +09:00
Andrew Tridgell 46617e6c72 AP_Math: remove unused include from Vector2 2019-06-11 13:13:22 +09:00
Andrew Tridgell 69781cda42 AP_Math: add Vector2::angle 2019-06-11 13:13:22 +09:00
Pierre Kancir 9e927d1376 AP_Math: correct copyright, add pragma-once 2019-02-06 23:20:07 +11:00
Pierre Kancir f1270b4b22 AP_Math: const correctness 2018-12-22 08:39:06 +09:00
Peter Barker 154d771e6c AP_Math: correct compilation when running MATH_CHECK_INDEXES 2018-10-19 08:46:43 +11:00
Peter Barker fa5757f618 AP_Math: fix float-equals warnings 2018-08-15 12:16:49 +10:00
Peter Barker 626467db14 AP_Math: add tests for line intersection 2018-08-14 19:41:45 +10:00
Randy Mackay c28cfcdc27 AP_Math: add Vector2f::circle_segment_intersection 2018-01-22 17:18:41 +09:00
Randy Mackay a655c36159 AP_Math: add Vector2f::segment_intersection 2018-01-22 17:18:41 +09:00
Andrew Tridgell 3d2c4ffa79 AP_Math: allow write to indexed vector2 2018-01-15 11:46:02 +11:00
Randy Mackay db45442de2 AP_Math: remove unused angle method 2017-06-09 15:21:58 +09:00
Michael du Breuil c5c94949bf AP_Math: Extend vector2::angle(vector2) to distinguish parallel and antiparallel vectors
There are a number of use cases where distingusihing antiparallel from parallel vectors is important
2017-03-02 00:50:44 +00:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Peter Barker 2047d53470 Math: move closest_point in from AC_Avoid 2016-07-25 20:24:37 +09:00
Peter Barker f6cb0ffb6f AP_Math: add Vector2f perpendicular
Add closest_distance_between_radial_and_point function
2016-07-25 20:24:37 +09:00
Peter Barker b6d0b028c3 AP_Math: add operator[] to Vector2 2016-07-25 20:24:37 +09:00
Gustavo Jose de Sousa 3b05ec1157 AP_Math: make vectors and matrix constructors constexpr
That allows some object to be constructed at compile time.
2016-05-16 19:08:36 -03:00
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00
Lucas De Marchi b4a8a0b961 AP_Math: replace header guard with pragma once 2016-03-16 18:40:41 +11:00
Randy Mackay 39340e70f8 Math: add Vector2 is_zero method 2015-09-16 15:10:25 +09:00
Andrew Tridgell 009913ec60 AP_Math: make is_nan const for quaternion and add .zero() for vector2 2014-02-21 20:24:47 +11:00
Andrew Tridgell 97b7130bb9 libraries: update license header to GPLv3
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Andrew Tridgell 5024da2695 AP_Math: fixed indent-tabs-mode 2013-05-30 09:51:51 +10:00
Andrew Tridgell 737f0305ef AP_Math: implement vector2 cross product
useful in DCM for faster yaw correction
2013-05-05 13:47:51 +10:00
Andrew Tridgell 43c3c60de2 AP_Math: moved a lot of vector templates to cpp from .h
this reduces the code size quite a lot on AVR
2013-04-12 12:48:08 +10:00
Andrew Tridgell 2d29a6a7be AP_Math: added Vector2f.angle()
useful for calculating the vector in polar coordinates
2013-04-12 12:48:08 +10:00
James Bielman 5631f865b2 Update floating point calculations to use floats instead of doubles.
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
Andrew Tridgell a072afa223 AP_Math: expand some macros into functions
this saves some flash
2012-12-20 14:52:38 +11:00
uncrustify 652b490345 uncrustify libraries/AP_Math/vector2.h 2012-08-21 19:03:34 -07:00
Andrew Tridgell 468dfe3faa AP_Math: the windows arduino build is missing acosf() 2012-07-04 14:14:58 +10:00
Andrew Tridgell dd200cba31 Math: added location functions to math library
these do common calculations on struct Location
2012-07-04 12:42:46 +10: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
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
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
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