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

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

public class Rotation
extends Object
implements IRotable, Serializable, Cloneable

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

Author:
Juraj 'Loque' Simlovic, Radek 'Black_Hand' Pibil
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
static Rotation NONE
          Rotation representing NONE.
 double pitch
          Rotation pitch.
 double roll
          Rotation roll.
static Pattern rotationPattern
          Pattern used to parse toString() in Rotation(String).
 double yaw
          Rotation yaw.
static Rotation ZERO
          Rotation(0,0,0);
 
Constructor Summary
Rotation(double pitch, double yaw, double roll)
          Creates rotation with specified values.
Rotation(Rotation rotation)
          Copy constructor.
Rotation(String string)
          Parses the location from the "string" generated by toString().
 
Method Summary
 Rotation clone()
           
static javax.vecmath.Matrix3d constructXYRot(double angle)
          Useful methods from Rotation->Location conversions.
static javax.vecmath.Matrix3d constructXZRot(double angle)
          Useful methods from Rotation->Location conversions.
static javax.vecmath.Matrix3d constructYZRot(double angle)
          Useful methods from Rotation->Location conversions.
static boolean equal(Rotation r1, Rotation r2)
          Tells, whether two given rotations equal.
 boolean equals(Object obj)
          Tells, whether this objects equals to given rotation.
static double ExpInterp(double a, double b, double alpha)
          Exponentially interpolates between 2 doubles with alpha as strength.
 double getPitch()
          Rotation pitch.
 javax.vecmath.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.
 int hashCode()
          Generates a hashcode for this Rotation.
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 setPitch(double pitch)
          Sets the pitch.
 Rotation setRoll(double roll)
          Sets the roll.
 Rotation setYaw(double yaw)
          Sets the yaw.
 Location toLocation()
          Converts this Rotation into Location.
 Location toLocation(Rotation.Order order)
          Converts this Rotation into Location.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final Rotation NONE
Rotation representing NONE.


ZERO

public static final Rotation ZERO
Rotation(0,0,0);


yaw

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


roll

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


pitch

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


rotationPattern

public static final Pattern rotationPattern
Pattern used to parse toString() in Rotation(String).

Constructor Detail

Rotation

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

Parameters:
yaw - Rotation yaw. Yaw is rotation to the left or right.
roll - Rotation roll. Roll is twist of head. E.g. Tilt the head to shoulder.
pitch - Rotation pitch. Pitch is rotation up and down.

Rotation

public Rotation(Rotation rotation)
Copy constructor.

Parameters:
rotation - Rotation.

Rotation

public Rotation(String string)
Parses the location from the "string" generated by toString(). If it fails, it throws RuntimeException.

Parameters:
string -
Method Detail

clone

public Rotation clone()
Overrides:
clone in class 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 javax.vecmath.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

hashCode

public int hashCode()
Generates a hashcode for this Rotation.

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Tells, whether this objects equals to given rotation.

Overrides:
equals in class Object
Parameters:
obj - Object to be compared with.
Returns:
True, if the object is an instance of rotation has the same values of all three corresponding values.

equal

public static boolean equal(Rotation r1,
                            Rotation r2)
Tells, whether two given rotations equal.

Parameters:
r1 - First rotation to comapre.
r2 - Second rotation to comapre.
Returns:
True, if the locations have the same values of all three corresponding coordinates.

toString

public String toString()
Overrides:
toString in class 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 javax.vecmath.Matrix3d constructYZRot(double angle)
Useful methods from Rotation->Location conversions. Constructs rotation in YZ plane (~ ROLL).

Parameters:
angle -
Returns:
projection Matrix3d

constructXZRot

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

Parameters:
angle - in radians
Returns:
projection Matrix3d

constructXYRot

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

Parameters:
angle - in radians
Returns:
projection Matrix3d

setYaw

public Rotation setYaw(double yaw)
Sets the yaw.

Returns:
new rotation object

setPitch

public Rotation setPitch(double pitch)
Sets the pitch.

Returns:
new rotation object

setRoll

public Rotation setRoll(double roll)
Sets the roll.

Returns:
new rotation object


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.