Skip to content

Commit 5fe424d

Browse files
authored
Merge pull request #7680 from artificiel/squared
rename length2 to lengthSquared
2 parents 4a26143 + a6444a1 commit 5fe424d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

libs/openFrameworks/math/ofQuaternion.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ class ofQuaternion {
100100
inline float length() const;
101101

102102
/// \brief Length of the quaternion = vec . vec
103-
inline float length2() const;
104-
103+
inline float lengthSquared() const;
104+
[[deprecated("use lengthSquare")]] inline float length2() const { return lengthSquared(); };
105+
105106
/// \brief Conjugate
106107
inline ofQuaternion conj() const;
107108

@@ -459,13 +460,11 @@ float ofQuaternion::length() const {
459460
return std::sqrt(_v.x*_v.x + _v.y*_v.y + _v.z*_v.z + _v.w*_v.w);
460461
}
461462

462-
463463
//----------------------------------------
464-
float ofQuaternion::length2() const {
465-
return _v.x*_v.x + _v.y*_v.y + _v.z*_v.z + _v.w*_v.w;
464+
float ofQuaternion::lengthSquared() const {
465+
return _v.x*_v.x + _v.y*_v.y + _v.z*_v.z + _v.w*_v.w;
466466
}
467467

468-
469468
//----------------------------------------
470469
ofQuaternion ofQuaternion::conj() const {
471470
return ofQuaternion(-_v.x, -_v.y, -_v.z, _v.w);
@@ -474,7 +473,7 @@ ofQuaternion ofQuaternion::conj() const {
474473

475474
//----------------------------------------
476475
const ofQuaternion ofQuaternion::inverse() const {
477-
return conj() / length2();
476+
return conj() / lengthSquared();
478477
}
479478

480479

0 commit comments

Comments
 (0)