javax.robotics.vecmath
Class Quaternion

java.lang.Object
  extended by javax.vecmath.Tuple4d
      extended by javax.vecmath.Quat4d
          extended by javax.robotics.vecmath.Quaternion
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Quaternion
extends javax.vecmath.Quat4d

A 4-element quaternion represented by double precision floating point x,y,z,w coordinates. The quaternion is always normalized. This class extends printing functionality of Quat4d class

Since:
1.0.1
Version:
5/10/2005
Author:
Carmine Lia
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.vecmath.Tuple4d
w, x, y, z
 
Constructor Summary
Quaternion()
          Constructs and initializes a Quaternion to (0,0,0,0).
Quaternion(double[] q)
          Constructs and initializes a Quaternion from the array of length 4.
Quaternion(double x, double y, double z, double w)
          Constructs and initializes a Quaternion from the specified xyzw coordinates.
Quaternion(javax.vecmath.Quat4d q)
          Constructs and initializes a Quaternion from the specified Quat4d.
Quaternion(Quaternion q)
          Constructs and initializes a new Quaternion from the specified Quaternion.
 
Method Summary
 double dot(Quaternion q)
           
 double getScalar()
          Gets the scalar component of Quaternion.
 RVector3d getVector()
          Gets the vectorial component of Quaternion
 void printf()
          Prints to standard out
 void printf(java.io.PrintStream out)
          Prints to PrintStream
 void printf(java.io.PrintStream out, java.lang.String format)
          Prints to PrintStream according to the format string
 void printf(java.lang.String format)
          Prints to standard out according to the format string.
 java.lang.String toString()
          Returns a string that contains the values of this RVector.
 java.lang.String toString(java.lang.String format)
          Returns a string that contains the values of this RVector, according to the format string
 
Methods inherited from class javax.vecmath.Quat4d
conjugate, conjugate, interpolate, interpolate, inverse, inverse, mul, mul, mulInverse, mulInverse, normalize, normalize, set, set, set, set, set, set
 
Methods inherited from class javax.vecmath.Tuple4d
absolute, absolute, add, add, clamp, clamp, clamp, clamp, clampMax, clampMax, clampMax, clampMax, clampMin, clampMin, clampMin, clampMin, clone, epsilonEquals, equals, equals, get, get, hashCode, interpolate, interpolate, interpolate, interpolate, negate, negate, scale, scale, scaleAdd, scaleAdd, scaleAdd, set, set, set, set, sub, sub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Quaternion

public Quaternion()
Constructs and initializes a Quaternion to (0,0,0,0).


Quaternion

public Quaternion(double[] q)
Constructs and initializes a Quaternion from the array of length 4.

Parameters:
q - the array of length 4 containing xyzw in order

Quaternion

public Quaternion(double x,
                  double y,
                  double z,
                  double w)
Constructs and initializes a Quaternion from the specified xyzw coordinates.

Parameters:
x - the x coordinate
y - the y coordinate
z - the z coordinate
w - the w scalar component

Quaternion

public Quaternion(javax.vecmath.Quat4d q)
Constructs and initializes a Quaternion from the specified Quat4d.

Parameters:
q - the Quat4d containing the initialization x y z w data

Quaternion

public Quaternion(Quaternion q)
Constructs and initializes a new Quaternion from the specified Quaternion.

Parameters:
q - the Quaternion containing the initialization x y z w data.
Method Detail

getVector

public RVector3d getVector()
Gets the vectorial component of Quaternion

Returns:
the vectorial component of Quaternion

getScalar

public final double getScalar()
Gets the scalar component of Quaternion.

Returns:
the scalar component of Quaternion

dot

public double dot(Quaternion q)

printf

public void printf()
Prints to standard out


printf

public void printf(java.lang.String format)
Prints to standard out according to the format string.

The format specifiers for numeric types have the following syntax:

 %[width][.precision]conversion
 

Example:
v.printf("%5.3f");

Parameters:
format - The format string
See Also:
PrintStream.format(java.lang.String, java.lang.Object[])

printf

public void printf(java.io.PrintStream out)
Prints to PrintStream

Parameters:
out - The PrintStream object.

printf

public void printf(java.io.PrintStream out,
                   java.lang.String format)
Prints to PrintStream according to the format string

Parameters:
out - The PrintStream object.
format - The format string.
See Also:
printf(String)

toString

public java.lang.String toString()
Returns a string that contains the values of this RVector.

Overrides:
toString in class javax.vecmath.Tuple4d
Returns:
The string.

toString

public java.lang.String toString(java.lang.String format)
Returns a string that contains the values of this RVector, according to the format string

Parameters:
format - The format string
Returns:
The string
See Also:
printf(String)