[wpimath] Make C++ geometry classes immutable (#3249)

This commit is contained in:
Prateek Machiraju
2021-03-19 16:38:54 -04:00
committed by GitHub
parent da96707dca
commit d3e45c297c
8 changed files with 2 additions and 126 deletions

View File

@@ -110,18 +110,6 @@ class Translation2d {
*/
Translation2d operator+(const Translation2d& other) const;
/**
* Adds the new translation to the current translation.
*
* This is similar to the + operator, except that the current object is
* mutated.
*
* @param other The translation to add.
*
* @return The reference to the new mutated object.
*/
Translation2d& operator+=(const Translation2d& other);
/**
* Subtracts the other translation from the other translation and returns the
* difference.
@@ -135,18 +123,6 @@ class Translation2d {
*/
Translation2d operator-(const Translation2d& other) const;
/**
* Subtracts the new translation from the current translation.
*
* This is similar to the - operator, except that the current object is
* mutated.
*
* @param other The translation to subtract.
*
* @return The reference to the new mutated object.
*/
Translation2d& operator-=(const Translation2d& other);
/**
* Returns the inverse of the current translation. This is equivalent to
* rotating by 180 degrees, flipping the point over both axes, or simply
@@ -167,17 +143,6 @@ class Translation2d {
*/
Translation2d operator*(double scalar) const;
/**
* Multiplies the current translation by a scalar.
*
* This is similar to the * operator, except that current object is mutated.
*
* @param scalar The scalar to multiply by.
*
* @return The reference to the new mutated object.
*/
Translation2d& operator*=(double scalar);
/**
* Divides the translation by a scalar and returns the new translation.
*
@@ -205,17 +170,6 @@ class Translation2d {
*/
bool operator!=(const Translation2d& other) const;
/*
* Divides the current translation by a scalar.
*
* This is similar to the / operator, except that current object is mutated.
*
* @param scalar The scalar to divide by.
*
* @return The reference to the new mutated object.
*/
Translation2d& operator/=(double scalar);
private:
units::meter_t m_x = 0_m;
units::meter_t m_y = 0_m;