|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ProGAL.geomNd.Vector
public class Vector
A vector in metric space represented with double precision.
Constructor Summary | |
---|---|
Vector(double[] coords)
Construct a vector with the specified coordinates |
|
Vector(int dim)
|
|
Vector(Point p)
Construct a vector pointing from origo to p. |
|
Vector(Point p1,
Point p2)
Constructs a vector between two points p1 and p2 - added by pawel 12-11-2011 |
|
Vector(Vector v)
Construct a vector that is a clone of v. |
Method Summary | |
---|---|
Vector |
add(Vector v)
Add v to this vector and return the result (without changing this object). |
Vector |
addThis(Vector v)
Add v to this vector and return the result (changing this object). |
double |
angle(Vector v)
Get the angle between this vector and v. |
Vector |
clone()
Create a clone of this vector. |
Vector |
divide(double s)
Divide this vector by s and return the result (without changing this object). |
Vector |
divideThis(double s)
Divide this vector by s and return the result (changing this object). |
double |
dot(Vector v)
Get the dot-product of this vector and v. |
boolean |
equals(java.lang.Object v)
|
boolean |
equals(Vector v)
Return true if this vector equals v. |
double |
get(int i)
Get the i'th coordinate. |
static double |
getAngle(Vector u,
Vector v)
Get the angle between vector u and v. |
double |
getCoord(int i)
Get the i'th coordinate. |
int |
getDimensions()
Get the dimensionality of this vector |
double |
getLengthSquared()
Get the squared length of this vector. |
boolean |
isZeroVector()
Return true if the length of this vector is 0. |
double |
length()
Get the length of this vector. |
Vector |
multiply(double s)
Multiply this vector by s and return the result (without changing this object). |
Vector |
multiplyThis(double s)
Multiply this vector by s and return the result (changing this object). |
Vector |
normalize()
Normalize this vector and return the result (without changing this object). |
Vector |
normalizeThis()
Normalize this vector and return the result (changing this object). |
Matrix |
outerProduct(Vector v)
|
Vector |
scaleToLength(double length)
Scale this vector to a certain length (returns new object and does not change this object). |
Vector |
scaleToLengthThis(double length)
Scale this vector to a certain length (changes this object). |
void |
set(int i,
double v)
Set the i'th coordinate to v |
void |
setCoord(int i,
double v)
Set the i'th coordinate to v |
void |
setCoords(double[] coords)
Set the coordinates |
Vector |
subtract(Vector v)
Subtract v from this vector and return the result (without changing this object). |
Vector |
subtractThis(Vector v)
Subtract v from this vector and return the result (changing this object). |
void |
toConsole()
Writes this vector to System.out . |
void |
toConsole(int dec)
Writes this vector to System.out with dec decimals precision. |
Point |
toPoint()
Convert this vector to a point. |
java.lang.String |
toString()
Returns a string-representation of this vector formatted with two decimals precision. |
java.lang.String |
toString(int dec)
Returns a string-representation of this vector formatted with dec decimals precision. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Vector(Point p)
public Vector(Point p1, Point p2)
public Vector(Vector v)
public Vector(double[] coords)
public Vector(int dim)
Method Detail |
---|
public double getCoord(int i)
public double get(int i)
public int getDimensions()
public void setCoord(int i, double v)
public void setCoords(double[] coords)
public void set(int i, double v)
public double getLengthSquared()
public double length()
public boolean isZeroVector()
public double dot(Vector v)
public double angle(Vector v)
public Vector add(Vector v)
public Vector addThis(Vector v)
public Vector subtract(Vector v)
public Vector subtractThis(Vector v)
public Vector multiply(double s)
public Vector multiplyThis(double s)
public Vector divide(double s)
public Vector divideThis(double s)
public Matrix outerProduct(Vector v)
public Vector normalize()
public Vector normalizeThis()
public Vector scaleToLength(double length)
public Vector scaleToLengthThis(double length)
public Point toPoint()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int dec)
dec
decimals precision.
public void toConsole()
System.out
.
public void toConsole(int dec)
System.out
with dec
decimals precision.
public boolean equals(Vector v)
public boolean equals(java.lang.Object v)
equals
in class java.lang.Object
public Vector clone()
clone
in class java.lang.Object
public static double getAngle(Vector u, Vector v)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |