vmm.core
Class Quaternion

java.lang.Object
  extended by vmm.core.Quaternion

public class Quaternion
extends java.lang.Object

Represents an element of the set of quaternions.


Field Summary
 double a
           
 double b
           
 double c
           
 double d
           
static Quaternion q1
           
static Quaternion qI
           
static Quaternion qJ
           
static Quaternion qK
           
static Quaternion ZERO
           
 
Constructor Summary
Quaternion()
          Create a quaternion with all coordinates intially equal to zero.
Quaternion(double a, double b, double c, double d)
          Create a quaternion from initial values for each coordinate.
Quaternion(Quaternion source)
          Create a copy of an exiting non-null Quaternion object
 
Method Summary
 Quaternion conj()
          p.conj() returns the conjugate to p
 Quaternion dividedBy(Quaternion q)
          Compute the quotient of this quaternaion by another quaternion.
 double dot(Quaternion q)
          p.dot(q) returns the scalar product
 boolean equals(java.lang.Object obj)
           
 Quaternion inverse()
          Compute the multiplicative inverser of this quaternion.
 Quaternion minus(Quaternion q)
          Compute the difference of this quaternaion and another quaternion
 double norm()
          Returns the norm of this quaternion.
 Quaternion plus(Quaternion q)
          Compute the sum of this quaternaion and another quaternion
 Quaternion rotateAroundHopfFibre(double phi)
          Returns rotation by phi around standard Hopf fiber through (1,0,0,0)
 Quaternion rotateAroundHopfFibre(double phi, Quaternion q0)
          Returns rotation by phi around standard Hopf fiber through q0
 Vector3D StereographicProjection()
          Returns stereographic projection from (-1,0,0,0)
 Quaternion times(double x)
          Compute the product of this quaternaion and a real number
 Quaternion times(Quaternion q)
          Compute the product of this quaternaion and another quaternion
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final Quaternion ZERO

q1

public static final Quaternion q1

qI

public static final Quaternion qI

qJ

public static final Quaternion qJ

qK

public static final Quaternion qK

a

public double a

b

public double b

c

public double c

d

public double d
Constructor Detail

Quaternion

public Quaternion()
Create a quaternion with all coordinates intially equal to zero.


Quaternion

public Quaternion(double a,
                  double b,
                  double c,
                  double d)
Create a quaternion from initial values for each coordinate.


Quaternion

public Quaternion(Quaternion source)
Create a copy of an exiting non-null Quaternion object

Parameters:
source - the object to be copied. A NullPointerException is thrown if this is null.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

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

dot

public double dot(Quaternion q)
p.dot(q) returns the scalar product


norm

public double norm()
Returns the norm of this quaternion.


conj

public Quaternion conj()
p.conj() returns the conjugate to p


plus

public Quaternion plus(Quaternion q)
Compute the sum of this quaternaion and another quaternion

Parameters:
q - the non-null quaternion to be added to this one. If this is null, a NullPointerException is thrown.

minus

public Quaternion minus(Quaternion q)
Compute the difference of this quaternaion and another quaternion

Parameters:
q - the non-null quaternion to be subtracted from this one. If this is null, a NullPointerException is thrown.

times

public Quaternion times(Quaternion q)
Compute the product of this quaternaion and another quaternion

Parameters:
q - the non-null quaternion to be ultiplied by this one. If this is null, a NullPointerException is thrown.

times

public Quaternion times(double x)
Compute the product of this quaternaion and a real number


inverse

public Quaternion inverse()
Compute the multiplicative inverser of this quaternion. Note that the inverse of zero will not generate an error; instead, the inverse of zero is a quaternion object in which every coordinate is Double.NaN.


dividedBy

public Quaternion dividedBy(Quaternion q)
Compute the quotient of this quaternaion by another quaternion. Note that division by zero does not generate an error. Instead, the the result is a vector in which each coordinate is Double.NaN.

Parameters:
q - the non-null quaternion that this quaternion is to be multiplied by. If this is null, a NullPointerException is thrown.

rotateAroundHopfFibre

public Quaternion rotateAroundHopfFibre(double phi)
Returns rotation by phi around standard Hopf fiber through (1,0,0,0)


rotateAroundHopfFibre

public Quaternion rotateAroundHopfFibre(double phi,
                                        Quaternion q0)
Returns rotation by phi around standard Hopf fiber through q0


StereographicProjection

public Vector3D StereographicProjection()
Returns stereographic projection from (-1,0,0,0)