[wpimath] Add an operator for composing two Transform2ds (#3527)

This commit is contained in:
Tyler Veness
2021-08-23 20:22:48 -07:00
committed by GitHub
parent 2edd510ab7
commit e0c6cd3dcc
5 changed files with 60 additions and 5 deletions

View File

@@ -56,6 +56,15 @@ public class Transform2d {
return new Transform2d(m_translation.times(scalar), m_rotation.times(scalar));
}
/**
* Composes two transformations.
*
* @param other The transform to compose with this one.
*/
public Transform2d plus(Transform2d other) {
return new Transform2d(new Pose2d(), new Pose2d().transformBy(this).transformBy(other));
}
/**
* Returns the translation component of the transformation.
*