Class Vector3d
- java.lang.Object
-
- WildMagic.LibFoundation.Mathematics.Vector3d
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Vector3d>
public class Vector3d extends java.lang.Object implements java.lang.Comparable<Vector3d>, java.io.Serializable
3D Vector object.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Vector3d
ONE
One vector: (1,1,1)private static long
serialVersionUID
Serialization supportstatic Vector3d
UNIT_X
Unit-X vector: (1,0,0)static Vector3d
UNIT_X_NEG
negative unit-X vector: (-1,0,0)static Vector3d
UNIT_Y
Unit-Y vector: (0,1,0)static Vector3d
UNIT_Y_NEG
negative unit-Y vector: (0,-1,0)static Vector3d
UNIT_Z
Unit-Z vector: (0,0,1)static Vector3d
UNIT_Z_NEG
negative unit-Z vector: (0,0,-1)double
X
Vector data:double
Y
double
Z
static Vector3d
ZERO
Zero vector: (0,0,0)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Vector3d
add(double fX, double fY, double fZ)
Add the inputs to this, this = this + fX,fY,fZVector3d
add(Vector3d rkV)
Add the input vector to this: this = this + rkVstatic Vector3d
add(Vector3d rkV1, Vector3d rkV2)
Add the two input vectors, setting this: this = rkV1 + rkV2void
Add(double fX, double fY, double fZ)
Deprecated.void
Add(Vector3d rkV)
Deprecated.void
Add(Vector3d rkV1, Vector3d rkV2)
Deprecated.double
angle(Vector3d rkV1)
static double
angle(Vector3d rkV1, Vector3d rkV2)
double
Angle(Vector3d rkV1)
Deprecated.static double
Angle(Vector3d rkV1, Vector3d rkV2)
Deprecated.int
compare(Vector3d arg0, Vector3d arg1)
Sorting a list of Vector3d in order, where each element is a column when two Vector3d have equal X then the sort is by Y.int
compareTo(Vector3d arg0)
static void
computeExtremes(int iVQuantity, Vector3d[] akPoint, Vector3d rkMin, Vector3d rkMax)
static void
ComputeExtremes(int iVQuantity, Vector3d[] akPoint, Vector3d rkMin, Vector3d rkMax)
Deprecated.Vector3d
copy(Vector3d rkV)
void
Copy(Vector3d rkV)
Deprecated.Vector3d
cross(Vector3d rkV)
static Vector3d
cross(Vector3d kV1, Vector3d kV2)
void
Cross(Vector3d rkV)
Deprecated.void
Cross(Vector3d kV1, Vector3d kV2)
Deprecated.double
distance(Vector3d kV)
double
Distance(Vector3d kV)
Deprecated.Vector3d
div(double fScalar)
static Vector3d
div(double fScalar, Vector3d kV)
void
Div(double fScalar)
Deprecated.void
Div(double fScalar, Vector3d kV)
Deprecated.double
dot(Vector3d rkV)
double
Dot(Vector3d rkV)
Deprecated.boolean
equals(java.lang.Object kObject)
static void
generateComplementBasis(Vector3d rkU, Vector3d rkV, Vector3d rkW)
static void
GenerateComplementBasis(Vector3d rkU, Vector3d rkV, Vector3d rkW)
Deprecated.static void
generateOrthonormalBasis(Vector3d rkU, Vector3d rkV, Vector3d rkW)
static void
GenerateOrthonormalBasis(Vector3d rkU, Vector3d rkV, Vector3d rkW)
Deprecated.int
hashCode()
Vector3d
invert()
void
Invert()
Deprecated.boolean
isEqual(Vector3d rkV)
boolean
IsEqual(Vector3d rkV)
Deprecated.boolean
isLessThan(Vector3d rkV)
boolean
IsLessThan(Vector3d rkV)
Deprecated.double
length()
double
Length()
Deprecated.Vector3d
max(Vector3d kV)
void
Max(Vector3d kV)
Deprecated.Vector3d
min(Vector3d kV)
void
Min(Vector3d kV)
Deprecated.Vector3d
mult(Vector3d rkV)
static Vector3d
mult(Vector3d rkV1, Vector3d rkV2)
void
Mult(Vector3d rkV)
Deprecated.void
Mult(Vector3d rkV1, Vector3d rkV2)
Deprecated.Vector3d
neg()
static Vector3d
neg(Vector3d kV)
void
Neg()
Deprecated.void
Neg(Vector3d kV)
Deprecated.double
normalize()
static double
normalize(Vector3d kV)
double
Normalize()
Deprecated.double
Normalize(Vector3d kV)
Deprecated.Vector3d
scale(double fScalar)
this = this * fScalarVector3d
scale(double fX, double fY, double fZ)
static Vector3d
scale(double fScalar, Vector3d rkV)
void
Scale(double fScalar)
Deprecated.void
Scale(double fX, double fY, double fZ)
Deprecated.void
Scale(double fScalar, Vector3d rkV)
Deprecated.Vector3d
scaleAdd(double fScalar, Vector3d rkV1, Vector3d rkV2)
void
ScaleAdd(double fScalar, Vector3d rkV1, Vector3d rkV2)
Deprecated.Vector3d
set(double fX, double fY, double fZ)
void
Set(double fX, double fY, double fZ)
Deprecated.double
squaredDistance(Vector3d kV)
double
SquaredDistance(Vector3d kV)
Deprecated.double
squaredLength()
double
SquaredLength()
Deprecated.Vector3d
sub(Vector3d rkV)
this = this - rkVstatic Vector3d
sub(Vector3d rkV1, Vector3d rkV2)
void
Sub(Vector3d rkV)
Deprecated.void
Sub(Vector3d rkV1, Vector3d rkV2)
Deprecated.double
sum()
double
Sum()
Deprecated.java.lang.String
toString()
Returns a string representation of the vector values.Vector3d
unitCross(Vector3d rkV)
static Vector3d
unitCross(Vector3d kV1, Vector3d kV2)
void
UnitCross(Vector3d rkV)
Deprecated.void
UnitCross(Vector3d kV1, Vector3d kV2)
Deprecated.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serialization support- See Also:
- Constant Field Values
-
ZERO
public static final transient Vector3d ZERO
Zero vector: (0,0,0)
-
UNIT_X
public static final transient Vector3d UNIT_X
Unit-X vector: (1,0,0)
-
UNIT_Y
public static final transient Vector3d UNIT_Y
Unit-Y vector: (0,1,0)
-
UNIT_Z
public static final transient Vector3d UNIT_Z
Unit-Z vector: (0,0,1)
-
UNIT_X_NEG
public static final transient Vector3d UNIT_X_NEG
negative unit-X vector: (-1,0,0)
-
UNIT_Y_NEG
public static final transient Vector3d UNIT_Y_NEG
negative unit-Y vector: (0,-1,0)
-
UNIT_Z_NEG
public static final transient Vector3d UNIT_Z_NEG
negative unit-Z vector: (0,0,-1)
-
ONE
public static final transient Vector3d ONE
One vector: (1,1,1)
-
X
public double X
Vector data:
-
Y
public double Y
-
Z
public double Z
-
-
Constructor Detail
-
Vector3d
public Vector3d()
construction, initialized to (0,0,0)
-
Vector3d
public Vector3d(double fX, double fY, double fZ)
construction- Parameters:
fX
- x-valuefY
- y-valuefZ
- z-value
-
Vector3d
public Vector3d(double[] afTuple)
construction- Parameters:
afTuple
- x,y,z values
-
Vector3d
public Vector3d(Vector3d rkV)
copy construction- Parameters:
rkV
- vector to copy.
-
-
Method Detail
-
Angle
public static double Angle(Vector3d rkV1, Vector3d rkV2)
Deprecated.- Parameters:
rkV1
-rkV2
-- Returns:
-
ComputeExtremes
public static void ComputeExtremes(int iVQuantity, Vector3d[] akPoint, Vector3d rkMin, Vector3d rkMax)
Deprecated.Computes the extremes: min, max for x,y,z from an array of Vector3d.- Parameters:
iVQuantity
- the number of Vector3d in the arrayakPoint
- the array of Vector3d to compute the extremes for.rkMin
- set to minimum (x,y,z) of all the Vectors in the array.rkMax
- set to maximum (x,y,z) of all the Vectors in the array.
-
computeExtremes
public static void computeExtremes(int iVQuantity, Vector3d[] akPoint, Vector3d rkMin, Vector3d rkMax)
-
GenerateComplementBasis
public static void GenerateComplementBasis(Vector3d rkU, Vector3d rkV, Vector3d rkW)
Deprecated.Input W must be a unit-length vector. The output vectors {U,V} are unit length and mutually perpendicular, and {U,V,W} is an orthonormal basis.- Parameters:
rkU
- UrkV
- VrkW
- W, input and output
-
generateComplementBasis
public static void generateComplementBasis(Vector3d rkU, Vector3d rkV, Vector3d rkW)
-
GenerateOrthonormalBasis
public static void GenerateOrthonormalBasis(Vector3d rkU, Vector3d rkV, Vector3d rkW)
Deprecated.Input W must be a nonzero vector. The output is an orthonormal basis {U,V,W}. The input W is normalized by this function. If you know W is already unit length, use GenerateComplementBasis to compute U and V.- Parameters:
rkU
- UrkV
- VrkW
- W, input and output
-
generateOrthonormalBasis
public static void generateOrthonormalBasis(Vector3d rkU, Vector3d rkV, Vector3d rkW)
-
add
public Vector3d add(double fX, double fY, double fZ)
Add the inputs to this, this = this + fX,fY,fZ- Parameters:
fX
- x-valuefY
- y-valuefZ
- z-value
-
add
public Vector3d add(Vector3d rkV)
Add the input vector to this: this = this + rkV- Parameters:
rkV
-- Returns:
- this
-
add
public static Vector3d add(Vector3d rkV1, Vector3d rkV2)
Add the two input vectors, setting this: this = rkV1 + rkV2- Parameters:
rkV1
- first input vectorrkV2
- second input vector
-
Add
public void Add(double fX, double fY, double fZ)
Deprecated.Add the inputs to this, this = this + fX,fY,fZ- Parameters:
fX
- x-valuefY
- y-valuefZ
- z-value
-
Add
public void Add(Vector3d rkV)
Deprecated.Add the input vector to this: this = this + rkV- Parameters:
rkV
- input vector to add to this
-
Add
public void Add(Vector3d rkV1, Vector3d rkV2)
Deprecated.Add the two input vectors, setting this: this = rkV1 + rkV2- Parameters:
rkV1
- first input vectorrkV2
- second input vector
-
Angle
public double Angle(Vector3d rkV1)
Deprecated.
-
angle
public double angle(Vector3d rkV1)
-
Copy
public void Copy(Vector3d rkV)
Deprecated.copy into this vector.- Parameters:
rkV
- vector to copy.
-
Cross
public void Cross(Vector3d rkV)
Deprecated.The cross products are computed using the right-handed rule. Be aware that some graphics APIs use a left-handed rule. If you have to compute a cross product with these functions and send the result to the API that expects left-handed, you will need to change sign on the vector (replace each component value c by -c). this = this ^ kV- Parameters:
rkV
- vector to cross with this
-
Cross
public void Cross(Vector3d kV1, Vector3d kV2)
Deprecated.The cross products are computed using the right-handed rule. Be aware that some graphics APIs use a left-handed rule. If you have to compute a cross product with these functions and send the result to the API that expects left-handed, you will need to change sign on the vector (replace each component value c by -c). this = kV1 ^ kV2- Parameters:
kV1
- first vectorkV2
- second vector
-
Distance
public double Distance(Vector3d kV)
Deprecated.Compute the distance from this vector to the input vector.- Parameters:
kV
- vector to calculate distance to.- Returns:
- distance from this vector to the input vector.
-
distance
public double distance(Vector3d kV)
-
Div
public void Div(double fScalar)
Deprecated.Divide this vector by fScalar: this = this/fScalar- Parameters:
fScalar
- scale value
-
div
public Vector3d div(double fScalar)
-
Div
public void Div(double fScalar, Vector3d kV)
Deprecated.Divide the vector by fScalar, setting this: this = kV/fScalar- Parameters:
fScalar
- scale valuekV
- input vector
-
Dot
public double Dot(Vector3d rkV)
Deprecated.Compute dot-product of this vector with input vector:- Returns:
- dot-product of this vector with input vector:
-
dot
public double dot(Vector3d rkV)
-
equals
public boolean equals(java.lang.Object kObject)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
Invert
public void Invert()
Deprecated.Invert this vector: this = 1/this;
-
invert
public Vector3d invert()
-
IsEqual
public boolean IsEqual(Vector3d rkV)
Deprecated.Return true if the input Vector3d is equal to this.- Parameters:
rkV
- input vector to compare to this- Returns:
- true if the input Vector3d is equal to this, false otherwise.
-
isEqual
public boolean isEqual(Vector3d rkV)
-
IsLessThan
public boolean IsLessThan(Vector3d rkV)
Deprecated.Return true if the input Vector3d is less than to this.- Parameters:
rkV
- input vector to compare to this- Returns:
- true if the input Vector3d is less than to this, false otherwise.
-
isLessThan
public boolean isLessThan(Vector3d rkV)
-
Length
public double Length()
Deprecated.Compute length this vector:- Returns:
- length this vector
-
length
public double length()
-
Max
public void Max(Vector3d kV)
Deprecated.Maximum function. Sets this to be the maximum of this and the input vector: this = max( this, kV ).- Parameters:
kV
- input vector.
-
Min
public void Min(Vector3d kV)
Deprecated.Minimum function. Sets this to be the minimum of this and the input vector: this = min( this, kV ).- Parameters:
kV
- input vector.
-
Mult
public void Mult(Vector3d rkV)
Deprecated.Multiply the input vector to this: this = this * rkV- Parameters:
rkV
- input vector to multiply to this
-
Mult
public void Mult(Vector3d rkV1, Vector3d rkV2)
Deprecated.Multiply the two input vectors, setting this: this = rkV1 * rkV2- Parameters:
rkV1
- first input vectorrkV2
- second input vector
-
Neg
public void Neg()
Deprecated.Negate this vector: this = - this.
-
neg
public Vector3d neg()
-
Neg
public void Neg(Vector3d kV)
Deprecated.Set this to the negative of the input vector: this = -kV.- Parameters:
kV
- input vector.
-
Normalize
public double Normalize()
Deprecated.Normalize this vector, return original length:- Returns:
- original length:
-
normalize
public double normalize()
-
Normalize
public double Normalize(Vector3d kV)
Deprecated.Normalize this vector, return original length:- Returns:
- original length:
-
normalize
public static double normalize(Vector3d kV)
-
Scale
public void Scale(double fScalar)
Deprecated.Scale this vector by input: this = this * fScalar.- Parameters:
fScalar
- scale value
-
scale
public Vector3d scale(double fScalar)
this = this * fScalar- Parameters:
fScalar
-- Returns:
- this
-
Scale
public void Scale(double fX, double fY, double fZ)
Deprecated.Scale this vector by input: this = this * fScalar.- Parameters:
fX
- scale X valuefY
- scale Y valuefZ
- scale Z value
-
scale
public Vector3d scale(double fX, double fY, double fZ)
-
Scale
public void Scale(double fScalar, Vector3d rkV)
Deprecated.Scale the input vector by the scalar, setting this: this = fScalar * rkV.- Parameters:
fScalar
- scale valuerkV
- input vector
-
scale
public static Vector3d scale(double fScalar, Vector3d rkV)
- Parameters:
fScalar
-rkV
-- Returns:
- fScalar * rkV
-
ScaleAdd
public void ScaleAdd(double fScalar, Vector3d rkV1, Vector3d rkV2)
Deprecated.Scale the input vector by the scalar, setting this: this = fScalar * rkV1 + rkV2.- Parameters:
fScalar
- scale valuerkV1
- input vectorrkV2
- input vector
-
Set
public void Set(double fX, double fY, double fZ)
Deprecated.construction- Parameters:
fX
- x-valuefY
- y-valuefZ
- z-value
-
set
public Vector3d set(double fX, double fY, double fZ)
-
SquaredDistance
public double SquaredDistance(Vector3d kV)
Deprecated.Compute the distance from this vector to the input vector.- Parameters:
kV
- vector to calculate distance to.- Returns:
- distance from this vector to the input vector.
-
squaredDistance
public double squaredDistance(Vector3d kV)
-
SquaredLength
public double SquaredLength()
Deprecated.Compute squared-length this vector:- Returns:
- squared-length this vector
-
squaredLength
public double squaredLength()
-
Sub
public void Sub(Vector3d rkV)
Deprecated.Subtract the input vector from this: this = this - rkV- Parameters:
rkV
- input vector to subtract from this
-
Sub
public void Sub(Vector3d rkV1, Vector3d rkV2)
Deprecated.Subtract the two input vectors, setting this: this = rkV1 - rkV2- Parameters:
rkV1
- first input vectorrkV2
- second input vector
-
Sum
public double Sum()
Deprecated.Sum the elements of the vector.- Returns:
- vector sum
-
sum
public double sum()
-
toString
public java.lang.String toString()
Returns a string representation of the vector values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- string representation of the vector values.
-
UnitCross
public void UnitCross(Vector3d rkV)
Deprecated.The cross products are computed using the right-handed rule. Be aware that some graphics APIs use a left-handed rule. If you have to compute a cross product with these functions and send the result to the API that expects left-handed, you will need to change sign on the vector (replace each component value c by -c). this = this ^ kV Normalize(this)- Parameters:
rkV
- vector to cross with this
-
UnitCross
public void UnitCross(Vector3d kV1, Vector3d kV2)
Deprecated.The cross products are computed using the right-handed rule. Be aware that some graphics APIs use a left-handed rule. If you have to compute a cross product with these functions and send the result to the API that expects left-handed, you will need to change sign on the vector (replace each component value c by -c). this = kV1 ^ kV2 Normalize(this)- Parameters:
kV1
- first vectorkV2
- second vector
-
compare
public int compare(Vector3d arg0, Vector3d arg1)
Sorting a list of Vector3d in order, where each element is a column when two Vector3d have equal X then the sort is by Y.- Parameters:
arg0
-arg1
-- Returns:
-
-