gizmoball.shape
Class FlipperShape

java.lang.Object
  extended by gizmoball.shape.UnionShape
      extended by gizmoball.shape.FlipperShape
All Implemented Interfaces:
Shape

public class FlipperShape
extends UnionShape
implements Shape

This class, implementing the Shape interface, represents a flipper shape, consisting of two circles connected by edges tangent to the circles. This class extends UnionShape. Representation Invariant: center1 != null and center2 != null && radius > 0

Author:
Eitan Reich

Constructor Summary
FlipperShape(Vect center1, Vect center2, double radius)
          Constructer for FlipperShape
 
Method Summary
 Vect getCenter1()
           
 Vect getCenter2()
           
 double getRadius()
           
 java.util.List<Vect> getRectVertices()
           
 FlipperShape rotate(Angle theta, Vect centerOfRotation)
          Rotates shape around Angle theta and center of rotation and returns the new shape
 FlipperShape translate(Vect v)
          Translates shape by vector v and returns new shape
 
Methods inherited from class gizmoball.shape.UnionShape
containsPoint, getCircles, getLineSegments, getShapes, maxXY, minXY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gizmoball.shape.Shape
containsPoint, getCircles, getLineSegments, maxXY, minXY
 

Constructor Detail

FlipperShape

public FlipperShape(Vect center1,
                    Vect center2,
                    double radius)
Constructer for FlipperShape

Parameters:
center1 - center of first circle
center2 - center of second circle
radius - radius of circles
Method Detail

getCenter1

public Vect getCenter1()
Returns:
center of first circle

getCenter2

public Vect getCenter2()
Returns:
center of second circle

getRadius

public double getRadius()
Returns:
radius of circles

getRectVertices

public java.util.List<Vect> getRectVertices()
Returns:
list of 4 vertices that can be used to construct a rectangle whose edges connect the two circles

rotate

public FlipperShape rotate(Angle theta,
                           Vect centerOfRotation)
Rotates shape around Angle theta and center of rotation and returns the new shape

Specified by:
rotate in interface Shape
Overrides:
rotate in class UnionShape
Parameters:
theta - angle to rotate
centerOfRotation - point to rotate around
Returns:
shape rotated around centerOfRotation by angle theta

translate

public FlipperShape translate(Vect v)
Translates shape by vector v and returns new shape

Specified by:
translate in interface Shape
Overrides:
translate in class UnionShape
Parameters:
v - vector to translate shape by
Returns:
shape translated by v