vmm3d.core
Class Quaternion
- java.lang.Object
-
- vmm3d.core.Quaternion
-
public class Quaternion extends java.lang.ObjectRepresents an element of the set of quaternions.
-
-
Field Summary
Fields Modifier and Type Field and Description doubleadoublebdoublecdoubledstatic Quaternionq1static QuaternionqIstatic QuaternionqJstatic QuaternionqKstatic QuaternionZERO
-
Constructor Summary
Constructors Constructor and Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Quaternionconj()p.conj() returns the conjugate to pQuaterniondividedBy(Quaternion q)Compute the quotient of this quaternaion by another quaternion.doubledot(Quaternion q)p.dot(q) returns the scalar productbooleanequals(java.lang.Object obj)Quaternioninverse()Compute the multiplicative inverser of this quaternion.Quaternionminus(Quaternion q)Compute the difference of this quaternaion and another quaterniondoublenorm()Returns the norm of this quaternion.Quaternionplus(Quaternion q)Compute the sum of this quaternaion and another quaternionQuaternionrotateAroundHopfFibre(double phi)Returns rotation by phi around standard Hopf fiber through (1,0,0,0)QuaternionrotateAroundHopfFibre(double phi, Quaternion q0)Returns rotation by phi around standard Hopf fiber through q0Vector3DStereographicProjection()Returns stereographic projection from (-1,0,0,0)Quaterniontimes(double x)Compute the product of this quaternaion and a real numberQuaterniontimes(Quaternion q)Compute the product of this quaternaion and another quaternionjava.lang.StringtoString()
-
-
-
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:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.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)
-
-
DMelt 3.0 © DataMelt by jWork.ORG