|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgalapagos.TurtleShape
class TurtleShape
A class responsible for maintaining and manipulating the turtle shape. Modified: Feb 24, 2009
Field Summary | |
---|---|
private java.awt.Color |
color
The fill color of this body shape |
private static java.awt.Color |
DEFAULT_COLOR
The default color of this body shape |
private java.awt.Point[] |
shape
An array of Point objects to represent the turtle's shape in the local coordinate system. |
private static int |
SHAPE_SIZE
The size of an array to store the points of the robot shape. |
Constructor Summary | |
---|---|
TurtleShape()
A default constructor for a standard turtle shape. |
Method Summary | |
---|---|
private Position |
compose(Position turtlePosition,
double turtleOrientation,
java.awt.Point refPoint)
Compute a position of reference point in the global coordinate system. |
java.awt.Color |
getColor()
Returns the current fill color of this body shape. |
java.awt.Polygon |
getShape(Position turtlePosition,
double turtleOrientation)
Computes a polygon that represents the turtle's shape. |
private void |
initShape()
Initializes the default shape (array) for the turtle. |
(package private) void |
setColor(java.awt.Color color)
Sets the fill color for this body shape |
(package private) void |
setRefShape(java.awt.Point[] points)
Sets the reference body shape for this turtle shape. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.awt.Color DEFAULT_COLOR
private static final int SHAPE_SIZE
private java.awt.Point[] shape
private java.awt.Color color
Constructor Detail |
---|
public TurtleShape()
Method Detail |
---|
public java.awt.Color getColor()
public java.awt.Polygon getShape(Position turtlePosition, double turtleOrientation)
turtlePosition
- The turtle's current positionturtleOrientation
- The turtle's orientation in radian
void setRefShape(java.awt.Point[] points)
points
- An array of java.awt.Point objectsvoid setColor(java.awt.Color color)
color
- a new Color for this body shapeprivate Position compose(Position turtlePosition, double turtleOrientation, java.awt.Point refPoint)
turtlePosition
- the turtle's current positionturtleOrientation
- the turtle's current orientationrefPoint
- the point in the local coordinate system
private void initShape()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |