public class AxisAngle extends java.lang.Object implements Clonable
In order to keep the representation unique, the axis is normalized and the
angle is kept in the range 0 <=
angle <
Math.PI.
Modifier and Type | Field and Description |
---|---|
double |
angle
Angle of rotation about the axis, in radians.
|
Vector3d |
axis
Rotation axis.
|
static AxisAngle |
IDENTITY |
static AxisAngle |
ROT_X_90 |
static AxisAngle |
ROT_Y_90 |
static AxisAngle |
ROT_Z_90 |
static AxisAngle |
ZERO |
Constructor and Description |
---|
AxisAngle()
Creates an AxisAngle and initializes it to the identity rotation.
|
AxisAngle(AxisAngle axisAng)
Creates an AxisAngle and initializes it from an existing AxisAngle.
|
AxisAngle(double[] values)
Creates an AxisAngle and initializes it to the prescribed values.
|
AxisAngle(double x,
double y,
double z,
double ang)
Creates an AxisAngle and initializes it to the prescribed values.
|
AxisAngle(RotationMatrix3d R)
Creates an AxisAngle initialized to the specified rotation
matrix.
|
AxisAngle(Vector3d axis,
double ang)
Creates an AxisAngle and sets it to the prescribed values.
|
Modifier and Type | Method and Description |
---|---|
AxisAngle |
clone() |
boolean |
epsilonEquals(AxisAngle axisAng,
double eps)
Returns true if the elements of this AxisAngle equal those of another
AxisAngle within a prescribed tolerance
epsilon . |
boolean |
equals(AxisAngle axisAng)
Returns true if the elements of this AxisAngle equal those of another
AxisAngle exactly.
|
boolean |
equals(java.lang.Object obj)
Returns true if the supplied object is an AxisAngle and its elements equal
those of this AxisAngle exactly.
|
void |
get(double[] values)
Gets the values associated with this AxisAngle.
|
void |
inverseTransform(Vector3d vr,
Vector3d v1)
Transforms a vector v1 by the rotation implied by the
inverse of this axis-angle using Rodriguez's rotation formula
|
static void |
main(java.lang.String[] args) |
void |
set(AxisAngle axisAng)
Sets this AxisAngle to the values of another AxisAngle.
|
void |
set(double[] values)
Sets this AxisAngle to the prescribed values.
|
void |
set(double x,
double y,
double z,
double ang)
Sets this AxisAngle to the prescribed values.
|
void |
set(Quaternion q)
Sets this AxisAngle to the values appropriate for the specified
quaternion.
|
void |
set(RotationMatrix3d R)
Sets this AxisAngle to the values appropriate for the specified rotation
matrix.
|
void |
set(Vector3d axis,
double ang)
Sets this AxisAngle to the prescribed values.
|
java.lang.String |
toString()
Returns a String representation of this AxisAngle, consisting of the x, y,
and z components of the axis, followed by the angle (in radians).
|
java.lang.String |
toString(NumberFormat fmt)
Returns a String representation of this AxisAngle, consisting of the x, y,
and z components of the axis, followed by the angle (in radians).
|
java.lang.String |
toString(java.lang.String fmtStr)
Returns a String representation of this AxisAngle, consisting of the x, y,
and z components of the axis, followed by the angle (in radians).
|
void |
transform(Vector3d vr,
Vector3d v1)
Transforms a vector v1 by the rotation implied by this axis-angle
using Rodriguez's rotation formula
|
public static final AxisAngle IDENTITY
public static final AxisAngle ZERO
public static final AxisAngle ROT_X_90
public static final AxisAngle ROT_Y_90
public static final AxisAngle ROT_Z_90
public Vector3d axis
public double angle
public AxisAngle()
public AxisAngle(double[] values)
values
- AxisAngle values given as an array. The x, y, and z directions of the
rotation axis are given by elements 0 through 2, and the rotation angle
(in radians) is given by element 3.public AxisAngle(double x, double y, double z, double ang)
x
- rotation axis x directiony
- rotation axis y directionz
- rotation axis z directionang
- rotation angle, in radianspublic AxisAngle(Vector3d axis, double ang)
axis
- rotation axisang
- rotation angle (in radians)public AxisAngle(AxisAngle axisAng)
axisAng
- AxisAngle to supply initial valuespublic AxisAngle(RotationMatrix3d R)
R
- rotation matrixpublic void set(double x, double y, double z, double ang)
x
- rotation axis x directiony
- rotation axis y directionz
- rotation axis z directionang
- rotation angle, in radianspublic void set(double[] values)
values
- AxisAngle values given as an array. The x, y, and z directions of the
rotation axis are given by elements 0 through 2, and the rotation angle
(in radians) is given by element 3.public void set(Vector3d axis, double ang)
axis
- rotation axisang
- rotation angle (in radians)public void set(AxisAngle axisAng)
axisAng
- AxisAngle supplying new valuespublic void set(RotationMatrix3d R)
R
- rotation matrixpublic void set(Quaternion q)
q
- quaternionpublic void get(double[] values)
values
- returns the AxisAngle values. The x, y, and z directions of the rotation
axis are given by elements 0 through 2, and the rotation angle (in
radians) is given by element 3.public void transform(Vector3d vr, Vector3d v1)
vr
- result vectorv1
- vector to be transformedpublic void inverseTransform(Vector3d vr, Vector3d v1)
vr
- result vectorv1
- vector to be transformedpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String fmtStr)
printf
style format string.
For a description of the format string syntax, see
NumberFormat
.fmtStr
- numeric format specificationpublic java.lang.String toString(NumberFormat fmt)
printf
style as decribed by
the parameter NumberFormat
. When called numerous times,
this routine can be more efficient than
toString(String)
, because the NumberFormat
does not need to be recreated each
time from a specification string.fmt
- numeric formatpublic boolean epsilonEquals(AxisAngle axisAng, double eps) throws ImproperSizeException
epsilon
.axisAng
- AxisAngle to compare witheps
- comparison toleranceImproperSizeException
public boolean equals(AxisAngle axisAng)
axisAng
- AxisAngle to compare withpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Object to compare withpublic AxisAngle clone()
public static void main(java.lang.String[] args)