public abstract class AVector extends Object implements Cloneable, Comparable<AVector>, Serializable
| Constructor and Description |
|---|
AVector() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(AVector v)
Adds another vector to this one
|
void |
addMultiple(AVector v,
double factor)
Adds a scaled multiple of another vector to this one
|
double |
angle(AVector v)
Returns the euclidean angle between this vector and another vector
|
boolean |
approxEquals(AVector v) |
boolean |
approxEquals(AVector v,
double tolerance) |
AVector |
clone()
Clones the vector, creating a new copy of all data
|
int |
compareTo(AVector a) |
void |
copy(int start,
int length,
AVector dest,
int destOffset)
Copies a suset of this vector to a vector at the specified offset
|
void |
copyTo(AVector dest,
int offset)
Copies a the contents of a vector to a vector at the specified offset
|
void |
copyTo(double[] data,
int offset)
Copies a the contents of a vector to a double array at the specified offset
|
double |
distance(AVector v) |
double |
distanceSquared(AVector v) |
double |
dotProduct(AVector v) |
boolean |
equals(Object o)
Test for equality on vectors.
|
void |
fill(double value)
Fills a vector with a given value
|
abstract double |
get(int i) |
int |
hashCode() |
boolean |
isMutable()
Returns true if this vector is mutable.
|
boolean |
isReference()
Returns true if this vector references other vectors / data.
|
boolean |
isUnitLengthVector()
Returns true if the vector has unit length
|
boolean |
isZeroVector()
Returns true if this vector is a zero vector (all components zero)
|
AVector |
join(AVector second)
Returns a new vector that refers to this vector joined to a second vector
|
abstract int |
length() |
double |
magnitude()
Returns the magnitude (Euclidean length) of the vector
|
double |
magnitudeSquared() |
double |
manhattanDistance(AVector v) |
void |
multiply(double factor)
Multiplies the vector by a constant factor
|
void |
negate() |
void |
normalise() |
void |
set(AVector a)
Sets the vector to equal the value of another vector
|
abstract void |
set(int i,
double value) |
void |
setValues(double... values) |
void |
subtract(AVector v)
Subtracts a vector from this vector
|
void |
subtractMultiple(AVector v,
double factor)
Subtracts a scaled multiple of another vector from this vector
|
AVector |
subVector(int offset,
int length)
Obtains a sub-vector that refers to this vector.
|
List<Double> |
toList() |
String |
toString() |
public abstract int length()
public abstract double get(int i)
public abstract void set(int i,
double value)
public AVector subVector(int offset, int length)
public AVector join(AVector second)
second - public int compareTo(AVector a)
compareTo in interface Comparable<AVector>public boolean equals(Object o)
public boolean approxEquals(AVector v)
public boolean approxEquals(AVector v, double tolerance)
public void copyTo(double[] data,
int offset)
public void copyTo(AVector dest, int offset)
public void copy(int start,
int length,
AVector dest,
int destOffset)
public void fill(double value)
value - public void multiply(double factor)
factor - Factor by which to multiply each component of the vectorpublic double magnitudeSquared()
public double dotProduct(AVector v)
public double magnitude()
public double distanceSquared(AVector v)
public double distance(AVector v)
public double manhattanDistance(AVector v)
public double angle(AVector v)
public void normalise()
public void negate()
public void set(AVector a)
public void setValues(double... values)
public AVector clone()
public boolean isReference()
public boolean isMutable()
public void add(AVector v)
v - public void addMultiple(AVector v, double factor)
v - public void subtract(AVector v)
v - public boolean isZeroVector()
public boolean isUnitLengthVector()
public void subtractMultiple(AVector v, double factor)
v - Copyright © 2012. All Rights Reserved.