mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpimath] Add scalar multiply and divide operators to all geometry classes (#4438)
Closes #4435.
This commit is contained in:
@@ -74,7 +74,7 @@ class WPILIB_DLLEXPORT Transform2d {
|
||||
Transform2d Inverse() const;
|
||||
|
||||
/**
|
||||
* Scales the transform by the scalar.
|
||||
* Multiplies the transform by the scalar.
|
||||
*
|
||||
* @param scalar The scalar.
|
||||
* @return The scaled Transform2d.
|
||||
@@ -83,6 +83,14 @@ class WPILIB_DLLEXPORT Transform2d {
|
||||
return Transform2d(m_translation * scalar, m_rotation * scalar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Divides the transform by the scalar.
|
||||
*
|
||||
* @param scalar The scalar.
|
||||
* @return The scaled Transform2d.
|
||||
*/
|
||||
Transform2d operator/(double scalar) const { return *this * (1.0 / scalar); }
|
||||
|
||||
/**
|
||||
* Composes two transformations.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user