Vector, java.io.Serializablepublic final class Vector3D extends java.lang.Object implements Vector, java.io.Serializable
| Modifier and Type | Field | Description |
|---|---|---|
protected static double[] |
lookUp |
|
protected static int |
nLookUp |
|
protected double |
x |
|
protected double |
y |
|
protected double |
z |
| Constructor | Description |
|---|---|
Vector3D() |
|
Vector3D(double[] a) |
|
Vector3D(double a1,
double a2,
double a3) |
|
Vector3D(Vector3D u) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
assignTo(double[] array) |
Assigns the components of this vector to the elements of the given array.
|
protected static double |
cubeRoot(double R) |
|
void |
DE(Vector u) |
Divide-equals (/=) operation.
|
double |
dot(Vector u) |
Returns the dot product of this vector with the given one.
|
void |
E(double a) |
Sets all components of this vector equal to the given value.
|
void |
E(double[] u) |
Sets the components of this vector equal to the corresponding elements of
the given array.
|
void |
E(double a,
double b,
double c) |
|
void |
E(Vector u) |
Sets the components of this vector equal to those of the given vector.
|
void |
Ea1Tv1(double a1,
Vector u) |
Operation (= a1 * v1); sets the components of this to those of the given
vector multiplied by the given constant.
|
boolean |
equals(Vector v) |
Returns true if all corresponding elements of this and the given vector
are equal; returns false otherwise.
|
void |
Ev1Mv2(Vector u1,
Vector u2) |
Sets the components of this vector equal to (v1 - v2)
|
void |
Ev1Pv2(Vector u1,
Vector u2) |
Sets the components of this vector equal to (v1 + v2)
|
int |
getD() |
Dimension of the space occupied by the vector.
|
double |
getX(int i) |
Vector components corresponding to the given index.
|
boolean |
isNaN() |
Returns true if any element of the vector is not-a-number.
|
boolean |
isZero() |
Returns true if all components of this vector are zero; false otherwise.
|
void |
map(IFunction function) |
Applies the given function to each element of the vector.
|
void |
ME(Vector u) |
Minus-equals (-=) operation.
|
void |
mod(Vector u) |
Replaces each component of this vector with its value modulo
the corresponding component in u
|
void |
mod(Vector3D u) |
|
double |
Mv1Squared(Vector u) |
Returns square of vector resulting from subtracting given vector
from this one.
|
void |
nearestImage(Vector dimensions) |
|
void |
normalize() |
Normalizes this vector, so this.squared() == 1.
|
void |
PE(double a) |
Plus-equals (+=) operation, causing a constant value to be added to all
components of this vector.
|
void |
PE(Vector u) |
Plus-equals (+=) operation.
|
void |
PEa1Tv1(double a1,
Vector u) |
Increments (+=) components by (a1 * v1)
|
void |
setPerpendicularTo(Vector v) |
|
void |
setRandomCube(IRandom random) |
Assigns each component to (its own) random value between -0.5 and + 0.5.
|
void |
setRandomInSphere(IRandom random) |
Assigns this vector to equal a point chosen randomly in the volume
of a unit sphere.
|
void |
setRandomSphere(IRandom random) |
Creating a random unit vector on unit sphere Uses only two random number
generator at a time
Based on M.P.
|
void |
setX(int a,
double d) |
Sets the i-th component of the vector to the given value d.
|
double |
squared() |
Returns the square magnitude of this vector, e.g., x^2 + y^2 for D = 2.
|
void |
TE(double a) |
Multiplies all components by a constant.
|
void |
TE(Vector u) |
Times-equals (*=) operation.
|
java.lang.String |
toString() |
|
void |
XE(Vector u) |
Sets this vector equal to the cross product of this vector with the
given vector (only works for 3D vectors).
|
protected double x
protected double y
protected double z
protected static final int nLookUp
protected static final double[] lookUp
public Vector3D()
public Vector3D(double a1,
double a2,
double a3)
public Vector3D(double[] a)
public Vector3D(Vector3D u)
public int getD()
Vectorpublic java.lang.String toString()
toString in class java.lang.Objectpublic double getX(int i)
Vectorpublic void assignTo(double[] array)
Vectorpublic boolean equals(Vector v)
Vectorpublic boolean isZero()
Vectorpublic void E(Vector u)
Vectorpublic void E(double a)
Vectorpublic void E(double a,
double b,
double c)
public void E(double[] u)
Vectorpublic void Ea1Tv1(double a1,
Vector u)
Vectorpublic void PEa1Tv1(double a1,
Vector u)
Vectorpublic void PE(Vector u)
Vectorpublic void PE(double a)
Vectorpublic void ME(Vector u)
Vectorpublic void TE(double a)
Vectorpublic void TE(Vector u)
Vectorpublic void DE(Vector u)
Vectorpublic void Ev1Pv2(Vector u1, Vector u2)
Vectorpublic void Ev1Mv2(Vector u1, Vector u2)
Vectorpublic void mod(Vector u)
Vectorpublic void mod(Vector3D u)
public double squared()
Vectorpublic double Mv1Squared(Vector u)
VectorMv1Squared in interface Vectorpublic double dot(Vector u)
Vectorpublic void setPerpendicularTo(Vector v)
public void setX(int a,
double d)
Vectorpublic void setRandomCube(IRandom random)
VectorsetRandomCube in interface Vectorrandom - the random number generator used to perform the operationpublic void setRandomInSphere(IRandom random)
VectorsetRandomInSphere in interface Vectorrandom - the random number generator used to perform the operationpublic void nearestImage(Vector dimensions)
nearestImage in interface Vectorpublic void setRandomSphere(IRandom random)
setRandomSphere in interface Vectorrandom - the random number generator used to perform the operationpublic void XE(Vector u)
Vectorpublic void normalize()
Vectorpublic boolean isNaN()
Vectorpublic void map(IFunction function)
Vectorprotected static double cubeRoot(double R)