ProGAL.geom2d
Class ConvexPolygon

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<Point>
              extended by ProGAL.geom2d.Polygon
                  extended by ProGAL.geom2d.ConvexPolygon
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Point>, java.util.Collection<Point>, java.util.List<Point>, java.util.RandomAccess, Shape

public class ConvexPolygon
extends Polygon

See Also:
Serialized Form

Nested Class Summary
static class ConvexPolygon.ConvexHullAlgorithm
           
 
Constructor Summary
ConvexPolygon()
           
ConvexPolygon(Point p0, Point p1, Point p2)
          creates a convex polygon with given three points as corners (counterclockwise)
ConvexPolygon(PointSet points, ConvexPolygon.ConvexHullAlgorithm algorithm)
          creates a convex hull of a set of points Jarvis March O(hn) Grahams Scan O(nlogn)
ConvexPolygon(Polygon pol)
          creates a convex hull of a simple polygon in O(n) time
 
Method Summary
 double[][] beamDetector()
           
 boolean contains(Point p)
          returns true if point p is inside the convex polygon
 int farthestVertex(int p, int r)
           
 LineSegment getDiameter()
          returns the segment between most distant pair of points.
static void main(java.lang.String[] args)
           
 
Methods inherited from class ProGAL.geom2d.Polygon
deleteLast, draw, draw, getCenter, getConvexPolygon, getCorner, insertAfter, isConvex, leftExtremePointIndx, rightExtremePointIndx, setCorner, shift
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

ConvexPolygon

public ConvexPolygon()

ConvexPolygon

public ConvexPolygon(Polygon pol)
creates a convex hull of a simple polygon in O(n) time


ConvexPolygon

public ConvexPolygon(Point p0,
                     Point p1,
                     Point p2)
creates a convex polygon with given three points as corners (counterclockwise)


ConvexPolygon

public ConvexPolygon(PointSet points,
                     ConvexPolygon.ConvexHullAlgorithm algorithm)
creates a convex hull of a set of points Jarvis March O(hn) Grahams Scan O(nlogn)

Method Detail

contains

public boolean contains(Point p)
returns true if point p is inside the convex polygon


getDiameter

public LineSegment getDiameter()
returns the segment between most distant pair of points.


beamDetector

public double[][] beamDetector()

farthestVertex

public int farthestVertex(int p,
                          int r)

main

public static void main(java.lang.String[] args)