appletbots.geometry
Class Point

java.lang.Object
  extended by appletbots.geometry.Point

public class Point
extends java.lang.Object

This class represents a point in two-dimensional space

Author:
Erik Rasmussen

Field Summary
 double x
          The x-coordinate
 double y
          The y-coordinate
 
Constructor Summary
Point(double x, double y)
          Creates a new point with the given coordinates
 
Method Summary
 Point add(Vector vector)
          Returns the result of adding a vector to this point
 java.lang.Object clone()
          Returns a copy of this point
 double distance(Point point)
          Returns the distance between this point and another point
 boolean equals(java.lang.Object obj)
          Returns whether or not this point equals another point
 java.lang.String toString()
          Returns a string representation of this point
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x
The x-coordinate


y

public double y
The y-coordinate

Constructor Detail

Point

public Point(double x,
             double y)
Creates a new point with the given coordinates

Parameters:
x - The x-coordinate
y - The y-coordinate
Method Detail

distance

public double distance(Point point)
Returns the distance between this point and another point

Parameters:
point - Another point
Returns:
The distance between this point and another point

add

public Point add(Vector vector)
Returns the result of adding a vector to this point

Parameters:
vector - The vector to add
Returns:
The result of adding a vector to this point

equals

public boolean equals(java.lang.Object obj)
Returns whether or not this point equals another point

Overrides:
equals in class java.lang.Object
Parameters:
obj - Another point
Returns:
Whether or not this point equals another point

clone

public java.lang.Object clone()
Returns a copy of this point

Overrides:
clone in class java.lang.Object
Returns:
A copy of this point

toString

public java.lang.String toString()
Returns a string representation of this point

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this point