|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--vehicle.MovementTracker
A MovementTracker tracks the current position and orientation of an object with graphics components. It mostly handles converting from global to local coordinates for each object.
The position and orientation is relative to the orignal center position and orientation of the object. However, all positions are returned in global coordinates.
Field Summary | |
private java.awt.geom.Area |
container
|
private double |
orientation
|
private double |
posX
|
private double |
posY
|
private double |
startX
|
private double |
startY
|
Constructor Summary | |
MovementTracker()
Creates a tracker |
Method Summary | |
java.awt.geom.Area |
getCurrentContainer()
Retreives the current outline of the shapes |
double |
getOrientation()
Gets the orientation changed from the inital drawing |
java.awt.geom.AffineTransform |
getTransform()
Get the affine transform of this vehicle from global to local space |
double |
getX()
Returns the current x position of the center point of all the shapes contained in this tracker |
double |
getY()
Returns the current y position of the center point of all the shapes contained in this tracker |
void |
moveBy(double xoffset,
double yoffset)
Move by xoffset and yoffset pixels |
void |
moveTo(double x,
double y)
Move to (x, y) in the world |
void |
registerShape(java.awt.Shape s)
Registers a shape as part of this tracker to track. |
void |
rotateBy(double theta)
Rotate shapes by theta with postive sign meaning clockwise |
void |
setRotation(double theta)
Set the current rotation with postive sign meaning clockwise |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private double startX
private double startY
private double posX
private double posY
private double orientation
private java.awt.geom.Area container
Constructor Detail |
public MovementTracker()
Method Detail |
public void registerShape(java.awt.Shape s)
s
- the Shape to add to this trackerpublic double getX()
public double getY()
public double getOrientation()
public void moveTo(double x, double y)
x
- the x-coordinate to move toy
- the y-coordinate to move topublic void setRotation(double theta)
theta
- the angle in radianspublic void moveBy(double xoffset, double yoffset)
xoffset
- the number of pixels to move in the x-axis directionyoffset
- the number of pixelse to move in the y-axis directionpublic void rotateBy(double theta)
theta
- the angle in radianspublic java.awt.geom.AffineTransform getTransform()
public java.awt.geom.Area getCurrentContainer()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |