[wpimath] Implement Translation3d.RotateAround (#7661)

This commit is contained in:
HarryXChen
2025-01-09 23:31:34 -05:00
committed by GitHub
parent 995bc98ccf
commit e37c35746a
5 changed files with 94 additions and 1 deletions

View File

@@ -35,7 +35,16 @@ TEST(Translation2dTest, RotateBy) {
const auto rotated = another.RotateBy(90_deg);
EXPECT_NEAR(0.0, rotated.X().value(), 1e-9);
EXPECT_DOUBLE_EQ(3.0, rotated.Y().value());
EXPECT_NEAR(3.0, rotated.Y().value(), 1e-9);
}
TEST(Translation2dTest, RotateAround) {
const Translation2d translation{2_m, 1_m};
const Translation2d other{3_m, 2_m};
const auto rotated = translation.RotateAround(other, 180_deg);
EXPECT_NEAR(4.0, rotated.X().value(), 1e-9);
EXPECT_NEAR(3.0, rotated.Y().value(), 1e-9);
}
TEST(Translation2dTest, Multiplication) {