gizmoball.shape
Class FlipperShape
java.lang.Object
gizmoball.shape.UnionShape
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 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FlipperShape
public FlipperShape(Vect center1,
Vect center2,
double radius)
- Constructer for FlipperShape
- Parameters:
center1 - center of first circlecenter2 - center of second circleradius - radius of circles
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 rotatecenterOfRotation - 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