cz.cuni.amis.pogamut.base3d.worldview.object
Class Rotation

java.lang.Object
  extended by cz.cuni.amis.pogamut.base3d.worldview.object.Rotation
All Implemented Interfaces:
IRotable, java.io.Serializable, java.lang.Cloneable

public class Rotation
extends java.lang.Object
implements IRotable, java.io.Serializable, java.lang.Cloneable

Rotation within the world. Rotation is represented as yaw, roll and pitch. FIXME[js]: Add working methods and consider imports from Tuple3d.

See Also:
Serialized Form

Nested Class Summary
static class Rotation.Order
          Used for conversions in from Location into Rotation and vice versa
static class Rotation.PropertyEditor
          Property editor for Rotation.
 
Field Summary
 double pitch
          Rotation pitch.
 double roll
          Rotation roll.
 double yaw
          Rotation yaw.
 
Constructor Summary
Rotation()
          Creates rotation with all values set to zeroes.
Rotation(double pitch, double yaw, double roll)
          Creates rotation with specified values.
Rotation(Rotation rotation)
          Copy constructor.
 
Method Summary
 Rotation clone()
           
static Matrix3d constructXYRot(double angle)
          Useful methods from Rotation->Location conversions.
static Matrix3d constructXZRot(double angle)
          Useful methods from Rotation->Location conversions.
static Matrix3d constructYZRot(double angle)
          Useful methods from Rotation->Location conversions.
static double ExpInterp(double a, double b, double alpha)
          Exponentially interpolates between 2 doubles with alpha as strength.
 double getPitch()
          Rotation pitch.
 Point3d getPoint3d()
          Retreives javax.vecmath.Point3d representation of the rotation.
 double getRoll()
          Rotation roll.
 Rotation getRotation()
          Retreives the rotation itself to implement IRotable.
 double getYaw()
          Rotation yaw.
static double LinearInterp(double a, double b, double alpha)
          Linearly interpolates between 2 doubles with alpha as strength.
static double LogInterp(double a, double b, double alpha)
          Logarithmically interpolates between 2 doubles with alpha as strength.
 Rotation RotationExpInterp(Rotation b, double alpha)
          Exponentially interpolates between 2 rotations with alpha as strength.
static Rotation RotationExpInterp(Rotation a, Rotation b, double alpha)
          Exponentially interpolates between 2 rotations with alpha as strength.
 Rotation RotationLinearInterp(Rotation b, double alpha)
          Linearly interpolates between 2 rotations with alpha as strength.
static Rotation RotationLinearInterp(Rotation a, Rotation b, double alpha)
          Linearly interpolates between 2 rotations with alpha as strength.
 Rotation RotationLogInterp(Rotation b, double alpha)
          Logarithmically interpolates between 2 rotations with alpha as strength.
static Rotation RotationLogInterp(Rotation a, Rotation b, double alpha)
          Logarithmically interpolates between 2 rotations with alpha as strength.
 Rotation setTo(double pitch, double yaw, double roll)
          Set this rotation to passed values.
 Rotation setTo(Rotation r)
          Set this rotation to values from r.
 Location toLocation()
          Converts this Rotation into Location.
 Location toLocation(Rotation.Order order)
          Converts this Rotation into Location.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

yaw

public double yaw
Rotation yaw. Yaw is rotation to the left or right. E.g. turn left. The value ranges from -32768..32767.


roll

public double roll
Rotation roll. Roll is twist of head. E.g. Tilt the head to shoulder. The value ranges from -32768..32767.


pitch

public double pitch
Rotation pitch. Pitch is rotation up and down. E.g. look down. The value ranges from -32768..32767.

Constructor Detail

Rotation

public Rotation()
Creates rotation with all values set to zeroes.


Rotation

public Rotation(double pitch,
                double yaw,
                double roll)
Creates rotation with specified values.

Parameters:
yaw - Rotation yaw.
roll - Rotation roll.
pitch - Rotation pitch.

Rotation

public Rotation(Rotation rotation)
Copy constructor.

Parameters:
rotation - Rotation.
Method Detail

clone

public Rotation clone()
Overrides:
clone in class java.lang.Object

getYaw

public double getYaw()
Rotation yaw. Yaw is rotation to the left or right. E.g. turn left.

Returns:
Rotation yaw. The value ranges from -32768..32767.

getPitch

public double getPitch()
Rotation pitch. Pitch is rotation up and down. E.g. look down.

Returns:
Rotation pitch. The value ranges from -32768..32767.

getRoll

public double getRoll()
Rotation roll. Roll is twist of head. E.g. Tilt the head to shoulder.

Returns:
Rotation roll. The value ranges from -32768..32767.

getRotation

public Rotation getRotation()
Retreives the rotation itself to implement IRotable.

Specified by:
getRotation in interface IRotable
Returns:
The rotation itself (note: does not create a copy).

getPoint3d

public Point3d getPoint3d()
Retreives javax.vecmath.Point3d representation of the rotation.

Returns:
javax.vecmath.Point3d representation with x, y and z values set.

LinearInterp

public static final double LinearInterp(double a,
                                        double b,
                                        double alpha)
Linearly interpolates between 2 doubles with alpha as strength. That is how close from a to be the interpolation proceeds.

Parameters:
a - start
b - target
alpha - strength
Returns:
interpolated value

LogInterp

public static final double LogInterp(double a,
                                     double b,
                                     double alpha)
Logarithmically interpolates between 2 doubles with alpha as strength. That is how close from a to be the interpolation proceeds.

Parameters:
a - start
b - target
alpha - strength
Returns:
interpolated value

ExpInterp

public static final double ExpInterp(double a,
                                     double b,
                                     double alpha)
Exponentially interpolates between 2 doubles with alpha as strength. That is how close from a to be the interpolation proceeds.

Parameters:
a - start
b - target
alpha - strength
Returns:
interpolated value

RotationLinearInterp

public static final Rotation RotationLinearInterp(Rotation a,
                                                  Rotation b,
                                                  double alpha)
Linearly interpolates between 2 rotations with alpha as strength. That is how close from a to be the interpolation proceeds. Static version.

Parameters:
a - start
b - target
alpha - strength
Returns:
interpolated rotation

RotationLinearInterp

public final Rotation RotationLinearInterp(Rotation b,
                                           double alpha)
Linearly interpolates between 2 rotations with alpha as strength. That is how close from a to be the interpolation proceeds. Dynamic version.

Parameters:
a - start
b - target
alpha - strength
Returns:
interpolated rotation

RotationLogInterp

public static final Rotation RotationLogInterp(Rotation a,
                                               Rotation b,
                                               double alpha)
Logarithmically interpolates between 2 rotations with alpha as strength. That is how close from a to be the interpolation proceeds. Static version.

Parameters:
a - start
b - target
alpha - strength
Returns:
interpolated rotation

RotationLogInterp

public final Rotation RotationLogInterp(Rotation b,
                                        double alpha)
Logarithmically interpolates between 2 rotations with alpha as strength. That is how close from a to be the interpolation proceeds. Dynamic version.

Parameters:
a - start
b - target
alpha - strength
Returns:
interpolated rotation

RotationExpInterp

public static final Rotation RotationExpInterp(Rotation a,
                                               Rotation b,
                                               double alpha)
Exponentially interpolates between 2 rotations with alpha as strength. That is how close from a to be the interpolation proceeds. Static version.

Parameters:
a - start
b - target
alpha - strength
Returns:
interpolated rotation

RotationExpInterp

public final Rotation RotationExpInterp(Rotation b,
                                        double alpha)
Exponentially interpolates between 2 rotations with alpha as strength. That is how close from a to be the interpolation proceeds. Dynamic version.

Parameters:
a - start
b - target
alpha - strength
Returns:
interpolated rotation

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toLocation

public Location toLocation()
Converts this Rotation into Location. Using default order.

Returns:
converted Rotation into Location using yaw roll pitch order

toLocation

public Location toLocation(Rotation.Order order)
Converts this Rotation into Location.

Parameters:
order - order of rotations should the method use
Returns:
converted Rotation into Location

constructYZRot

public static Matrix3d constructYZRot(double angle)
Useful methods from Rotation->Location conversions. Constructs rotation in YZ plane.

Parameters:
angle -
Returns:
projection Matrix3d

constructXZRot

public static Matrix3d constructXZRot(double angle)
Useful methods from Rotation->Location conversions. Constructs rotation in XZ plane.

Parameters:
angle -
Returns:
projection Matrix3d

constructXYRot

public static Matrix3d constructXYRot(double angle)
Useful methods from Rotation->Location conversions. Constructs rotation in XY plane.

Parameters:
angle -
Returns:
projection Matrix3d

setTo

public Rotation setTo(Rotation r)
Set this rotation to values from r.

Parameters:
r - rotation from which we copy data
Returns:
this rotation after data has been set to r

setTo

public Rotation setTo(double pitch,
                      double yaw,
                      double roll)
Set this rotation to passed values.

Parameters:
pitch - new pitch
yaw - new yaw
roll - new roll
Returns:
this rotation after data has been set