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