com.kuka.math.geometry
Class AxisAngleRotation

java.lang.Object
  extended by com.kuka.math.geometry.AbstractRotation
      extended by com.kuka.math.geometry.AxisAngleRotation
All Implemented Interfaces:
IRotation

public final class AxisAngleRotation
extends AbstractRotation

Immutable representation of a spatial rotation in axis-angle form.

According to Euler's rotation theorem every rotation of a body in three-dimensional space around a fixed point can be represented as a rotation around a fixed axis through that point.

The Robotics API always assumes the axis of the rotation to be given in [mm].


Method Summary
 boolean equals(Object obj)
           
 double getAngle()
          Returns the angle of this rotation around its axis.
 Vector3D getAxis()
          Returns the axis of this rotation.
 Matrix getMatrix()
          Returns a matrix representing this rotation.
 int hashCode()
           
static AxisAngleRotation of(IRotation orig)
          Returns a new immutable instance of this class from the value of the given rotation.
static AxisAngleRotation of(Vector3D axis, double angle)
          Returns a new immutable instance of this class that represents a spatial rotation around the given axis through the given angle.
 String toString()
          Returns a textual description of the rotation.
 String toString(NumberFormat fmt)
          Returns a textual description of the rotation.
 AxisAngleRotation withAngle(double angle)
          Returns a new instance (copy) of the rotation, with the angle replaced by the new value.
 AxisAngleRotation withAxis(Vector3D axis)
          Returns a new instance (copy) of the rotation, with the rotation axis replaced by the new value.
 
Methods inherited from class com.kuka.math.geometry.AbstractRotation
applyTo, applyTo, compose, invert, rotationalDistanceTo, rotationTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

of

public static AxisAngleRotation of(Vector3D axis,
                                   double angle)
Returns a new immutable instance of this class that represents a spatial rotation around the given axis through the given angle.

Parameters:
axis - The axis of the rotation. Doesn't need to be normalized.
angle - the angle of the rotation around the axis in [rad]
Returns:
a new class instance

of

public static AxisAngleRotation of(IRotation orig)
Returns a new immutable instance of this class from the value of the given rotation. The new rotation will represent the same spatial rotation as the original one.

Parameters:
orig - the original rotation
Returns:
a new axis-angle rotation. The angle of the rotation is a positive value in the range 0 through pi.

getAxis

public Vector3D getAxis()
Returns the axis of this rotation.

Returns:
the normalized axis of this rotation.

getAngle

public double getAngle()
Returns the angle of this rotation around its axis.

Returns:
The angle of the rotation. Not necessarily bounded.

getMatrix

public Matrix getMatrix()
Description copied from interface: IRotation
Returns a matrix representing this rotation. This is potentially a costly conversion.

Specified by:
getMatrix in interface IRotation
Specified by:
getMatrix in class AbstractRotation
Returns:
a Matrix representing this rotation. This is potentially a costly conversion

withAxis

public AxisAngleRotation withAxis(Vector3D axis)
Returns a new instance (copy) of the rotation, with the rotation axis replaced by the new value.

Parameters:
axis - the new axis the rotation
Returns:
a new instance of the class

withAngle

public AxisAngleRotation withAngle(double angle)
Returns a new instance (copy) of the rotation, with the angle replaced by the new value.

Parameters:
angle - the angle of the rotation around the axis in [rad]
Returns:
a new instance of the class

toString

public String toString()
Returns a textual description of the rotation. The representation is subject to change.

This implementation will print the rotation as a tuple of the rotation axis as a vector and the rotation angle in rad. The numerical values will be printed with the default format as returned by MathUtils.getDefaultNumberFormat(). The following string can be regarded as typical:

([-1.55; 2.0; 0.8123], 1.5708)

Overrides:
toString in class AbstractRotation
Returns:
a textual description of the rotation with angle value in rad

toString

public String toString(NumberFormat fmt)
Returns a textual description of the rotation. The representation is subject to change.

This implementation will print the rotation as a tuple of the rotation axis as a vector and the rotation angle in rad. The numerical values will be printed using the NumberFormat.format(double) method of the given formatter.

Example: The following code snippet, used on a given AxisAngleRotation rot

 NumberFormat fmt = NumberFormat.getNumberInstance(Locale.US);
 fmt.setMinimumFractionDigits(1);
 fmt.setMaximumFractionDigits(3);
 System.out.println(rot.toString(fmt));
might give the following output:
 ([-1.55; 2.0; 0.812], 1.571)

Parameters:
fmt - the NumberFormat used to format the number values
Returns:
a textual description of the rotation with angle value in rad

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2019. All rights reserved.