[wpimath] Memoize CoordinateSystem and CoordinateAxis statics (#4241)

This commit is contained in:
Tyler Veness
2022-05-18 10:47:46 -07:00
committed by GitHub
parent 5983434a70
commit 5876b40f08
6 changed files with 62 additions and 39 deletions

View File

@@ -37,32 +37,32 @@ class WPILIB_DLLEXPORT CoordinateAxis {
/**
* Returns a coordinate axis corresponding to +X in the NWU coordinate system.
*/
static CoordinateAxis N();
static const CoordinateAxis& N();
/**
* Returns a coordinate axis corresponding to -X in the NWU coordinate system.
*/
static CoordinateAxis S();
static const CoordinateAxis& S();
/**
* Returns a coordinate axis corresponding to -Y in the NWU coordinate system.
*/
static CoordinateAxis E();
static const CoordinateAxis& E();
/**
* Returns a coordinate axis corresponding to +Y in the NWU coordinate system.
*/
static CoordinateAxis W();
static const CoordinateAxis& W();
/**
* Returns a coordinate axis corresponding to +Z in the NWU coordinate system.
*/
static CoordinateAxis U();
static const CoordinateAxis& U();
/**
* Returns a coordinate axis corresponding to -Z in the NWU coordinate system.
*/
static CoordinateAxis D();
static const CoordinateAxis& D();
private:
friend class CoordinateSystem;

View File

@@ -42,21 +42,21 @@ class WPILIB_DLLEXPORT CoordinateSystem {
*
* The +X axis is north, the +Y axis is west, and the +Z axis is up.
*/
static CoordinateSystem NWU();
static const CoordinateSystem& NWU();
/**
* Returns an instance of the East-Down-North (EDN) coordinate system.
*
* The +X axis is east, the +Y axis is down, and the +Z axis is north.
*/
static CoordinateSystem EDN();
static const CoordinateSystem& EDN();
/**
* Returns an instance of the NED coordinate system.
*
* The +X axis is north, the +Y axis is east, and the +Z axis is down.
*/
static CoordinateSystem NED();
static const CoordinateSystem& NED();
/**
* Converts the given pose from one coordinate system to another.