org.ode4j.math
Class DQuaternion
java.lang.Object
org.ode4j.math.DQuaternion
- All Implemented Interfaces:
- DQuaternionC
public class DQuaternion
- extends java.lang.Object
- implements DQuaternionC
Field Summary |
static int |
LEN
|
Method Summary |
void |
add(double d0,
double d1,
double d2,
double d3)
|
DQuaternion |
add(DQuaternion q)
|
int |
dim()
|
boolean |
equals(DQuaternion q)
|
boolean |
equals(java.lang.Object q)
|
double |
get(int i)
|
double |
get0()
|
double |
get1()
|
double |
get2()
|
double |
get3()
|
double |
length()
|
double |
lengthSquared()
|
void |
normalize()
this may be called for vectors `a' with extremely small magnitude, for
example the result of a cross product on two nearly perpendicular vectors. |
boolean |
safeNormalize4()
this may be called for vectors `a' with extremely small magnitude, for
example the result of a cross product on two nearly perpendicular vectors. |
DQuaternion |
scale(double d)
|
void |
scale(int i,
double l)
|
DQuaternion |
set(double x0,
double x1,
double x2,
double x3)
|
DQuaternion |
set(DQuaternionC q)
|
void |
set(int i,
double d)
Set a vector/matrix at position i to a specific value. |
void |
set0(double d)
|
void |
set1(double d)
|
void |
set2(double d)
|
void |
set3(double d)
|
void |
setIdentity()
|
void |
setZero()
|
void |
sum(DQuaternion q1,
DQuaternion q2,
double d2)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
LEN
public static final int LEN
- See Also:
- Constant Field Values
DQuaternion
public DQuaternion()
DQuaternion
public DQuaternion(double x0,
double x1,
double x2,
double x3)
DQuaternion
public DQuaternion(DQuaternion x)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
set
public DQuaternion set(double x0,
double x1,
double x2,
double x3)
set
public DQuaternion set(DQuaternionC q)
scale
public DQuaternion scale(double d)
add
public DQuaternion add(DQuaternion q)
get0
public double get0()
- Specified by:
get0
in interface DQuaternionC
get1
public double get1()
- Specified by:
get1
in interface DQuaternionC
get2
public double get2()
- Specified by:
get2
in interface DQuaternionC
get3
public double get3()
- Specified by:
get3
in interface DQuaternionC
dim
public int dim()
set0
public void set0(double d)
set1
public void set1(double d)
set2
public void set2(double d)
set3
public void set3(double d)
equals
public boolean equals(DQuaternion q)
equals
public boolean equals(java.lang.Object q)
- Overrides:
equals
in class java.lang.Object
add
public void add(double d0,
double d1,
double d2,
double d3)
sum
public final void sum(DQuaternion q1,
DQuaternion q2,
double d2)
set
public final void set(int i,
double d)
- Set a vector/matrix at position i to a specific value.
setZero
public final void setZero()
scale
public final void scale(int i,
double l)
lengthSquared
public final double lengthSquared()
get
public final double get(int i)
- Specified by:
get
in interface DQuaternionC
- Parameters:
i
- The row to return [0, 1, 2].
length
public final double length()
safeNormalize4
public final boolean safeNormalize4()
- this may be called for vectors `a' with extremely small magnitude, for
example the result of a cross product on two nearly perpendicular vectors.
we must be robust to these small vectors. to prevent numerical error,
first find the component a[i] with the largest magnitude and then scale
all the components by 1/a[i]. then we can compute the length of `a' and
scale the components by 1/l. this has been verified to work with vectors
containing the smallest representable numbers.
normalize
public void normalize()
- this may be called for vectors `a' with extremely small magnitude, for
example the result of a cross product on two nearly perpendicular vectors.
we must be robust to these small vectors. to prevent numerical error,
first find the component a[i] with the largest magnitude and then scale
all the components by 1/a[i]. then we can compute the length of `a' and
scale the components by 1/l. this has been verified to work with vectors
containing the smallest representable numbers.
setIdentity
public void setIdentity()