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.
-
x
- The x coordinate of the point.
-
y
- The y coordinate of the point.
-
RelPoint()
- Sets both coordinates to zero.
-
RelPoint(double, double)
-
-
RelPoint(RelPoint)
-
-
bound(RelRect)
- Checks if the point is within a specified rectangle.
-
equals(RelPoint)
-
-
in(RelRect)
- Checks whether this RelPoint is within the given RelRect.
-
toPoint(Rectangle)
- Translate this RelPoint to Point.
-
toString()
-
-
xScale(double)
-
Scales the point so that its polar coord.
-
yScale(double)
-
Scales the point so that its polar coord.
x
public double x
- The x coordinate of the point.
y
public double y
- The y coordinate of the point.
RelPoint
public RelPoint()
- Sets both coordinates to zero.
RelPoint
public RelPoint(RelPoint src)
RelPoint
public RelPoint(double ix,
double iy)
in
public boolean in(RelRect b)
- Checks whether this RelPoint is within the given RelRect.
equals
public boolean equals(RelPoint cmp)
toString
public String toString()
- Overrides:
- toString in class Object
xScale
public void xScale(double nx)
- Scales the point so that its polar coord. angle remains the same.
- Parameters:
- nx - the new x coordinate.
yScale
public void yScale(double ny)
- Scales the point so that its polar coord. angle remains the same.
- Parameters:
- ny - the new y coordinate.
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.
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