public class Ilv3DFloatVector extends Object
Ilv3DFloatVector
represents a 3 element vector with float
precision.Modifier and Type | Field and Description |
---|---|
static Ilv3DFloatVector |
NEG_X_AXIS
A normalized vector along the x axis (backward direction).
|
static Ilv3DFloatVector |
NEG_Y_AXIS
A normalized vector along the y axis (backward direction).
|
static Ilv3DFloatVector |
NEG_Z_AXIS
A normalized vector along the z axis (backward direction).
|
static Ilv3DFloatVector |
X_AXIS
A normalized vector along the x axis.
|
static Ilv3DFloatVector |
Y_AXIS
A normalized vector along the y axis.
|
static Ilv3DFloatVector |
Z_AXIS
A normalized vector along the z axis.
|
Constructor and Description |
---|
Ilv3DFloatVector()
Creates a new
Vec3f instance. |
Ilv3DFloatVector(float x,
float y,
float z)
Creates a new
Vec3f initialized with the specified parameters. |
Ilv3DFloatVector(Ilv3DFloatVector arg)
Creates a new
Vec3f instance by copying the vector passed as
a parameter. |
Modifier and Type | Method and Description |
---|---|
void |
add(Ilv3DFloatVector b)
Adds a vector to this one.
|
void |
add(Ilv3DFloatVector a,
Ilv3DFloatVector b)
Sets this vector equal to the sum of the 2 vectors passed as parameters.
|
Ilv3DFloatVector |
addScaled(float s,
Ilv3DFloatVector arg)
Returns
this + s * arg which creates new vector. |
void |
addScaled(Ilv3DFloatVector a,
float s,
Ilv3DFloatVector b)
Sets this vector equal to
(a + s * b) . |
Ilv3DFloatVector |
copy()
Returns a copy of this vector.
|
Ilv3DFloatVector |
cross(Ilv3DFloatVector arg)
Returns a new vector that is the cross product of this vector and the one
passed as a parameter.
|
void |
cross(Ilv3DFloatVector a,
Ilv3DFloatVector b)
Sets this vector equal to the cross product of vectors a and b.
|
float |
dot(Ilv3DFloatVector arg)
Returns the scalar product of this vector by the vector passed as a
parameter.
|
float |
get(int i)
Returns the
i th component, 0 <= i < 3 . |
float |
length()
Returns the length of this vector.
|
float |
lengthSquared()
Returns the length squared of this vector.
|
Ilv3DFloatVector |
minus(Ilv3DFloatVector arg)
Creates new vector by subtracting a vector from this one.
|
void |
normalize()
Normalizes this vector.
|
Ilv3DFloatVector |
plus(Ilv3DFloatVector arg)
Creates a new vector which is the sum of this vector and the one passed as
a parameter.
|
void |
scale(float val)
Multiply this vector by a scale factor.
|
void |
set(float x,
float y,
float z)
Sets this vector from the parameters passed.
|
void |
set(Ilv3DFloatVector arg)
Sets this vector equal to the vector passed as a parameter.
|
void |
set(int i,
float val)
Sets the
i th component, 0 <= i < 3 . |
void |
setX(float x)
Sets the x coordinate.
|
void |
setY(float y)
Sets the y coordinate.
|
void |
setZ(float z)
Sets the z coordinate.
|
void |
sub(Ilv3DFloatVector b)
Subtracts a vector from this one.
|
void |
sub(Ilv3DFloatVector a,
Ilv3DFloatVector b)
Sets this vector equal to
a - b |
Ilv3DFloatVector |
times(float val)
Creates a scale copy of this vector.
|
Ilv3DDoubleVector |
toDouble()
Converts this vector to double precision.
|
String |
toString()
Prints this vector.
|
float |
x()
Returns the x coordinate.
|
float |
y()
Returns the y coordinate.
|
float |
z()
Returns the z coordinate.
|
public static final Ilv3DFloatVector X_AXIS
public static final Ilv3DFloatVector Y_AXIS
public static final Ilv3DFloatVector Z_AXIS
public static final Ilv3DFloatVector NEG_X_AXIS
public static final Ilv3DFloatVector NEG_Y_AXIS
public static final Ilv3DFloatVector NEG_Z_AXIS
public Ilv3DFloatVector()
Vec3f
instance.public Ilv3DFloatVector(Ilv3DFloatVector arg)
Vec3f
instance by copying the vector passed as
a parameter.arg
- The vector to copy.public Ilv3DFloatVector(float x, float y, float z)
Vec3f
initialized with the specified parameters.x
- The x coordinate.y
- The y coordinate.z
- The z coordinate.public final Ilv3DFloatVector copy()
public final Ilv3DDoubleVector toDouble()
public final void set(Ilv3DFloatVector arg)
arg
- The vector to copy.public final void set(float x, float y, float z)
x
- The x coordinate.y
- The y coordinate.z
- The z coordinate.public final void set(int i, float val)
i
th component, 0 <= i < 3
.i
- The coordinate index.val
- The coordinate value.public final float get(int i)
i
th component, 0 <= i < 3
.i
- The coordinate index.public final float x()
public final float y()
public final float z()
public final void setX(float x)
x
- The x coordinate.public final void setY(float y)
y
- The y coordinate.public final void setZ(float z)
z
- The z coordinate.public float dot(Ilv3DFloatVector arg)
arg
- The vector to make the dot product with.public final float length()
public final float lengthSquared()
public final void normalize()
public final Ilv3DFloatVector times(float val)
val
- The scale value.public final void scale(float val)
val
- The scale factor.public final Ilv3DFloatVector plus(Ilv3DFloatVector arg)
arg
- The vector to add.public final void add(Ilv3DFloatVector b)
b
- The vector to add.public final void add(Ilv3DFloatVector a, Ilv3DFloatVector b)
a
- The first vector to add.b
- The second vector to add.public final Ilv3DFloatVector addScaled(float s, Ilv3DFloatVector arg)
this + s * arg
which creates new vector.s
- The scale factor.arg
- The vector to add.this + s * arg
.public final void addScaled(Ilv3DFloatVector a, float s, Ilv3DFloatVector b)
(a + s * b)
.a
- The first vector.s
- The scale factor.b
- The second vector.public final Ilv3DFloatVector minus(Ilv3DFloatVector arg)
arg
- The vector to subtract.public final void sub(Ilv3DFloatVector b)
b
- The vector to subtract.public final void sub(Ilv3DFloatVector a, Ilv3DFloatVector b)
a - b
a
- The first vector.b
- The second vector.public final Ilv3DFloatVector cross(Ilv3DFloatVector arg)
arg
- The vector to cross product with.public final void cross(Ilv3DFloatVector a, Ilv3DFloatVector b)
Note: "this" must be a different vector to both a and b.
a
- The first vector.b
- The second vector.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.