Constructor and Description |
---|
Vector3()
This default constructor will initialize vector (0, 0, 0);
|
Vector3(double x,
double y,
double z)
This constructor will initialize vector (X, Y, Z) from the specified
X, Y, Z coordinates.
|
Modifier and Type | Method and Description |
---|---|
Vector3 |
add(double s) |
Vector3 |
add(Vector3 v) |
Vector3 |
add(Vector3 v1,
Vector3 v2) |
void |
addZ(double z)
This method will add specified value to Z coordinate of the vector.
|
double |
angleTo(Vector3 v) |
Vector3 |
apply(Matrix3 m) |
Vector3 |
apply(Matrix4 m) |
Vector3 |
apply(Quaternion q) |
Vector3 |
applyAxisAngle(Vector3 axis,
double angle) |
Vector3 |
applyEuler(Euler euler) |
Vector3 |
applyProjection(Matrix4 m) |
Vector3 |
ceil() |
Vector3 |
clamp(double minVal,
double maxVal) |
Vector3 |
clamp(Vector3 min,
Vector3 max)
This function assumes min < max, if this assumption isn't true it will not operate correctly
|
Vector3 |
clone() |
Vector3 |
copy(Vector3 v)
Set value of the vector from another vector.
|
Vector3 |
cross(Vector3 v) |
Vector3 |
cross(Vector3 a,
Vector3 b)
Sets this vector to be the vector cross product of vectors v1 and v2.
|
double |
distanceTo(Vector3 v1) |
double |
distanceToSquared(Vector3 v1) |
Vector3 |
divide(double scalar) |
Vector3 |
divide(Vector3 v) |
Vector3 |
divide(Vector3 v1,
Vector3 v2) |
double |
dot(Vector3 v1)
Computes the dot product of this vector and vector v1.
|
boolean |
equals(Vector3 v1)
Returns true if all of the data members of v1 are equal to the
corresponding data members in this Vector3.
|
Vector3 |
floor() |
Vector3 |
fromArray(Float32Array array) |
Vector3 |
fromArray(Float32Array array,
int offset) |
double |
getComponent(int index) |
double |
getZ()
get Z coordinate from the vector
|
double |
length()
Returns the length of this vector.
|
double |
lengthManhattan() |
double |
lengthSq()
Returns the squared length of this vector.
|
Vector3 |
lerp(Vector3 v1,
double alpha) |
Vector3 |
max(Vector3 v) |
Vector3 |
min(Vector3 v) |
Vector3 |
multiply(double s) |
Vector3 |
multiply(Vector3 v) |
Vector3 |
multiply(Vector3 v1,
Vector3 v2) |
Vector3 |
negate()
Negates the value of this vector in place.
|
Vector3 |
normalize()
Normalizes this vector in place.
|
Vector3 |
project(Camera camera) |
Vector3 |
projectOnPlane(Vector3 planeNormal) |
Vector3 |
projectOnVector(Vector3 vector) |
Vector3 |
reflect(Vector3 normal)
reflect incident vector off plane orthogonal to normal
normal is assumed to have unit length
|
Vector3 |
round() |
Vector3 |
roundToZero() |
Vector3 |
set(double a)
Set value of the vector to the specified (A, A, A) coordinates.
|
Vector3 |
set(double x,
double y,
double z)
Set value of the vector to the specified (X, Y, Z) coordinates.
|
void |
setComponent(int index,
double value) |
Vector3 |
setFromMatrixColumn(int index,
Matrix4 matrix) |
Vector3 |
setFromMatrixPosition(Matrix4 m) |
Vector3 |
setFromMatrixScale(Matrix4 m) |
Vector3 |
setLength(double l) |
void |
setZ(double z)
This method sets Z coordinate of the vector.
|
Vector3 |
sub(Vector3 v) |
Vector3 |
sub(Vector3 v1,
Vector3 v2) |
Float32Array |
toArray() |
Float32Array |
toArray(Float32Array array,
int offset) |
java.lang.String |
toString() |
Vector3 |
transformDirection(Matrix4 m) |
Vector3 |
unproject(Camera camera) |
public Vector3()
public Vector3(double x, double y, double z)
x
- the X coordinatey
- the Y coordinatez
- the Z coordinatepublic double getZ()
public void addZ(double z)
z
- the Y coordinatepublic void setZ(double z)
z
- the Z coordinatepublic Vector3 set(double x, double y, double z)
x
- the X coordinatey
- the Y coordinatez
- the Z coordinatepublic Vector3 set(double a)
a
- the X, Y and Z coordinatepublic void setComponent(int index, double value)
setComponent
in class Vector2
public double getComponent(int index)
getComponent
in class Vector2
public Vector3 copy(Vector3 v)
v
- the other vectorpublic Vector3 applyProjection(Matrix4 m)
m
- the Matrix4 projection matrixpublic Vector3 apply(Quaternion q)
public Vector3 transformDirection(Matrix4 m)
m
- Matrix4 affine matrix vector interpreted as a directionpublic Vector3 clamp(Vector3 min, Vector3 max)
public Vector3 roundToZero()
roundToZero
in class Vector2
public Vector3 negate()
Vector2
public double dot(Vector3 v1)
v1
- the other vectorpublic double lengthSq()
public double length()
public double lengthManhattan()
public Vector3 normalize()
public Vector3 cross(Vector3 a, Vector3 b)
a
- the first vectorb
- the second vectorpublic Vector3 reflect(Vector3 normal)
normal
- public double angleTo(Vector3 v)
public double distanceTo(Vector3 v1)
public double distanceToSquared(Vector3 v1)
public boolean equals(Vector3 v1)
v1
- the vector with which the comparison is madepublic Vector3 fromArray(Float32Array array)
public Vector3 fromArray(Float32Array array, int offset)
public Float32Array toArray()
public Float32Array toArray(Float32Array array, int offset)