|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--jdsl.extension.LEDA.Layout.Geometry.Vector2D
This class represents a two-dimensional vector, or, likewise, its endpoint. It has serveral methods for easy handling, e.g. arithmetical operations. It has a copy constructor and a clone method for easy copy actions.
| Constructor Summary | |
Vector2D()
Constructs a null vector. |
|
Vector2D(double x,
double y)
Constructs a new vector with given components. |
|
Vector2D(double r,
double phi,
Vector2D p)
Constructs a new point by using polar coordinates (from a different origin). |
|
Vector2D(Point p)
Copy-Constructor. |
|
Vector2D(Vector2D p)
Copy-Constructor. |
|
| Method Summary | |
Vector2D |
add(Vector2D q)
Returns result vector. |
java.lang.Object |
clone()
Creates a new Vector2D and initializes it with this. |
Vector2D |
difference(Vector2D q)
Returns result vector of difference of two vectors. |
double |
distance(Vector2D q)
Returns euklidean distance between this vector and q. |
boolean |
equals(java.lang.Object q)
Compares q to this object. |
double |
length()
Returns euklidean length. |
void |
moveRelX(double x)
|
void |
moveRelY(double y)
|
Vector2D |
reversal()
Creates a new vector with reversed orientation. |
Vector2D |
reverse()
Reverses direction and returns the vector. |
double |
scalar(Vector2D q)
Returns scalar product of this vector and q. |
Vector2D |
scale(double s)
Returns scaled vector. |
double |
sqrDistance(Vector2D q)
Returns euklidean distance in square. |
Vector2D |
subtract(Vector2D q)
Returns result vector. |
Vector2D |
sum(Vector2D q)
Returns result vector of addition by two vectors. |
java.lang.String |
toString()
Returns a String object representing this point. |
Vector2D |
translate(double dx,
double dy)
Returns translated vector. |
double |
x()
Returns current X-coodinate. |
double |
xDistance(Vector2D q)
Returns distance between this point and q (parallel to x) Note: If q is null then this method will return
the same value as x()
|
double |
y()
Returns current Y-coodinate. |
double |
yDistance(Vector2D q)
Returns distance between this point and q (parallel to y) Note: If q is null then this method will return
the same value as y()
|
| Methods inherited from class java.lang.Object |
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
public Vector2D()
public Vector2D(double x,
double y)
x - first componenty - second component
public Vector2D(double r,
double phi,
Vector2D p)
null is a valid translation and is treated like (0, 0)
r - radiusphi - anglep - translation to new originpublic Vector2D(Vector2D p)
null then default position will be used.
p - a Vector2D referencepublic Vector2D(Point p)
null then default position will be used.
p - a point| Method Detail |
public double x()
public double y()
public void moveRelX(double x)
public void moveRelY(double y)
public double xDistance(Vector2D q)
null then this method will return
the same value as x()
q - a Vector2D referencepublic double yDistance(Vector2D q)
null then this method will return
the same value as y()
q - a Vector2D referencepublic double length()
public double distance(Vector2D q)
null zero is returned.
q - a Vector2D referencepublic double sqrDistance(Vector2D q)
null zero is returned.
q - a Vector2D referencepublic Vector2D scale(double s)
s.s - scale faktor (any double)this) not a new instance.
public Vector2D translate(double dx,
double dy)
x - offset in x direction (positiv means to right)y - offset in y direction (positiv means up)this) not a new instance.public Vector2D reverse()
this)public Vector2D reversal()
public Vector2D add(Vector2D q)
null (0, 0) is assumed for q.
q - a vector referencethis) not a new instance.public Vector2D sum(Vector2D q)
null (0, 0) is assumed for q.
q - a vector referencepublic Vector2D subtract(Vector2D q)
null (0, 0) is assumed for q.
q - a vector referencethis) not a new instance.public Vector2D difference(Vector2D q)
null (0, 0) is assumed for q.
q - a vector referencepublic double scalar(Vector2D q)
null (0, 0) is assumed for q.
q - a vector referencepublic boolean equals(java.lang.Object q)
q to this object.q - the reference object with which to compare.true if this object is the same as
the obj argument; false otherwise.public java.lang.Object clone()
this.public java.lang.String toString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||