diff options
author | Sven Gothel <[email protected]> | 2023-08-27 12:57:10 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-08-27 13:09:44 +0200 |
commit | 9ed41468fbf3d93555ac6c16630b25220f55aa39 (patch) | |
tree | 61b5eed02be608be8f6a7af8742ff5b44ef82cf4 /src/jogl | |
parent | c13fed83f20db55ee0b0b548ef6526a95fd2d6c4 (diff) |
Quaternion: Add rotateByAngleNormalAxis(..) variant using Vec3f axis
Diffstat (limited to 'src/jogl')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/math/Quaternion.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java index a285774f8..9548a160a 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java @@ -75,7 +75,7 @@ public class Quaternion { } /** - * Return the magnitude of this quaternion, i.e. sqrt({@link #magnitude()}) + * Return the magnitude of this quaternion, i.e. sqrt({@link #magnitudeSquared()}) * <p> * A magnitude of zero shall equal {@link #isIdentity() identity}, * as performed by {@link #normalize()}. @@ -346,6 +346,23 @@ public class Quaternion { } /** + * Rotate this quaternion by the given angle and axis. + * <p> + * The axis must be a normalized vector. + * </p> + * <p> + * A rotational quaternion is made from the given angle and axis. + * </p> + * + * @param angle in radians + * @param axis Vec3f coord of rotation axis + * @return this quaternion for chaining. + */ + public Quaternion rotateByAngleNormalAxis(final float angle, final Vec3f axis) { + return rotateByAngleNormalAxis(angle, axis.x(), axis.y(), axis.z()); + } + + /** * Rotate this quaternion around X axis with the given angle in radians * * @param angle in radians |