EDU.cmu.cs.coral.util
Class Polygon2
java.lang.Object
|
+--EDU.cmu.cs.coral.util.Polygon2
- public class Polygon2
- extends java.lang.Object
- implements java.lang.Cloneable, java.io.Serializable
A class for manipulating Polygon2s.
Copyright
(c)1998 Tucker Balch and Carnegie Mellon University
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
vertices
public java.util.Vector vertices
Polygon2
public Polygon2()
Polygon2
public Polygon2(java.util.Vector vec)
Polygon2
public Polygon2(Vec2 vertex)
Polygon2
public Polygon2(Polygon2 p)
clone
public java.lang.Object clone()
- Create a new Polygon2 by cloning.
- Overrides:
- clone in class java.lang.Object
- Parameters:
p
- Polygon2, the Polygon2 to copy.
addVertex
public void addVertex(Vec2 vertex)
- add a vertex to the Polygon2.
- Parameters:
vertex
- the new vertex.
returnVertex
public Vec2 returnVertex(int vertexNumber)
- return the ith vertex of the Polygon2.
- Parameters:
vertexNumber
- the ith vertex.
offsetVertices
public void offsetVertices(Vec2 offset)
- translate the Polygon2 to a new origin
- Parameters:
offset,
- the new origin of the translated Polygon2
pointWithinPolygon
public boolean pointWithinPolygon(Vec2 point)
lineIntersectsWithPolygon
public boolean lineIntersectsWithPolygon(Vec2 vertex1,
Vec2 vertex2)