Package org.joml
Class AxisAngle4f
- java.lang.Object
-
- org.joml.AxisAngle4f
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,java.lang.Cloneable
public class AxisAngle4f extends java.lang.Object implements java.io.Externalizable, java.lang.Cloneable
Represents a 3D rotation of a given radians about an axis represented as an unit 3D vector.This class uses single-precision components.
- Author:
- Kai Burjack
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AxisAngle4f()
Create a newAxisAngle4f
with zero rotation about(0, 0, 1)
.AxisAngle4f(float angle, float x, float y, float z)
Create a newAxisAngle4f
with the given values.AxisAngle4f(float angle, Vector3fc v)
Create a newAxisAngle4f
with the given values.AxisAngle4f(AxisAngle4f a)
Create a newAxisAngle4f
with the same values ofa
.AxisAngle4f(Quaternionfc q)
Create a newAxisAngle4f
from the givenQuaternionfc
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
boolean
equals(java.lang.Object obj)
AxisAngle4d
get(AxisAngle4d dest)
Set the givenAxisAngle4d
to thisAxisAngle4f
.AxisAngle4f
get(AxisAngle4f dest)
Set the givenAxisAngle4f
to thisAxisAngle4f
.Matrix3d
get(Matrix3d m)
Set the givenMatrix3d
to a rotation transformation equivalent to thisAxisAngle4f
.Matrix3f
get(Matrix3f m)
Set the givenMatrix3f
to a rotation transformation equivalent to thisAxisAngle4f
.Matrix4d
get(Matrix4d m)
Set the givenMatrix4d
to a rotation transformation equivalent to thisAxisAngle4f
.Matrix4f
get(Matrix4f m)
Set the givenMatrix4f
to a rotation transformation equivalent to thisAxisAngle4f
.Quaterniond
get(Quaterniond q)
Set the givenQuaterniond
to be equivalent to thisAxisAngle4f
rotation.Quaternionf
get(Quaternionf q)
Set the givenQuaternionf
to be equivalent to thisAxisAngle4f
rotation.int
hashCode()
AxisAngle4f
normalize()
Normalize the axis vector.void
readExternal(java.io.ObjectInput in)
AxisAngle4f
rotate(float ang)
Increase the rotation angle by the given amount.AxisAngle4f
set(float angle, float x, float y, float z)
Set thisAxisAngle4f
to the given values.AxisAngle4f
set(float angle, Vector3fc v)
Set thisAxisAngle4f
to the given values.AxisAngle4f
set(AxisAngle4d a)
Set thisAxisAngle4f
to the values ofa
.AxisAngle4f
set(AxisAngle4f a)
Set thisAxisAngle4f
to the values ofa
.AxisAngle4f
set(Matrix3dc m)
Set thisAxisAngle4f
to be equivalent to the rotation of the givenMatrix3dc
.AxisAngle4f
set(Matrix3fc m)
Set thisAxisAngle4f
to be equivalent to the rotation of the givenMatrix3fc
.AxisAngle4f
set(Matrix4dc m)
Set thisAxisAngle4f
to be equivalent to the rotational component of the givenMatrix4dc
.AxisAngle4f
set(Matrix4fc m)
Set thisAxisAngle4f
to be equivalent to the rotational component of the givenMatrix4fc
.AxisAngle4f
set(Matrix4x3fc m)
Set thisAxisAngle4f
to be equivalent to the rotational component of the givenMatrix4x3fc
.AxisAngle4f
set(Quaterniondc q)
Set thisAxisAngle4f
to be equivalent to the givenQuaterniondc
.AxisAngle4f
set(Quaternionfc q)
Set thisAxisAngle4f
to be equivalent to the givenQuaternionfc
.java.lang.String
toString()
Return a string representation of thisAxisAngle4f
.java.lang.String
toString(java.text.NumberFormat formatter)
Return a string representation of thisAxisAngle4f
by formatting the components with the givenNumberFormat
.Vector3f
transform(Vector3f v)
Transform the given vector by the rotation transformation described by thisAxisAngle4f
.Vector3f
transform(Vector3fc v, Vector3f dest)
Transform the given vector by the rotation transformation described by thisAxisAngle4f
and store the result indest
.Vector4f
transform(Vector4f v)
Transform the given vector by the rotation transformation described by thisAxisAngle4f
.Vector4f
transform(Vector4fc v, Vector4f dest)
Transform the given vector by the rotation transformation described by thisAxisAngle4f
and store the result indest
.void
writeExternal(java.io.ObjectOutput out)
-
-
-
Constructor Detail
-
AxisAngle4f
public AxisAngle4f()
Create a newAxisAngle4f
with zero rotation about(0, 0, 1)
.
-
AxisAngle4f
public AxisAngle4f(AxisAngle4f a)
Create a newAxisAngle4f
with the same values ofa
.- Parameters:
a
- the AngleAxis4f to copy the values from
-
AxisAngle4f
public AxisAngle4f(Quaternionfc q)
- Parameters:
q
- the quaternion from which to create the new AngleAxis4f
-
AxisAngle4f
public AxisAngle4f(float angle, float x, float y, float z)
Create a newAxisAngle4f
with the given values.- Parameters:
angle
- the angle in radiansx
- the x-coordinate of the rotation axisy
- the y-coordinate of the rotation axisz
- the z-coordinate of the rotation axis
-
AxisAngle4f
public AxisAngle4f(float angle, Vector3fc v)
Create a newAxisAngle4f
with the given values.- Parameters:
angle
- the angle in radiansv
- the rotation axis as aVector3f
-
-
Method Detail
-
set
public AxisAngle4f set(AxisAngle4f a)
Set thisAxisAngle4f
to the values ofa
.- Parameters:
a
- the AngleAxis4f to copy the values from- Returns:
- this
-
set
public AxisAngle4f set(AxisAngle4d a)
Set thisAxisAngle4f
to the values ofa
.- Parameters:
a
- the AngleAxis4d to copy the values from- Returns:
- this
-
set
public AxisAngle4f set(float angle, float x, float y, float z)
Set thisAxisAngle4f
to the given values.- Parameters:
angle
- the angle in radiansx
- the x-coordinate of the rotation axisy
- the y-coordinate of the rotation axisz
- the z-coordinate of the rotation axis- Returns:
- this
-
set
public AxisAngle4f set(float angle, Vector3fc v)
Set thisAxisAngle4f
to the given values.- Parameters:
angle
- the angle in radiansv
- the rotation axis as aVector3f
- Returns:
- this
-
set
public AxisAngle4f set(Quaternionfc q)
Set thisAxisAngle4f
to be equivalent to the givenQuaternionfc
.- Parameters:
q
- the quaternion to set this AngleAxis4f from- Returns:
- this
-
set
public AxisAngle4f set(Quaterniondc q)
Set thisAxisAngle4f
to be equivalent to the givenQuaterniondc
.- Parameters:
q
- the quaternion to set this AngleAxis4f from- Returns:
- this
-
set
public AxisAngle4f set(Matrix3fc m)
Set thisAxisAngle4f
to be equivalent to the rotation of the givenMatrix3fc
.Reference: http://www.euclideanspace.com
- Parameters:
m
- the Matrix3fc to set this AngleAxis4f from- Returns:
- this
-
set
public AxisAngle4f set(Matrix3dc m)
Set thisAxisAngle4f
to be equivalent to the rotation of the givenMatrix3dc
.Reference: http://www.euclideanspace.com
- Parameters:
m
- the Matrix3d to set this AngleAxis4f from- Returns:
- this
-
set
public AxisAngle4f set(Matrix4fc m)
Set thisAxisAngle4f
to be equivalent to the rotational component of the givenMatrix4fc
.Reference: http://www.euclideanspace.com
- Parameters:
m
- the Matrix4fc to set this AngleAxis4f from- Returns:
- this
-
set
public AxisAngle4f set(Matrix4x3fc m)
Set thisAxisAngle4f
to be equivalent to the rotational component of the givenMatrix4x3fc
.Reference: http://www.euclideanspace.com
- Parameters:
m
- the Matrix4x3fc to set this AngleAxis4f from- Returns:
- this
-
set
public AxisAngle4f set(Matrix4dc m)
Set thisAxisAngle4f
to be equivalent to the rotational component of the givenMatrix4dc
.Reference: http://www.euclideanspace.com
- Parameters:
m
- the Matrix4dc to set this AngleAxis4f from- Returns:
- this
-
get
public Quaternionf get(Quaternionf q)
Set the givenQuaternionf
to be equivalent to thisAxisAngle4f
rotation.- Parameters:
q
- the quaternion to set- Returns:
- q
- See Also:
Quaternionf.set(AxisAngle4f)
-
get
public Quaterniond get(Quaterniond q)
Set the givenQuaterniond
to be equivalent to thisAxisAngle4f
rotation.- Parameters:
q
- the quaternion to set- Returns:
- q
- See Also:
Quaterniond.set(AxisAngle4f)
-
get
public Matrix4f get(Matrix4f m)
Set the givenMatrix4f
to a rotation transformation equivalent to thisAxisAngle4f
.- Parameters:
m
- the matrix to set- Returns:
- m
- See Also:
Matrix4f.set(AxisAngle4f)
-
get
public Matrix3f get(Matrix3f m)
Set the givenMatrix3f
to a rotation transformation equivalent to thisAxisAngle4f
.- Parameters:
m
- the matrix to set- Returns:
- m
- See Also:
Matrix3f.set(AxisAngle4f)
-
get
public Matrix4d get(Matrix4d m)
Set the givenMatrix4d
to a rotation transformation equivalent to thisAxisAngle4f
.- Parameters:
m
- the matrix to set- Returns:
- m
- See Also:
Matrix4f.set(AxisAngle4f)
-
get
public Matrix3d get(Matrix3d m)
Set the givenMatrix3d
to a rotation transformation equivalent to thisAxisAngle4f
.- Parameters:
m
- the matrix to set- Returns:
- m
- See Also:
Matrix3f.set(AxisAngle4f)
-
get
public AxisAngle4d get(AxisAngle4d dest)
Set the givenAxisAngle4d
to thisAxisAngle4f
.- Parameters:
dest
- will hold the result- Returns:
- dest
-
get
public AxisAngle4f get(AxisAngle4f dest)
Set the givenAxisAngle4f
to thisAxisAngle4f
.- Parameters:
dest
- will hold the result- Returns:
- dest
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Specified by:
readExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
normalize
public AxisAngle4f normalize()
Normalize the axis vector.- Returns:
- this
-
rotate
public AxisAngle4f rotate(float ang)
Increase the rotation angle by the given amount.This method also takes care of wrapping around.
- Parameters:
ang
- the angle increase- Returns:
- this
-
transform
public Vector3f transform(Vector3f v)
Transform the given vector by the rotation transformation described by thisAxisAngle4f
.- Parameters:
v
- the vector to transform- Returns:
- v
-
transform
public Vector3f transform(Vector3fc v, Vector3f dest)
Transform the given vector by the rotation transformation described by thisAxisAngle4f
and store the result indest
.- Parameters:
v
- the vector to transformdest
- will hold the result- Returns:
- dest
-
transform
public Vector4f transform(Vector4f v)
Transform the given vector by the rotation transformation described by thisAxisAngle4f
.- Parameters:
v
- the vector to transform- Returns:
- v
-
transform
public Vector4f transform(Vector4fc v, Vector4f dest)
Transform the given vector by the rotation transformation described by thisAxisAngle4f
and store the result indest
.- Parameters:
v
- the vector to transformdest
- will hold the result- Returns:
- dest
-
toString
public java.lang.String toString()
Return a string representation of thisAxisAngle4f
.This method creates a new
DecimalFormat
on every invocation with the format string "0.000E0;-
".- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation
-
toString
public java.lang.String toString(java.text.NumberFormat formatter)
Return a string representation of thisAxisAngle4f
by formatting the components with the givenNumberFormat
.- Parameters:
formatter
- theNumberFormat
used to format the vector components with- Returns:
- the string representation
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-
-