|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlt.monarch.math.geom.Vector2D
public class Vector2D extends java.lang.Object
Mathematical vector object
| Modifier and Type | Field and Description |
|---|---|
double |
x1
|
double |
x2
|
double |
y1
|
double |
y2
|
| Constructor and Description |
|---|
Vector2D(double x,
double y)
Vector constructor with only end coordinates. |
Vector2D(double x1,
double y1,
double x2,
double y2)
Vector constructor |
| Modifier and Type | Method and Description |
|---|---|
double |
angleWithVector(Vector2D vector)
Calculates the angle with the other vector |
boolean |
equals(java.lang.Object obj)
Checks if the two vectors are equal |
Point2D |
getMidPoint()
Gets vector middle point |
static Point2D |
getPerpendicular(Point2D vector)
Calculates a perpendicular vector to one provided. |
double |
getX1()
Gets 1st x coordinate |
double |
getX2()
Gets 2nd x coordinate |
double |
getY1()
Gets first y coordinate |
double |
getY2()
Gets 2nd y coordinate |
double |
length()
Calculates the length of the vector |
static double |
side(Point2D lp1,
Point2D lp2,
Point2D p)
Determines whether the specified point is above or under some line denoted by two points. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public double x1
public double x2
public double y1
public double y2
| Constructor Detail |
|---|
public Vector2D(double x1,
double y1,
double x2,
double y2)
x1 - vector start x coordinatey1 - vector start y coordinatex2 - vector end x coordinatey2 - vector end y coordinate
public Vector2D(double x,
double y)
x - vector end x coordinatey - vector end y coordinate| Method Detail |
|---|
public double length()
public double angleWithVector(Vector2D vector)
vector - Vectorpublic Point2D getMidPoint()
public double getY1()
public double getY2()
public double getX1()
public double getX2()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - object that has to be comparedpublic static Point2D getPerpendicular(Point2D vector)
vector - - a vector
public static double side(Point2D lp1,
Point2D lp2,
Point2D p)
lp1 - - the first reference point of linelp2 - - the second reference point of linep - - the point to test
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||