edu.princeton.repeatedgames.rgsolve.polygon
Class PolygonMethods
java.lang.Object
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ZERO_AREA
public static double ZERO_AREA
- Area below which a set is considered degenerate
PolygonMethods
private PolygonMethods()
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 polygonsW2
- 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 1polygon2
- polygon 2useSupDistance
- switch on using sup-distance or Euclidean-distance
- Returns:
- the distance between these polygons