|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--auc.geom.Vector2D
The Vector2D class for the two-dimensional vector algebra. This class provides vectorial operations for the 2-dimensional vectors: addition, subtraction and multiplication by scalar value.
| Field Summary | |
static double |
precision
The precision of vector operations. |
double |
x
The x-coordinate of the vector. |
double |
y
The y-coordinate of the vector. |
| Constructor Summary | |
Vector2D()
Constructs a zero value Vector2D(0,0). |
|
Vector2D(double x,
double y)
Constructs the Vector2D with the given value. |
|
Vector2D(Vector2D p)
Constructs an exact copy of the given Vector2D. |
|
| Method Summary | |
double |
abs()
Calculates the Euclidian length of this vector. |
Vector2D |
add(double x,
double y)
Calculates the sum vector of this and given coordinates: this.x := this.x + x, this.y := this.y + y. |
Vector2D |
add(Vector2D p)
Calculates the sum vector of this and given coordinates: this := this + p. |
double |
angle(Vector2D p)
Calculates the angle between this and given vector in radians. |
double |
angle3(Vector2D b,
Vector2D c)
Calculates the angle between two edges, the vertex of the angle is this vector. |
double |
angleX()
Calculates the angle between this vector and the x-axis. |
double |
distance(Vector2D p)
Calculates the Euclidian distance between this and given vector points. |
boolean |
equals(java.lang.Object obj)
Compares this vector with given object. |
Vector2D |
multiply(double c)
Multiplies this vector by scalar value. |
Vector2D |
normalize()
Calculates the normal of this vector. |
Vector2D |
rotate(double angle)
Rotates this vector around 0,0 point by given angle. |
Vector2D |
set(double x,
double y)
Coordinates set operation. |
Vector2D |
set(Vector2D p)
Coordinates set operation. |
Vector2D |
subtract(double x,
double y)
Calculates the difference vector of this and given coordinates: this.x := this.x - x, this.y := this.y - y. |
Vector2D |
subtract(Vector2D p)
Calculates the difference vector of this and given vector: this := this - p. |
java.lang.String |
toString()
The standart method for String concatination operation overriding. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public double x
public double y
public static double precision
| Constructor Detail |
public Vector2D(double x,
double y)
x - the x-coordinate for the vector.y - the y-coordinate for the vector.x,
ypublic Vector2D(Vector2D p)
p - the original vector.public Vector2D()
Vector2D(double, double)| Method Detail |
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object to compare with.precision,
distance(Vector2D)public double distance(Vector2D p)
p - the vector that points to another point in 2D space.public double abs()
public Vector2D set(double x,
double y)
x - the new x-coordinate for this vector.y - the new y-coordinate for this vector.set(Vector2D)public Vector2D set(Vector2D p)
p - the new x and y coordinates for this vector encapsulated in a Vector2D object.set(double, double)
public Vector2D add(double x,
double y)
x - the x-coordinate to be added.y - the y-coordinate to be added.add(Vector2D)public Vector2D add(Vector2D p)
p - the vector to be added.add(double, double)
public Vector2D subtract(double x,
double y)
x - the x-coordinate to be subtracted.y - the y-coordinate to be subtracted.subtract(Vector2D)public Vector2D subtract(Vector2D p)
p - the vector to be subtracted.subtract(double, double)public Vector2D normalize()
public Vector2D multiply(double c)
c - the scalar double value.public Vector2D rotate(double angle)
angle - the angle double value in radians.public double angleX()
angle(Vector2D)public double angle(Vector2D p)
p - the given vector.angleX()
public double angle3(Vector2D b,
Vector2D c)
b - is the first edge of the angle.c - is the second edge of the angle.public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||