public class VectorF
extends java.lang.Object
VectorF
represents a single-dimensional vector of floats. It is not a matrix,
but can easily be converted into either a RowMatrixF
or a ColumnMatrixF
should
that be desired. That said, vectors can be multiplied by matrices to their left (or right); this
is commonly used to transform a set of coordinates (in the vector) by a transformation matrix.MatrixF
,
RowMatrixF
,
ColumnMatrixF
Modifier and Type | Field and Description |
---|---|
protected float[] |
data |
Constructor and Description |
---|
VectorF(float x) |
VectorF(float[] data) |
VectorF(float x,
float y) |
VectorF(float x,
float y,
float z) |
VectorF(float x,
float y,
float z,
float w) |
Modifier and Type | Method and Description |
---|---|
void |
add(VectorF addend) |
MatrixF |
added(MatrixF addend)
Adds this vector, taken as a row vector against, to the indicated matrix.
|
VectorF |
added(VectorF addend) |
protected java.lang.RuntimeException |
dimensionsError() |
protected static java.lang.RuntimeException |
dimensionsError(int length) |
float |
dotProduct(VectorF him)
Returns the dot product of this vector and another.
|
float |
get(int index) |
float[] |
getData() |
int |
length() |
static VectorF |
length(int length)
Creates a new vector of the indicated length.
|
float |
magnitude() |
VectorF |
multiplied(float scale)
Returns a new vector containing the elements of this vector scaled by the indicated factor.
|
MatrixF |
multiplied(MatrixF him)
Multiplies this vector, taken as a row vector, against the indicated matrix.
|
void |
multiply(float scale) |
VectorF |
normalized3D()
Consider this vector as a 3D coordinate or 3D homogeneous coordinate, and, if the
latter, return its normalized form.
|
void |
put(int index,
float value) |
void |
subtract(VectorF subtrahend) |
MatrixF |
subtracted(MatrixF subtrahend)
Subtracts the indicated matrix from this vector, taken as a row vector.
|
VectorF |
subtracted(VectorF subtrahend) |
java.lang.String |
toString() |
public VectorF(float[] data)
public VectorF(float x)
public VectorF(float x, float y)
public VectorF(float x, float y, float z)
public VectorF(float x, float y, float z, float w)
public static VectorF length(int length)
length
- the length of the new vector to return@Const public float[] getData()
@Const public int length()
@Const public float get(int index)
@NonConst public void put(int index, float value)
public java.lang.String toString()
toString
in class java.lang.Object
@Const public VectorF normalized3D()
@Const public float magnitude()
@Const public float dotProduct(VectorF him)
him
- the other vector with whom the dot product is to be formed@Const public MatrixF multiplied(MatrixF him)
@Const public MatrixF added(MatrixF addend)
@Const public MatrixF subtracted(MatrixF subtrahend)
@Const public VectorF multiplied(float scale)
@NonConst public void multiply(float scale)
protected java.lang.RuntimeException dimensionsError()
protected static java.lang.RuntimeException dimensionsError(int length)