diff --git a/Cartesian.cpp b/Cartesian.cpp index c75e27a..8775c5a 100644 --- a/Cartesian.cpp +++ b/Cartesian.cpp @@ -176,6 +176,22 @@ int Cartesian::invert(int a) { return -a; } double Cartesian::invert(double aa) { return -aa; } +void Cartesian::transpose(void) { + double zz = 0.0; + zz = xx; + xx = yy; + yy = zz; + concordanceDouble(); + return; } + +Cartesian Cartesian::transpose(Cartesian carte) { + double zz = 0.0; + zz = carte.xx; + carte.xx = carte.yy; + carte.yy = zz; + carte.concordanceDouble(); + return carte; } + double Cartesian::distanceDouble(void) { double dd = sqrt((xx * xx) + (yy * yy)); if ((xx < 0) && (yy > 0)) dd = -dd; diff --git a/Cartesian.hpp b/Cartesian.hpp index 7480b6d..1371cc4 100644 --- a/Cartesian.hpp +++ b/Cartesian.hpp @@ -77,6 +77,10 @@ class Cartesian int invert(int a); double invert(double aa); + // Transpose x coordinate and y coordinate + void transpose(void); + Cartesian transpose(Cartesian carte); + // Calculate distance from current position to... int distanceInt(void); // origin double distanceDouble(void);