|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.physicsEngine.geometry.shapes.Polygon
public class Polygon
Represents a general polygon, represented by an ordered set of vertices. The coordinates should be such that that (0,0) is the centroid of the shape.
Constructor Summary | |
---|---|
Polygon(Vector2f[] vertices)
Create new Polygon using list of verticies; note that (0,0) will be the centroid. |
Method Summary | |
---|---|
java.awt.image.BufferedImage |
createBufferedImage(double angularPosition)
Creates a BufferedImage representing the given
Shape . |
BoundingBox |
getBoundingBox()
Returns the bounding box of a shape. |
Vector2f |
getCentroid()
|
int |
getNumVertices()
Return the number of vertices |
double |
getR2IntegralEstimate()
Obtain an estimate of the integral of R^2 over the whole shape, where R is the distance between each point and the centroid. |
Vector2f |
getSmallestCorner()
|
Vector2f |
getVertex(int x)
Return the vector of the vertex at position x |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Polygon(Vector2f[] vertices)
vertices
- List of vectors representing the vertices of the polygonMethod Detail |
---|
public int getNumVertices()
public Vector2f getVertex(int x)
x
- position of vector
public BoundingBox getBoundingBox()
Shape
getBoundingBox
in interface Shape
public java.awt.image.BufferedImage createBufferedImage(double angularPosition)
Shape
BufferedImage
representing the given
Shape
. This image will have the same bounding box as the
given shape. The image will have black outline and white interior. This
is mostly for simple games and internal testing.
createBufferedImage
in interface Shape
public double getR2IntegralEstimate()
Shape
getR2IntegralEstimate
in interface Shape
public Vector2f getCentroid()
getCentroid
in interface Shape
public Vector2f getSmallestCorner()
getSmallestCorner
in interface Shape
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |