computational.geometry
Class ConvexPolygon

java.lang.Object
  extended by computational.geometry.Polygon
      extended by computational.geometry.SimplePolygon
          extended by computational.geometry.ConvexPolygon
All Implemented Interfaces:
Shape, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
Rectangle, Triangle

public class ConvexPolygon
extends SimplePolygon

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class computational.geometry.Polygon
Polygon.Edge, Polygon.Vertex
 
Field Summary
 
Fields inherited from class computational.geometry.Polygon
vertices
 
Constructor Summary
ConvexPolygon()
          CONSTRUCTORS
ConvexPolygon(java.util.List vertices)
           
ConvexPolygon(Polygon p)
           
ConvexPolygon(java.lang.String label)
           
ConvexPolygon(java.lang.String label, java.util.List points)
           
 
Method Summary
 boolean addVertex(Point p)
          SET METHODS
 boolean addVertex(Point p, Segment s)
           
 boolean contains(Point p)
          POINT IN POLYGON TEST
 boolean deleteVertex(java.lang.Integer index)
           
 boolean deleteVertex(Point p)
           
 boolean moveVertex(java.lang.Integer index, int dx, int dy)
           
 boolean moveVertex(Point p, int dx, int dy)
           
 
Methods inherited from class computational.geometry.SimplePolygon
diagonal, diagonal, ear
 
Methods inherited from class computational.geometry.Polygon
area, boundingBox, clear, clone, draw, drawLabels, drawPoints, equals, getBottomVertex, getEdge, getEdges, getFirstVertex, getIndices, getLabel, getLeftVertex, getNext, getPoints, getPrevious, getRightVertex, getTopVertex, getVertex, getVertices, indexOf, isClockwiseOriented, isConvex, isSimple, perimeter, restore, setLabel, size, toString, translate, updateExtremeVertices
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConvexPolygon

public ConvexPolygon()
CONSTRUCTORS


ConvexPolygon

public ConvexPolygon(java.util.List vertices)
              throws ConvexityViolatedException,
                     SimplicityViolatedException
Throws:
ConvexityViolatedException
SimplicityViolatedException

ConvexPolygon

public ConvexPolygon(Polygon p)
              throws ConvexityViolatedException,
                     SimplicityViolatedException
Throws:
ConvexityViolatedException
SimplicityViolatedException

ConvexPolygon

public ConvexPolygon(java.lang.String label)

ConvexPolygon

public ConvexPolygon(java.lang.String label,
                     java.util.List points)
              throws ConvexityViolatedException,
                     SimplicityViolatedException
Throws:
ConvexityViolatedException
SimplicityViolatedException
Method Detail

addVertex

public boolean addVertex(Point p)
                  throws SimplicityViolatedException,
                         ConvexityViolatedException
SET METHODS

Overrides:
addVertex in class SimplePolygon
Throws:
SimplicityViolatedException
ConvexityViolatedException

addVertex

public boolean addVertex(Point p,
                         Segment s)
                  throws SimplicityViolatedException,
                         ConvexityViolatedException
Overrides:
addVertex in class SimplePolygon
Throws:
SimplicityViolatedException
ConvexityViolatedException

contains

public boolean contains(Point p)
POINT IN POLYGON TEST

Specified by:
contains in interface Shape
Overrides:
contains in class SimplePolygon
Parameters:
p - the point we test for encloseness.
Returns:
true iff the point is enclosed in the shape.

deleteVertex

public boolean deleteVertex(java.lang.Integer index)
                     throws SimplicityViolatedException,
                            ConvexityViolatedException
Overrides:
deleteVertex in class SimplePolygon
Throws:
SimplicityViolatedException
ConvexityViolatedException

deleteVertex

public boolean deleteVertex(Point p)
                     throws SimplicityViolatedException,
                            ConvexityViolatedException
Overrides:
deleteVertex in class SimplePolygon
Throws:
SimplicityViolatedException
ConvexityViolatedException

moveVertex

public boolean moveVertex(java.lang.Integer index,
                          int dx,
                          int dy)
                   throws SimplicityViolatedException,
                          ConvexityViolatedException
Overrides:
moveVertex in class SimplePolygon
Throws:
SimplicityViolatedException
ConvexityViolatedException

moveVertex

public boolean moveVertex(Point p,
                          int dx,
                          int dy)
                   throws SimplicityViolatedException,
                          ConvexityViolatedException
Overrides:
moveVertex in class SimplePolygon
Throws:
SimplicityViolatedException
ConvexityViolatedException