cmsc420.geom
Class Shape2DDistanceCalculator

java.lang.Object
  extended by cmsc420.geom.Shape2DDistanceCalculator

public class Shape2DDistanceCalculator
extends java.lang.Object

The Shape2DDistanceCalculator class provides methods for finding the distance between shapes on a two-dimensional plane.

Author:
Ben Zoller

Constructor Summary
Shape2DDistanceCalculator()
           
 
Method Summary
static double distance(java.awt.geom.Line2D seg, java.awt.geom.Rectangle2D rect)
          Gets the distance from a line segment to a rectangle
static double distance(java.awt.geom.Point2D pt, java.awt.geom.Rectangle2D rect)
          Gets the distance from a point to a rectangle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shape2DDistanceCalculator

public Shape2DDistanceCalculator()
Method Detail

distance

public static double distance(java.awt.geom.Point2D pt,
                              java.awt.geom.Rectangle2D rect)
Gets the distance from a point to a rectangle.

Parameters:
pt - point
rect - rectangle
Returns:
distance between the point and the rectangle

distance

public static double distance(java.awt.geom.Line2D seg,
                              java.awt.geom.Rectangle2D rect)
Gets the distance from a line segment to a rectangle

Parameters:
seg - Line segment
rect - Rectangle
Returns:
The distance