public class Vector
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
int |
dimensions
The dimensions.
|
double |
magnitude
The magnitude.
|
(package private) static java.text.NumberFormat |
nf
The nf.
|
private double[] |
values
The values.
|
| Constructor and Description |
|---|
Vector()
Instantiates a new vector.
|
Vector(double... ds)
Instantiates a new vector.
|
Vector(int dimensions)
Instantiates a new vector.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Vector v)
Adds the.
|
void |
add(Vector v,
double scale)
Adds the.
|
Vector |
copy()
Copy.
|
void |
copy(Vector copy)
Copy.
|
void |
division(double value)
Division.
|
double |
dotProduct(Vector v)
Dot product.
|
double |
getDistance(Vector otherVector)
Gets the distance.
|
double |
getMagnitude()
Gets the magnitude.
|
double |
getValue(int n)
Gets the value.
|
void |
inverse()
Inverse.
|
void |
normalizeVector()
Normalize vector.
|
void |
normalizeVectorInverse()
Normalize vector inverse.
|
static Vector |
parse(java.lang.String str)
Parses the.
|
static Vector |
parseSingle(double x,
double y,
double z)
Parses the single.
|
void |
product(double value)
Product.
|
void |
setValue(int n,
double value)
Sets the value.
|
void |
subtract(Vector v)
Subtract.
|
void |
subtract(Vector v,
double scale)
Subtract.
|
java.lang.String |
toString() |
java.lang.String |
toStringSpace()
To string space.
|
void |
update(double... ds)
Update.
|
void |
updateMagnitude()
Update magnitude.
|
void |
zero()
Zero.
|
public int dimensions
private double[] values
public double magnitude
static java.text.NumberFormat nf
public Vector()
public Vector(int dimensions)
dimensions - the dimensionspublic Vector(double... ds)
ds - the dspublic void setValue(int n,
double value)
n - the nvalue - the valuepublic double getValue(int n)
n - the npublic static Vector parse(java.lang.String str)
str - the strpublic static Vector parseSingle(double x, double y, double z)
x - the xy - the yz - the zpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toStringSpace()
public void copy(Vector copy)
copy - the copypublic Vector copy()
public void update(double... ds)
ds - the dspublic void updateMagnitude()
public void add(Vector v)
v - the vpublic void add(Vector v, double scale)
v - the vscale - the scalepublic void subtract(Vector v)
v - the vpublic void subtract(Vector v, double scale)
v - the vscale - the scalepublic double getMagnitude()
public double dotProduct(Vector v)
v - the vpublic void product(double value)
value - the valuepublic void division(double value)
value - the valuepublic void normalizeVector()
public void inverse()
public void normalizeVectorInverse()
public double getDistance(Vector otherVector)
otherVector - the other vectorpublic void zero()