|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Point
Point data structure
Field Summary | |
double |
cost
a double representing the cost of the this point |
Point |
ptr
Pointer to anothor point |
Constructor Summary | |
Point(double x,
double y)
Constructs a new Point with the specified doubles as the x and
y coordinates. |
Method Summary | |
static double |
distance(Point a,
Point b)
Computes the distance between two points |
void |
drawCircle(Graphics page,
Color c,
Rectangle rect,
double size)
Draws a circle at this Point. |
static void |
drawDottedLine(Graphics page,
Color c,
Rectangle rect,
Point start,
Point end,
int n,
int total)
Draws a dotted line between the two specified points. |
static void |
drawPath(Point p,
Point q,
Graphics2D page,
Color c,
Rectangle rect)
Draws a line between two points |
static void |
drawVertex(Point p,
Graphics page,
Color c,
int size,
Rectangle rect)
Draws a point |
static Point |
midPoint(Point a,
Point b)
Gets the midpoint between two points. |
static double |
ScaleDistance(Point a,
Point b,
int width,
int height)
Scales the distance between two points according to the specified width and height. |
static void |
SetMaxes(double mx,
double my)
Sets the maximum y and x coordinates for all the points. |
String |
toString()
Creates a string representation of a Point along with it's cost |
Methods inherited from class java.lang.Object |
|
Field Detail |
public double cost
public Point ptr
Constructor Detail |
public Point(double x, double y)
x
and
y
coordinates. The cost
field is initialized to
the max value for a double. The ptr
field is null
.x
- the x-coordinate of the Pointy
- the y-coordinate of the PointMethod Detail |
public String toString()
toString
in class Object
public static void SetMaxes(double mx, double my)
1.0
.mx
- maximum x-coordinatemy
- maximum y_coordinateScaleDistance(Point, Point, int, int)
public static void drawPath(Point p, Point q, Graphics2D page, Color c, Rectangle rect)
p
- first pointq
- second pointpage
- used to paint on the componentc
- color of the pathrect
- a Rectangle that specifies the area that the component spansdrawVertex(Point, java.awt.Graphics, java.awt.Color, int, java.awt.Rectangle)
public static void drawDottedLine(Graphics page, Color c, Rectangle rect, Point start, Point end, int n, int total)
page
- used to paint on the componentc
- color of the circlerect
- a Rectangle that specifies the area that the component spansstart
- point that the dotted line starts atend
- point that the dotted line starts atn
- how many of the dotted lines to draw out of the total
total
- total number of dotted lines between the two pointsdrawCircle(java.awt.Graphics, java.awt.Color, java.awt.Rectangle, double)
public static void drawVertex(Point p, Graphics page, Color c, int size, Rectangle rect)
p
- point to be drawnpage
- used to paint on the componentc
- color of the pointsize
- the size of the pointrect
- a Rectangle that specifies the area that the component spansdrawPath(Point, Point, java.awt.Graphics2D, java.awt.Color, java.awt.Rectangle)
public static double ScaleDistance(Point a, Point b, int width, int height)
a
- first pointb
- second pointwidth
- the width to be scaled byheight
- the height to be scaled bydistance(Point, Point)
,
Visualization.drawCircle(java.awt.Graphics, java.awt.Color, java.awt.Rectangle, Point, double)
public void drawCircle(Graphics page, Color c, Rectangle rect, double size)
page
- used to paint on the componentc
- color of the circlerect
- a Rectangle that specifies the area that the component spanssize
- the diameter of the circledrawDottedLine(java.awt.Graphics, java.awt.Color, java.awt.Rectangle, Point, Point, int, int)
public static double distance(Point a, Point b)
a
- first pointb
- second pointScaleDistance(Point, Point, int, int)
public static Point midPoint(Point a, Point b)
a
- first pointb
- second point
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |