vooga.physicsEngine.geometry.shapes
Interface Shape

All Known Implementing Classes:
Circle, JavaShape, Polygon

public interface Shape

Interface representing a geometric shape. Note that the shape only stores the outline of a geometric object, but not its position or angular position.

Author:
Peng Shi

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()
           
 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()
           
 

Method Detail

getBoundingBox

BoundingBox getBoundingBox()
Returns the bounding box of a shape. The bounding box always contains the shape until all rotations.

Returns:

createBufferedImage

java.awt.image.BufferedImage createBufferedImage(double angularPosition)
Creates a 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.

Returns:

getR2IntegralEstimate

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. This is used to compute a reasonable estimate for the moment of inertia.

Returns:

getCentroid

Vector2f getCentroid()
Returns:
the relative Shape coordinate of the centroid

getSmallestCorner

Vector2f getSmallestCorner()
Returns:
the relative Shape coordinate of the top left corner of the tightest bounding box (this is needed for translating the game position coordinate--based on the smallest corner--to the physics engine coordinate--based on the centroid.