gizmoball.shape
Interface Shape

All Known Implementing Classes:
Circle09, FlipperShape, Polygon, UnionShape

public interface Shape

This interface represents the properties that a shape should have in order for it to be moved around and to figure out if and when another object is going to bump into it. The data types used in this interface are based on the Geometry class, for example Vect, Angle, LineSegment, and Circle.

Author:
Eitan Reich

Method Summary
 boolean containsPoint(Vect pt)
           
 java.util.List<Circle> getCircles()
          This method should return a list of Circle objects used to compose this shape.
 java.util.List<LineSegment> getLineSegments()
          This method should return a list of LineSegment objects used to compose this shape.
 Vect maxXY()
           
 Vect minXY()
           
 Shape rotate(Angle theta, Vect centerOfRotation)
          This method rotates a shape around an arbitrary point and returns the new shape
 Shape translate(Vect v)
          This method translates a shape by an arbitrary vector and returns the new shape
 

Method Detail

containsPoint

boolean containsPoint(Vect pt)

getCircles

java.util.List<Circle> getCircles()
This method should return a list of Circle objects used to compose this shape. These circles should also include circles of radius zero for the vertices of a shape.

Returns:
List list of Circle objects

getLineSegments

java.util.List<LineSegment> getLineSegments()
This method should return a list of LineSegment objects used to compose this shape. The line segments, together with the circles returned in getCircles(), should completely cover the exterior of the shape so that to discover when an object will collide with a shape, it is sufficient to figure out when it will collide with each of the circles and line segments.

Returns:
List list of LineSegment objects

rotate

Shape rotate(Angle theta,
             Vect centerOfRotation)
This method rotates a shape around an arbitrary point and returns the new shape

Parameters:
theta - angle to rotate
centerOfRotation - point to rotate around
Returns:
shape rotated around centerOfRotation by angle theta

translate

Shape translate(Vect v)
This method translates a shape by an arbitrary vector and returns the new shape

Parameters:
v - vector to translate shape by
Returns:
shape translated by v

minXY

Vect minXY()
Returns:
the minimum coordinates for a bounding rectangle of the shape

maxXY

Vect maxXY()
Returns:
the maximum coordinates for a bounding rectangle of the shape