Allow AngleAxisRotatePoint to be applied in-place

Thanks to @CatInTheRain for the suggestion.

Fixes #1163

Change-Id: I4e148c62891979e1ec01b91f95d3e2d04501c8ef
This commit is contained in:
Sergiu Deitsch
2025-06-10 23:14:28 +02:00
parent 9c22db814c
commit 4148d6a353
2 changed files with 36 additions and 28 deletions
+3 -3
View File
@@ -282,8 +282,7 @@ inline T DotProduct(const T x[3], const T y[3]);
// y = R(angle_axis) * x;
//
// Inplace rotation is not supported. pt and result must point to different
// memory locations, otherwise the result will be undefined.
// Inplace rotation is supported.
template <typename T>
inline void AngleAxisRotatePoint(const T angle_axis[3],
const T pt[3],
@@ -791,9 +790,10 @@ template <typename T>
inline void AngleAxisRotatePoint(const T angle_axis[3],
const T pt[3],
T result[3]) {
DCHECK_NE(pt, result) << "Inplace rotation is not supported.";
using std::cos;
using std::fpclassify;
using std::hypot;
using std::sin;
const T theta = hypot(angle_axis[0], angle_axis[1], angle_axis[2]);