|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ode4j.math.DVector3
public class DVector3
This class provides functionality for DVector3 math.
Most methods have a prefix indicating whether the (this) object will be modified or not. All methods starting with "eq" will write the result into (this). All methods starting with "re" return a new Object containing the result. For all other methods the behaviour should be obvious.
Performance considerations: - Each class implements its own strictly typed methods. Using generic methods in super-classes showed to slow down operations like add() or set() by a factor of ~10 (SUN JDK 6 on SuSE 11.1 64bit). - Using complex methods (e.g. v0.sum(v1, v2, s2)) showed to be about 2 times faster than concatenating methods, e.g. v0.set(v2).scale(s2).add(v1).
Field Summary | |
---|---|
static int |
CURRENT_LENGTH
|
static DVector3C |
ZERO
|
Constructor Summary | |
---|---|
DVector3()
|
|
DVector3(double[] v2)
|
|
DVector3(double i,
double j,
double k)
|
|
DVector3(DVector3C v2)
|
Method Summary | |
---|---|
DVector3 |
add(double a,
double b,
double c)
|
DVector3 |
add(DVector3C v2)
Adds v2 to the current vector. |
void |
add(int i,
double d)
|
void |
add0(double d)
|
void |
add1(double d)
|
void |
add2(double d)
|
DVector3 |
addScaled(DVector3C v2,
double d)
Scales the first parameter with the second and then adds the result to the current vector. |
DVector3 |
clone()
|
int |
dim()
|
double |
distance(DVector3C a)
Distance between this vector and a. |
double |
dot(DVector3C b)
Return the 'dot' product of two vectors. |
double |
dot(DVector3View b)
Return the 'dot' product of two vectors. |
double |
dotCol(DMatrix3C m,
int col)
Calculates the dot product of this vector with the specified column of the given Matrix. |
void |
eqAbs()
|
void |
eqCross(DVector3C b,
DVector3C c)
Set this vector = b x c. |
DVector3 |
eqDiff(DVector3C v2,
DVector3C v3)
Sets the current vector v0 = v2 - v3. |
void |
eqIdentity()
|
void |
eqProd(DMatrix3C m,
DVector3C v2)
Calculates the ordinary matrix product for a 3x3 Matrix and a 3-Vector. |
DVector3 |
eqSum(DMatrix3.DVector3ColView v2,
double s2,
DMatrix3.DVector3ColView v3,
double s3)
Convenience function that performs: this = v2*s2 + v3*s3 |
DVector3 |
eqSum(DMatrix3.DVector3ColView v2,
double s2,
DVector3C v3,
double s3)
Convenience function that performs: this = v2*s2 + v3*s3 |
DVector3 |
eqSum(DVector3C v2,
DMatrix3.DVector3ColView v3,
double s3)
Convenience function that performs: this = v2 + v3*s3 |
DVector3 |
eqSum(DVector3C v2,
double s2,
DVector3C v3,
double s3)
Convenience function that performs: this = v2*s2 + v3*s3 |
DVector3 |
eqSum(DVector3C v2,
DVector3C v3)
Sets current vector = v2 + v3. |
DVector3 |
eqSum(DVector3C v2,
DVector3C v3,
double s3)
Convenience function that performs: this = v2 + v3*s3 |
boolean |
equals(java.lang.Object obj)
Any implementation of DVector3I will return true if get0(), get1() and get2() return the same values. |
void |
eqZero()
|
double |
get(int i)
|
double |
get0()
|
double |
get1()
|
double |
get2()
|
int |
hashCode()
|
boolean |
isEq(DVector3 a)
|
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. |
DVector3C |
reAdd(DVector3C c)
|
DVector3 |
reScale(double d)
|
DVector3 |
reSub(DVector3C v2)
Return a new vector v0 = v(this) - v2. |
boolean |
safeNormalize()
this may be called for vectors `a' with extremely small magnitude, for example the result of a cross product on two nearly perpendicular vectors. |
DVector3 |
scale(double s)
|
DVector3 |
scale(double a,
double b,
double c)
|
DVector3 |
scale(DVector3C v2)
|
void |
scale(int i,
double d)
|
DVector3 |
set(DMatrix3.DVector3ColView v2)
|
DVector3 |
set(double[] v2)
|
DVector3 |
set(double x,
double y,
double z)
|
DVector3 |
set(DVector3C v2)
|
void |
set(float[] v2)
|
void |
set(int i,
double d)
|
void |
set0(double d)
|
void |
set1(double d)
|
void |
set2(double d)
|
void |
setIdentity()
|
void |
setZero()
|
DVector3 |
sub(double a,
double b,
double c)
|
DVector3 |
sub(DVector3C v2)
|
float[] |
toFloatArray()
|
float[] |
toFloatArray4()
|
java.lang.String |
toString()
|
void |
wrapAdd(double[] array,
int pos)
Adds the content of this vector to the elements of array at position pos. |
void |
wrapSet(double[] array,
int pos)
Writes the content of this vector into array at position pos. |
void |
wrapSub(double[] array,
int pos)
Subtracts the content of this vector from the elements of array at position pos. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final DVector3C ZERO
public static final int CURRENT_LENGTH
Constructor Detail |
---|
public DVector3()
public DVector3(DVector3C v2)
public DVector3(double[] v2)
public DVector3(double i, double j, double k)
Method Detail |
---|
public final DVector3 set(double[] v2)
public void set(float[] v2)
public final DVector3 set(double x, double y, double z)
public final DVector3 set(DVector3C v2)
public final DVector3 set(DMatrix3.DVector3ColView v2)
public DVector3 clone()
clone
in interface DVector3C
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public final void set0(double d)
public final void set1(double d)
public final void set2(double d)
public final double get0()
get0
in interface DVector3C
public final double get1()
get1
in interface DVector3C
public final double get2()
get2
in interface DVector3C
public final DVector3 add(double a, double b, double c)
public final DVector3 add(DVector3C v2)
v2
-
public final DVector3 eqSum(DVector3C v2, DVector3C v3)
v2
- v3
-
public final DVector3 eqSum(DVector3C v2, double s2, DVector3C v3, double s3)
public final DVector3 eqSum(DMatrix3.DVector3ColView v2, double s2, DVector3C v3, double s3)
public final DVector3 eqSum(DMatrix3.DVector3ColView v2, double s2, DMatrix3.DVector3ColView v3, double s3)
public final DVector3 eqSum(DVector3C v2, DVector3C v3, double s3)
public final DVector3 eqSum(DVector3C v2, DMatrix3.DVector3ColView v3, double s3)
public final DVector3 sub(double a, double b, double c)
public final DVector3 sub(DVector3C v2)
public final DVector3 scale(double a, double b, double c)
public final DVector3 scale(double s)
public final DVector3 scale(DVector3C v2)
public final double dot(DVector3C b)
dot
in interface DVector3C
b
-
dot(DVector3C)
public final double dot(DVector3View b)
dot
in interface DVector3C
b
-
dot(DVector3C)
public final DVector3 eqDiff(DVector3C v2, DVector3C v3)
v2
- v3
- public final DVector3 reSub(DVector3C v2)
reSub
in interface DVector3C
v2
- reSub(DVector3C)
public final boolean safeNormalize()
public final void normalize()
public final double distance(DVector3C a)
distance
in interface DVector3C
a
-
distance(DVector3C)
public final boolean isEq(DVector3 a)
public final void eqAbs()
public final void add0(double d)
public final void add1(double d)
public final void add2(double d)
public final int dim()
public final DVector3C reAdd(DVector3C c)
public final void wrapSet(double[] array, int pos)
array
- pos
- public final void wrapAdd(double[] array, int pos)
array
- pos
- public final void wrapSub(double[] array, int pos)
array
- pos
- public final DVector3 reScale(double d)
reScale
in interface DVector3C
public final void eqZero()
public final void setZero()
public final void eqIdentity()
public final void setIdentity()
public final float[] toFloatArray4()
toFloatArray4
in interface DVector3C
public final double length()
length
in interface DVector3C
public final double lengthSquared()
lengthSquared
in interface DVector3C
public final double get(int i)
get
in interface DVector3C
i
- The row to return [0, 1, 2].public final float[] toFloatArray()
toFloatArray
in interface DVector3C
public final void set(int i, double d)
public final void scale(int i, double d)
public final void add(int i, double d)
public final double dotCol(DMatrix3C m, int col)
dotCol
in interface DVector3C
m
- col
- public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public final DVector3 addScaled(DVector3C v2, double d)
public final void eqCross(DVector3C b, DVector3C c)
b
- c
- public final void eqProd(DMatrix3C m, DVector3C v2)
a0 = m00*v0 + m01*v1 + m02*v2 a1 = m10*v0 + m11*v1 + m12*v2 a2 = m20*v0 + m21*v1 + m22*v2
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |