public class Vector3 extends Object implements IVector3, Serializable
Modifier and Type | Field and Description |
---|---|
static IVector3 |
MAX_VALUE
A vector containing the maximum doubleing point value for all components.
|
static IVector3 |
MIN_VALUE
A vector containing the minimum doubleing point value for all components
(note: the components are -
Float.MAX_VALUE , not Float.MIN_VALUE ). |
static IVector3 |
NORMAL_XYZ
A normalized version of UNIT_XYZ.
|
static IVector3 |
UNIT_X
A unit vector in the X+ direction.
|
static IVector3 |
UNIT_XYZ
A vector containing unity for all components.
|
static IVector3 |
UNIT_Y
A unit vector in the Y+ direction.
|
static IVector3 |
UNIT_Z
A unit vector in the Z+ direction.
|
double |
x
The components of the vector.
|
double |
y
The components of the vector.
|
double |
z
The components of the vector.
|
static IVector3 |
ZERO
The zero vector.
|
Constructor and Description |
---|
Vector3()
Creates a zero vector.
|
Vector3(double[] values)
Creates a vector from an array of values.
|
Vector3(double x,
double y,
double z)
Creates a vector from three components.
|
Vector3(IVector3 other)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
Vector3 |
abs()
Absolute-values this vector.
|
Vector3 |
abs(Vector3 result)
Absolute-values this vector, storing the result in the supplied object.
|
Vector3 |
absLocal()
Absolute-values this vector in-place.
|
Vector3 |
add(double x,
double y,
double z)
Adds a vector to this one.
|
Vector3 |
add(double x,
double y,
double z,
Vector3 result)
Adds a vector to this one and stores the result in the object provided.
|
Vector3 |
add(IVector3 other)
Adds a vector to this one.
|
Vector3 |
add(IVector3 other,
Vector3 result)
Adds a vector to this one, storing the result in the object provided.
|
Vector3 |
addLocal(double x,
double y,
double z)
Adds a vector in-place to this one.
|
Vector3 |
addLocal(IVector3 other)
Adds a vector in-place to this one.
|
Vector3 |
addScaled(IVector3 other,
double v)
Adds a scaled vector to this one.
|
Vector3 |
addScaled(IVector3 other,
double v,
Vector3 result)
Adds a scaled vector to this one and stores the result in the supplied vector.
|
Vector3 |
addScaledLocal(IVector3 other,
double v)
Adds a scaled vector in-place to this one.
|
double |
angle(IVector3 other)
Returns the angle between this vector and the specified other vector.
|
Vector3 |
cross(IVector3 other)
Computes the cross product of this and the specified other vector.
|
Vector3 |
cross(IVector3 other,
Vector3 result)
Computes the cross product of this and the specified other vector, placing the result
in the object supplied.
|
Vector3 |
crossLocal(IVector3 other)
Computes the cross product of this and the specified other vector, storing the result
in this vector.
|
double |
distance(IVector3 other)
Returns the distance from this vector to the specified other vector.
|
double |
distanceSquared(IVector3 other)
Returns the squared distance from this vector to the specified other.
|
double |
dot(IVector3 other)
Computes and returns the dot product of this and the specified other vector.
|
boolean |
equals(Object other) |
void |
get(double[] values)
Populates the supplied array with the contents of this vector.
|
DoubleBuffer |
get(DoubleBuffer buf)
Populates the supplied buffer with the contents of this vector.
|
double |
get(int idx)
Returns the element at the idx'th position of the vector.
|
int |
hashCode() |
double |
length()
Returns the length of this vector.
|
double |
lengthSquared()
Returns the squared length of this vector.
|
Vector3 |
lerp(IVector3 other,
double t)
Linearly interpolates between this and the specified other vector by the supplied amount.
|
Vector3 |
lerp(IVector3 other,
double t,
Vector3 result)
Linearly interpolates between this and the supplied other vector by the supplied amount,
storing the result in the supplied object.
|
Vector3 |
lerpLocal(IVector3 other,
double t)
Linearly interpolates between this and the specified other vector in-place by the supplied
amount.
|
double |
manhattanDistance(IVector3 other)
Returns the Manhattan distance between this vector and the specified other.
|
Vector3 |
mult(double v)
Multiplies this vector by a scalar.
|
Vector3 |
mult(double v,
Vector3 result)
Multiplies this vector by a scalar and places the result in the supplied object.
|
Vector3 |
mult(IVector3 other)
Multiplies this vector by another.
|
Vector3 |
mult(IVector3 other,
Vector3 result)
Multiplies this vector by another, storing the result in the object provided.
|
Vector3 |
multLocal(double v)
Multiplies this vector in-place by a scalar.
|
Vector3 |
multLocal(IVector3 other)
Multiplies this vector in-place by another.
|
Vector3 |
negate()
Negates this vector.
|
Vector3 |
negate(Vector3 result)
Negates this vector, storing the result in the supplied object.
|
Vector3 |
negateLocal()
Negates this vector in-place.
|
Vector3 |
normalize()
Normalizes this vector.
|
Vector3 |
normalize(Vector3 result)
Normalizes this vector, storing the result in the object supplied.
|
Vector3 |
normalizeLocal()
Normalizes this vector in-place.
|
Vector3 |
set(double[] values)
Copies the elements of an array.
|
Vector3 |
set(double x,
double y,
double z)
Sets all of the elements of the vector.
|
Vector3 |
set(IVector3 other)
Copies the elements of another vector.
|
Vector3 |
subtract(IVector3 other)
Subtracts a vector from this one.
|
Vector3 |
subtract(IVector3 other,
Vector3 result)
Subtracts a vector from this one and places the result in the supplied object.
|
Vector3 |
subtractLocal(IVector3 other)
Subtracts a vector in-place from this one.
|
String |
toString() |
double |
triple(IVector3 b,
IVector3 c)
Computes the triple product of this and the specified other vectors, which is equal to
this.dot(b.cross(c)) . |
double |
x()
Returns the x-component of this vector.
|
double |
y()
Returns the y-component of this vector.
|
double |
z()
Returns the z-component of this vector.
|
public static final IVector3 UNIT_X
public static final IVector3 UNIT_Y
public static final IVector3 UNIT_Z
public static final IVector3 UNIT_XYZ
public static final IVector3 NORMAL_XYZ
public static final IVector3 ZERO
public static final IVector3 MIN_VALUE
Float.MAX_VALUE
, not Float.MIN_VALUE
).public static final IVector3 MAX_VALUE
public double x
public double y
public double z
public Vector3(double x, double y, double z)
public Vector3(double[] values)
public Vector3(IVector3 other)
public Vector3()
public Vector3 crossLocal(IVector3 other)
public Vector3 negateLocal()
public Vector3 absLocal()
public Vector3 normalizeLocal()
public Vector3 multLocal(double v)
public Vector3 multLocal(IVector3 other)
public Vector3 addLocal(IVector3 other)
public Vector3 subtractLocal(IVector3 other)
public Vector3 addLocal(double x, double y, double z)
public Vector3 addScaledLocal(IVector3 other, double v)
public Vector3 lerpLocal(IVector3 other, double t)
public Vector3 set(IVector3 other)
public Vector3 set(double[] values)
public Vector3 set(double x, double y, double z)
public double x()
IVector3
public double y()
IVector3
public double z()
IVector3
public double dot(IVector3 other)
IVector3
public Vector3 cross(IVector3 other)
IVector3
public Vector3 cross(IVector3 other, Vector3 result)
IVector3
public double triple(IVector3 b, IVector3 c)
IVector3
this.dot(b.cross(c))
.public Vector3 negate(Vector3 result)
IVector3
public Vector3 abs(Vector3 result)
IVector3
public Vector3 normalize()
IVector3
public Vector3 normalize(Vector3 result)
IVector3
public double angle(IVector3 other)
IVector3
public double length()
IVector3
public double lengthSquared()
IVector3
lengthSquared
in interface IVector3
public double distance(IVector3 other)
IVector3
public double distanceSquared(IVector3 other)
IVector3
distanceSquared
in interface IVector3
public double manhattanDistance(IVector3 other)
IVector3
manhattanDistance
in interface IVector3
public Vector3 mult(double v)
IVector3
public Vector3 mult(double v, Vector3 result)
IVector3
public Vector3 mult(IVector3 other)
IVector3
public Vector3 mult(IVector3 other, Vector3 result)
IVector3
public Vector3 add(IVector3 other)
IVector3
public Vector3 add(IVector3 other, Vector3 result)
IVector3
public Vector3 subtract(IVector3 other)
IVector3
public Vector3 subtract(IVector3 other, Vector3 result)
IVector3
public Vector3 add(double x, double y, double z)
IVector3
public Vector3 add(double x, double y, double z, Vector3 result)
IVector3
public Vector3 addScaled(IVector3 other, double v)
IVector3
public Vector3 addScaled(IVector3 other, double v, Vector3 result)
IVector3
public Vector3 lerp(IVector3 other, double t)
IVector3
public Vector3 lerp(IVector3 other, double t, Vector3 result)
IVector3
public double get(int idx)
IVector3
public void get(double[] values)
IVector3
public DoubleBuffer get(DoubleBuffer buf)
IVector3
Copyright © 2017. All rights reserved.