SciLib.Math
Class quaternion

java.lang.Object
  extended by SciLib.Math.quaternion

public class quaternion
extends java.lang.Object

This class contains some methods to handle a quaternion


Field Summary
 rPoint a
          public members
 double b
           
 
Constructor Summary
quaternion()
          make a unit quaternion object <0, 1>
quaternion(double f, double x, double y, double z)
          make a quaternion (x, y, z, d) object
quaternion(rPoint a, double b)
          make a quaternion (a, b) object
 
Method Summary
 quaternion conjugate()
          the conjugate of this quaternion
static quaternion conjugate(quaternion x, quaternion y)
          the division of 2 quaternions x/y
static quaternion minus(quaternion x, quaternion y)
          minus 2 quaternions
static quaternion mult(quaternion x, quaternion y)
          multiplication of 2 quaternions
 double norm()
          the square norm of this quaternion
static quaternion plus(quaternion x, quaternion y)
          add 2 quaternions
 void print()
          print this quaternion on the screen
 quaternion reciprocal()
          the reciprocal of this quaternion
 void scale(double s)
          scale a quaternion
 void setPoint(double x, double y, double z, double d)
          set rPoint
 java.lang.String toString()
          make a String from this quaternion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

a

public rPoint a
public members


b

public double b
Constructor Detail

quaternion

public quaternion()
make a unit quaternion object <0, 1>


quaternion

public quaternion(double f,
                  double x,
                  double y,
                  double z)
make a quaternion (x, y, z, d) object

Parameters:
f - the first coordinate
x - the second coordinate
y - the third coordinate
z - the fourth coordinate

quaternion

public quaternion(rPoint a,
                  double b)
make a quaternion (a, b) object

Parameters:
a - A rPoint object
b - the fourth coordinate
Method Detail

setPoint

public void setPoint(double x,
                     double y,
                     double z,
                     double d)
set rPoint

Parameters:
x - the first coordinate
y - the second coordinate
z - the third coordinate
d - the fourth coordinate

plus

public static quaternion plus(quaternion x,
                              quaternion y)
add 2 quaternions

Parameters:
x - a quaternion
y - a quaternion
Returns:
a quaternion

minus

public static quaternion minus(quaternion x,
                               quaternion y)
minus 2 quaternions

Parameters:
x - a quaternion
y - a quaternion
Returns:
a quaternion

mult

public static quaternion mult(quaternion x,
                              quaternion y)
multiplication of 2 quaternions

Parameters:
x - a quaternion
y - a quaternion
Returns:
a quaternion

conjugate

public quaternion conjugate()
the conjugate of this quaternion

Returns:
a quaternion

norm

public double norm()
the square norm of this quaternion

Returns:
a double value

reciprocal

public quaternion reciprocal()
the reciprocal of this quaternion

Returns:
a quaternion

scale

public void scale(double s)
scale a quaternion

Parameters:
s - A double value

conjugate

public static quaternion conjugate(quaternion x,
                                   quaternion y)
the division of 2 quaternions x/y

Returns:
a quaternion

toString

public java.lang.String toString()
make a String from this quaternion

Overrides:
toString in class java.lang.Object
Returns:
a String

print

public void print()
print this quaternion on the screen