computational.geometry
Class SimplePolygon
java.lang.Object
computational.geometry.Polygon
computational.geometry.SimplePolygon
- All Implemented Interfaces:
- Shape, java.io.Serializable, java.lang.Cloneable
- Direct Known Subclasses:
- ConvexPolygon
public class SimplePolygon
- extends Polygon
- See Also:
- Serialized Form
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 |
SimplePolygon
public SimplePolygon()
- CONSTRUCTORS
SimplePolygon
public SimplePolygon(java.util.List vertices)
throws SimplicityViolatedException
- Throws:
SimplicityViolatedException
SimplePolygon
public SimplePolygon(Polygon p)
throws SimplicityViolatedException
- Throws:
SimplicityViolatedException
SimplePolygon
public SimplePolygon(java.lang.String label)
SimplePolygon
public SimplePolygon(java.lang.String label,
java.util.List points)
throws SimplicityViolatedException
- Throws:
SimplicityViolatedException
addVertex
public boolean addVertex(Point p)
throws SimplicityViolatedException,
ConvexityViolatedException
- SET METHODS
- Overrides:
addVertex
in class Polygon
- Throws:
SimplicityViolatedException
ConvexityViolatedException
addVertex
public boolean addVertex(Point p,
Segment s)
throws SimplicityViolatedException,
ConvexityViolatedException
- Overrides:
addVertex
in class Polygon
- Throws:
SimplicityViolatedException
ConvexityViolatedException
contains
public boolean contains(Point p)
- POINT IN POLYGON TEST
- Specified by:
contains
in interface Shape
- Overrides:
contains
in class Polygon
- 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 Polygon
- Throws:
SimplicityViolatedException
ConvexityViolatedException
deleteVertex
public boolean deleteVertex(Point p)
throws SimplicityViolatedException,
ConvexityViolatedException
- Overrides:
deleteVertex
in class Polygon
- Throws:
SimplicityViolatedException
ConvexityViolatedException
diagonal
public boolean diagonal(int i0,
int i1)
- Parameters:
i0
- the segment's first index.i1
- the segment's second index.
- Returns:
- true iff the segment (i0,i1) is a proper internal
diagonal of the polygon.
diagonal
public boolean diagonal(Polygon.Vertex v0,
Polygon.Vertex v1)
ear
public boolean ear(Polygon.Vertex clip)
moveVertex
public boolean moveVertex(java.lang.Integer index,
int dx,
int dy)
throws SimplicityViolatedException,
ConvexityViolatedException
- Overrides:
moveVertex
in class Polygon
- Throws:
SimplicityViolatedException
ConvexityViolatedException
moveVertex
public boolean moveVertex(Point p,
int dx,
int dy)
throws SimplicityViolatedException,
ConvexityViolatedException
- Overrides:
moveVertex
in class Polygon
- Throws:
SimplicityViolatedException
ConvexityViolatedException