algo
Class Point
java.lang.Object
algo.Point
- All Implemented Interfaces:
- java.io.Serializable
public class Point
- extends java.lang.Object
- implements java.io.Serializable
A Point in a 2d Graph.
Defined by an x- and y-coordinate and given a number.
- Author:
- Heinz Kredel.
- See Also:
- Serialized Form
|
Field Summary |
int |
n
|
double |
x
|
double |
y
|
|
Constructor Summary |
Point(int n,
double x,
double y)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
n
public final int n
x
public final double x
y
public final double y
Point
public Point(int n,
double x,
double y)
- Parameters:
n - the number of the pointx - coordinate.y - coordinate.
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
random
public static Point random(int n,
java.util.Random r,
double m)
- Parameters:
n - the number of the pointr - a random number generator.m - maximal coordinate range.
- Returns:
- point with random x- and y-coordinates less than m.
scaleTo
public static Point scaleTo(Point p,
double scale)
- Parameters:
p - a Point to be scaled.scale - a scale factor.
- Returns:
- a point with x- and y-coordinates multiplied by scale.