FreeHEP API
Version current

org.freehep.graphics3d
Class Quaternion

java.lang.Object
  extended byorg.freehep.graphics3d.Quaternion

public class Quaternion
extends Object

Keeps a quaternion.

Original ArcBall C code from Ken Shoemake, Graphics Gems IV, 1993.

Version:
$Id: Quaternion.java,v 1.3 2003/03/20 00:20:23 duns Exp $
Author:
Mark Donszelmann
Source Code:
Quaternion.java

Field Summary
 double w
           
 double x
           
 double y
           
 double z
           
 
Constructor Summary
Quaternion()
          creates a null quaternion
Quaternion(double x, double y, double z, double w)
          creates a quaternion from x,y,z,w
Quaternion(Quaternion q)
          creates a new quaternion from q
 
Method Summary
 Quaternion conjugate(Quaternion r)
           
 double length()
           
 Quaternion multiply(Quaternion q, Quaternion r)
           
 Quaternion normalize(Quaternion r)
           
 Quaternion set(double x, double y, double z, double w)
           
 Quaternion set(Quaternion q)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x

y

public double y

z

public double z

w

public double w
Constructor Detail

Quaternion

public Quaternion(double x,
                  double y,
                  double z,
                  double w)
creates a quaternion from x,y,z,w


Quaternion

public Quaternion()
creates a null quaternion


Quaternion

public Quaternion(Quaternion q)
creates a new quaternion from q

Method Detail

toString

public String toString()
Returns:
a string representation of quaternion

length

public double length()
Returns:
length of quaternion

normalize

public Quaternion normalize(Quaternion r)
Returns:
normalized form of quaternion, or null if length is 0;

multiply

public Quaternion multiply(Quaternion q,
                           Quaternion r)
Returns:
quaternion product (this * q). Note: order is important! To combine rotations, use the product this.multiply(q), which gives the effect of rotating by this then q.

conjugate

public Quaternion conjugate(Quaternion r)
Returns:
conjugate of quaternion.

set

public Quaternion set(double x,
                      double y,
                      double z,
                      double w)
Returns:
the quaternion set to x,y,z,w

set

public Quaternion set(Quaternion q)
Returns:
the quaternion set to q

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.