|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--y.geom.YVector
This class represents a vector in the 2-dimensional real vector space. This vector is an ordered 2 tupel and is defined by two doubles.
| Constructor Summary | |
YVector(double dx,
double dy)
Creates a new vector with given direction. |
|
YVector(double x1,
double y1,
double x2,
double y2)
Creates a new vector, whose direction is given by two points. |
|
YVector(YPoint p1)
Creates a new vector, whose direction is given by a point. |
|
YVector(YPoint p1,
YPoint p2)
Creates a new vector, whose direction is given by two points. |
|
YVector(YVector v)
Creates a new vector which is a copy of another vector. |
|
| Method Summary | |
static YPoint |
add(YPoint p,
YVector v)
Adds the vector to a point and returns the resulting point. |
void |
add(YVector v)
Adds a vector to this vector. |
static YVector |
add(YVector v,
YVector w)
Adds two vectors and returns the result. |
static double |
angle(YVector v1,
YVector v2)
Returns the angle between two vectors in counter clockwise order from v1 to v2. |
static YVector |
getNormal(YVector v)
Returns this vector with unit length. |
double |
getX()
Returns the first coordinate of the vector. |
double |
getY()
Returns the second coordinate of the vector. |
double |
length()
Returns the length of the vector, this is the value of the eucledian norm. |
void |
norm()
Assigns unit length to the vector. |
static YVector |
orthoNormal(YVector v)
Returns the vector which is orthogonal to the given one and has unit lenght. |
static boolean |
rightOf(YVector v1,
YVector v2)
Returns true if vector v1 is on the right side of v2. |
static double |
scalarProduct(YVector v1,
YVector v2)
Returns the value of the scalar product of two vectors. |
void |
scale(double factor)
Scales the vector by an factor. |
String |
toString()
Returns a string representation of this vector. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public YVector(double dx,
double dy)
dx - the first coordinatedy - the second coordinatepublic YVector(YVector v)
v - the vector, whose values are copied.
public YVector(YPoint p1,
YPoint p2)
p1 - p2.
p1 - the first point.p2 - the second point.public YVector(YPoint p1)
p1 - (0,0).
p1 - the point.
public YVector(double x1,
double y1,
double x2,
double y2)
(x1 - x2, y1 - y2).
x1 - the X-coordinate of the first point.y1 - the Y-coordinate of the first point.x2 - the X-coordinate of the second point.y2 - the Y-coordinate of the second point.| Method Detail |
public double getX()
public double getY()
public void norm()
public void add(YVector v)
v - the vector to add.
public static YVector add(YVector v,
YVector w)
v - first vector to sum.w - second vector to summ.
public static YPoint add(YPoint p,
YVector v)
p - a point.v - the vector to add to the point.
public void scale(double factor)
factor - the scale factor, with which the lenght is multiplied.public double length()
public static boolean rightOf(YVector v1,
YVector v2)
public static YVector getNormal(YVector v)
public static YVector orthoNormal(YVector v)
v - a vector.
public static double scalarProduct(YVector v1,
YVector v2)
v1 - the first vector.v2 - the second vector.
v1.x * v2.x + v1.y * v2.y
public static double angle(YVector v1,
YVector v2)
public String toString()
toString in class Object
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||