org.ode4j.math
Class DVector4
java.lang.Object
org.ode4j.math.DVector4
- All Implemented Interfaces:
- DVector4C
public class DVector4
- extends java.lang.Object
- implements DVector4C
Method Summary |
int |
dim()
|
double |
dot(DVector4C b)
Return the 'dot' product of two vectors. |
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. |
DVector4 |
scale(double d)
|
void |
set(double[] a)
|
void |
set(double a,
double b,
double c,
double d)
|
void |
set0(double d)
|
void |
set1(double d)
|
void |
set2(double d)
|
void |
set3(double d)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DVector4
public DVector4(DVector4 v4)
DVector4
public DVector4()
set
public void set(double a,
double b,
double c,
double d)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
get0
public double get0()
- Specified by:
get0
in interface DVector4C
get1
public double get1()
- Specified by:
get1
in interface DVector4C
get2
public double get2()
- Specified by:
get2
in interface DVector4C
get3
public double get3()
- Specified by:
get3
in interface DVector4C
dim
public int dim()
scale
public DVector4 scale(double d)
lengthSquared
public double lengthSquared()
- Specified by:
lengthSquared
in interface DVector4C
length
public double length()
- Specified by:
length
in interface DVector4C
get
public double get(int i)
- Specified by:
get
in interface DVector4C
- Parameters:
i
- The row to return [0, 1, 2].
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.
set
public void set(double[] a)
dot
public final double dot(DVector4C b)
- Return the 'dot' product of two vectors.
r = a0*b0 + a1*b1 + a2*b2 + a3*b3;
- Specified by:
dot
in interface DVector4C
- Parameters:
b
-
- Returns:
- (this) * b
- See Also:
dot(DVector4C)
set0
public void set0(double d)
set1
public void set1(double d)
set2
public void set2(double d)
set3
public void set3(double d)