vooga.physicsEngine.geometry.shapes
Class ShapeUtilities

java.lang.Object
  extended by vooga.physicsEngine.geometry.shapes.ShapeUtilities

public class ShapeUtilities
extends java.lang.Object

Author:
Peng Shi

Constructor Summary
ShapeUtilities()
           
 
Method Summary
static java.util.List<Vector2f> getBoundaryPoints(java.awt.Shape shape)
          Obtain the boundary points of a given java.awt.Shape object.
static java.util.List<Vector2f> getBoundaryPoints(java.awt.Shape shape, double flatness)
          Given an Area object (probably as the result of an intersection), obtain the extremal points on the boundary.
static java.awt.geom.Area getIntersectingArea(java.awt.geom.Area areaA, java.awt.geom.Area areaB)
          Obtain the Area object corresponding to the intersection of areaA and areaB.
static java.awt.geom.Area getTransformedArea(java.awt.geom.Area area, double x, double y, double angularPosition)
          Apply the given translation and rotation to the given area.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeUtilities

public ShapeUtilities()
Method Detail

getBoundaryPoints

public static java.util.List<Vector2f> getBoundaryPoints(java.awt.Shape shape,
                                                         double flatness)
Given an Area object (probably as the result of an intersection), obtain the extremal points on the boundary. This is used to calculate normal directions for collisions.

Parameters:
shape - a given Java.awt.Area object.
Returns:

getBoundaryPoints

public static java.util.List<Vector2f> getBoundaryPoints(java.awt.Shape shape)
Obtain the boundary points of a given java.awt.Shape object. Using a very high flatness to reduce number of points.

Parameters:
shape -
Returns:

getTransformedArea

public static java.awt.geom.Area getTransformedArea(java.awt.geom.Area area,
                                                    double x,
                                                    double y,
                                                    double angularPosition)
Apply the given translation and rotation to the given area.

Parameters:
x - x-coodinate of translation
y - y-coodinate of translation
angularPosition - magnitude of rotation
Returns:

getIntersectingArea

public static java.awt.geom.Area getIntersectingArea(java.awt.geom.Area areaA,
                                                     java.awt.geom.Area areaB)
Obtain the Area object corresponding to the intersection of areaA and areaB.

Parameters:
areaA -
areaB -
Returns:
the intersection