All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class fi.helsinki.cs.MapDrawer.RelPoint

java.lang.Object
   |
   +----fi.helsinki.cs.MapDrawer.RelPoint

public class RelPoint
extends Object
implements Serializable
MapDrawer's relative point class - This class is needed because MapDrawer doesn't use integer coordinates. For MapDrawer, the coordinates should be in the range ( [-1, 1], [-1, 1] ), but the class can be used more generally, too.


Variable Index

 o x
The x coordinate of the point.
 o y
The y coordinate of the point.

Constructor Index

 o RelPoint()
Sets both coordinates to zero.
 o RelPoint(double, double)
 o RelPoint(RelPoint)

Method Index

 o bound(RelRect)
Checks if the point is within a specified rectangle.
 o equals(RelPoint)
 o in(RelRect)
Checks whether this RelPoint is within the given RelRect.
 o toPoint(Rectangle)
Translate this RelPoint to Point.
 o toString()
 o xScale(double)
Scales the point so that its polar coord.
 o yScale(double)
Scales the point so that its polar coord.

Variables

 o x
 public double x
The x coordinate of the point.

 o y
 public double y
The y coordinate of the point.

Constructors

 o RelPoint
 public RelPoint()
Sets both coordinates to zero.

 o RelPoint
 public RelPoint(RelPoint src)
 o RelPoint
 public RelPoint(double ix,
                 double iy)

Methods

 o in
 public boolean in(RelRect b)
Checks whether this RelPoint is within the given RelRect.

 o equals
 public boolean equals(RelPoint cmp)
 o toString
 public String toString()
Overrides:
toString in class Object
 o xScale
 public void xScale(double nx)
Scales the point so that its polar coord. angle remains the same.

Parameters:
nx - the new x coordinate.
 o yScale
 public void yScale(double ny)
Scales the point so that its polar coord. angle remains the same.

Parameters:
ny - the new y coordinate.
 o bound
 public void bound(RelRect b)
Checks if the point is within a specified rectangle. If not, the point is scaled appropriately.

Parameters:
b - The bounding rectangle. NB: the results of this method are unreliable if b doesn't include the origo.
 o toPoint
 public Point toPoint(Rectangle scale)
Translate this RelPoint to Point.

Parameters:
scale - the rectangle the coord. plane of which this RelPoint is translated to.

All Packages  Class Hierarchy  This Package  Previous  Next  Index