edu.princeton.repeatedgames.rgsolve.polygon
Class PolygonMethods

java.lang.Object
  extended by edu.princeton.repeatedgames.rgsolve.polygon.PolygonMethods

public class PolygonMethods
extends java.lang.Object

This class contains methods for polygons, which are interpreted as arrays of Point that are sorted counter-clockwise


Field Summary
static double ZERO_AREA
          Area below which a set is considered degenerate
 
Constructor Summary
private PolygonMethods()
           
 
Method Summary
static
<T extends Point>
double
getArea(T[] pts)
          Returns the area represented by the polygon pts
static
<T extends Point>
double
getListArea(java.util.ArrayList<T> pts)
           
static double getPolygonVertexDistance(Point[] polygon1, Point[] polygon2, boolean useSupDistance)
          gets distance between sorted convex polygons in terms of corresponding vertices.
static double[] getRelativeAreaDifferences(Point[][] W1, Point[][] W2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO_AREA

public static double ZERO_AREA
Area below which a set is considered degenerate

Constructor Detail

PolygonMethods

private PolygonMethods()
Method Detail

getArea

public static <T extends Point> double getArea(T[] pts)
Returns the area represented by the polygon pts

Parameters:
pts - polygon
Returns:
area of polygon

getListArea

public static <T extends Point> double getListArea(java.util.ArrayList<T> pts)

getRelativeAreaDifferences

public static double[] getRelativeAreaDifferences(Point[][] W1,
                                                  Point[][] W2)
Parameters:
W1 - A list of polygons
W2 - A list of polygons
Returns:
An array areas[], with areas[i] equaling the relative difference in areas between W1[i] and W2[i]

getPolygonVertexDistance

public static double getPolygonVertexDistance(Point[] polygon1,
                                              Point[] polygon2,
                                              boolean useSupDistance)
gets distance between sorted convex polygons in terms of corresponding vertices. If the number of vertices differs, distance is infinity; Otherwise sup-metric between corresponding points

Parameters:
polygon1 - polygon 1
polygon2 - polygon 2
useSupDistance - switch on using sup-distance or Euclidean-distance
Returns:
the distance between these polygons