Skip to content

Commit a445fb3

Browse files
committed
refactor(math): make SE3Transform composition a hidden friend
Define operator* as an inline friend, matching Quaternion, Matrix and Complex, as flagged by SonarCloud (cpp:S2807). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q53m7MZDmHwocmKbhhd2o5
1 parent cc806a4 commit a445fb3

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎numerical/math/SE3Transform.hpp‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ namespace math
2626
Vector3<T> translation{};
2727

2828
static SE3Transform Identity();
29-
OPTIMIZE_FOR_SPEED SE3Transform operator*(const SE3Transform& rhs) const;
29+
30+
[[nodiscard]] OPTIMIZE_FOR_SPEED friend SE3Transform operator*(const SE3Transform& lhs, const SE3Transform& rhs)
31+
{
32+
return { lhs.rotation * rhs.rotation, lhs.rotation * rhs.translation + lhs.translation };
33+
}
34+
3035
SE3Transform Inverse() const;
3136
OPTIMIZE_FOR_SPEED Vector3<T> Apply(const Vector3<T>& point) const;
3237
Vector3<T> Rotate(const Vector3<T>& direction) const;
@@ -55,12 +60,6 @@ namespace math
5560
return {};
5661
}
5762

58-
template<typename T>
59-
OPTIMIZE_FOR_SPEED SE3Transform<T> SE3Transform<T>::operator*(const SE3Transform& rhs) const
60-
{
61-
return { rotation * rhs.rotation, rotation * rhs.translation + translation };
62-
}
63-
6463
template<typename T>
6564
SE3Transform<T> SE3Transform<T>::Inverse() const
6665
{

0 commit comments

Comments
 (0)