Class Point

java.lang.Object
  |
  +--Point

public class Point
extends java.lang.Object

The Point class represents a 2D point


Field Summary
private static double DEFAULT_X
          default x position of point
private static double DEFAULT_Y
          default y position of point
private  double x
          x position of point
private  double y
          y position of point
 
Constructor Summary
Point()
          construtor to create a Point object with the default position
Point(double xc, double yc)
          constructor to create and initialise a Point object
 
Method Summary
static double distBetween(Point p1, Point p2)
          calculates the distance between two Point objects
 boolean equals(Point p)
          tests whether two Point objects are at the same position
 void moveTo(double xc, double yc)
          moves the Point to a new position
 void moveTo(Point p)
          moves the Point to a new position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

private double x
x position of point


y

private double y
y position of point


DEFAULT_X

private static final double DEFAULT_X
default x position of point

See Also:
Constant Field Values

DEFAULT_Y

private static final double DEFAULT_Y
default y position of point

See Also:
Constant Field Values
Constructor Detail

Point

public Point(double xc,
             double yc)
constructor to create and initialise a Point object

Parameters:
xc - the initial x-axis position
yc - the initial y-axis position

Point

public Point()
construtor to create a Point object with the default position

Method Detail

equals

public boolean equals(Point p)
tests whether two Point objects are at the same position

Parameters:
p - the Point object to be compared to
Returns:
true if the this point equals p

moveTo

public void moveTo(double xc,
                   double yc)
moves the Point to a new position

Parameters:
xc - the new x-axis position
yc - the new y-axis position

moveTo

public void moveTo(Point p)
moves the Point to a new position

Parameters:
p - the position to move to

distBetween

public static double distBetween(Point p1,
                                 Point p2)
calculates the distance between two Point objects

Parameters:
p1 - the first position
p2 - the second position
Returns:
the distance between the two points