PinBallDomain
Class Point

java.lang.Object
  extended by PinBallDomain.Point

public class Point
extends java.lang.Object

A 2D point

Author:
George Konidaris (gdk at cs dot umass dot edu)

Constructor Summary
Point(double xx, double yy)
          Construct a point.
 
Method Summary
 Point add(Point b)
          Compute a new point that is this point plus another.
 Point addTo(Point b)
          Add another point to this one.
 double angleBetween(Point p)
          Compute the angle between this point and another.
 double distanceTo(Point t)
          Get the distance from this point to another.
 double dot(Point b)
          Compute the dot product of this and a given point.
 double getX()
          Get the point's X coordinate.
 double getY()
          Get the point's Y coordinate.
 Point minus(Point b)
          Compute a new point that is the difference between this point and another.
 Point normalize()
          Compute a normalized version of this point.
 double size()
          Return the length of the vector corresponding to this point.
 Point times(double d)
          Compute a new point that is a constant multiple of this point.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Point

public Point(double xx,
             double yy)
Construct a point.

Parameters:
xx - X coordinate
yy - Y coordinate
Method Detail

getX

public double getX()
Get the point's X coordinate.

Returns:
X coordinate

getY

public double getY()
Get the point's Y coordinate.

Returns:
Y coordinate

distanceTo

public double distanceTo(Point t)
Get the distance from this point to another.

Parameters:
t - other point
Returns:
distance from this point to t

minus

public Point minus(Point b)
Compute a new point that is the difference between this point and another.

Parameters:
b - the point to subtract
Returns:
the new point

dot

public double dot(Point b)
Compute the dot product of this and a given point.

Parameters:
b - the other point
Returns:
the dot product between this point and b

times

public Point times(double d)
Compute a new point that is a constant multiple of this point.

Parameters:
d - multiple
Returns:
the new point

add

public Point add(Point b)
Compute a new point that is this point plus another.

Parameters:
b - the other point
Returns:
the new point

addTo

public Point addTo(Point b)
Add another point to this one.

Parameters:
b - the other point
Returns:
this point (after addition)

size

public double size()
Return the length of the vector corresponding to this point.

Returns:
the size of this point

normalize

public Point normalize()
Compute a normalized version of this point.

Returns:
the normalized point

angleBetween

public double angleBetween(Point p)
Compute the angle between this point and another.

Parameters:
p - the other point
Returns:
the angle between this point and p