vooga.physicsEngine.geometry.shapes
Class Circle

java.lang.Object
  extended by vooga.physicsEngine.geometry.shapes.Circle
All Implemented Interfaces:
Shape

public class Circle
extends java.lang.Object
implements Shape

Shape class that represents a circle.

Author:
Peng Shi, Sami Boghos

Constructor Summary
Circle(double radius)
          Creates a circle
 
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.
 double getRadius()
          Return the radius of the circle
 Vector2f getSmallestCorner()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Circle

public Circle(double radius)
Creates a circle

Parameters:
radius - The radius of the circle
Method Detail

getBoundingBox

public BoundingBox getBoundingBox()
Description copied from interface: Shape
Returns the bounding box of a shape. The bounding box always contains the shape until all rotations.

Specified by:
getBoundingBox in interface Shape
Returns:

getRadius

public double getRadius()
Return the radius of the circle

Returns:
radius of circle

createBufferedImage

public java.awt.image.BufferedImage createBufferedImage(double angularPosition)
Description copied from interface: Shape
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.

Specified by:
createBufferedImage in interface Shape
Returns:

getR2IntegralEstimate

public double getR2IntegralEstimate()
Description copied from interface: Shape
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.

Specified by:
getR2IntegralEstimate in interface Shape
Returns:

getCentroid

public Vector2f getCentroid()
Specified by:
getCentroid in interface Shape
Returns:
the relative Shape coordinate of the centroid

getSmallestCorner

public Vector2f getSmallestCorner()
Specified by:
getSmallestCorner in interface Shape
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.