EDU.cmu.cs.coral.simulation
Class LandmarkSim

java.lang.Object
  |
  +--EDU.gatech.cc.is.simulation.ObstacleSim
        |
        +--EDU.cmu.cs.coral.simulation.LandmarkSim
Direct Known Subclasses:
ColorTransitionSim

public class LandmarkSim
extends ObstacleSim

this is a simulation of a landmark. It is stationary and gives no clues to its presence other than its existence.


Field Summary
protected  SimulatedObject[] all_objects
           
protected  java.awt.Color background
           
protected  java.awt.Color foreground
           
protected  Vec2 position
           
protected  double RADIUS
           
protected  int unique_id
           
protected  int visionclass
           
 
Fields inherited from class EDU.gatech.cc.is.simulation.ObstacleSim
all_objects, background, DEBUG, foreground, lastx, lasty, position, RADIUS, unique_id, visionclass
 
Constructor Summary
LandmarkSim()
          Instantiate a LandmarkSim object.
 
Method Summary
 void draw(java.awt.Graphics g, int w, int h, double t, double b, double l, double r)
          Draw the object.
 void draw(Vec2 pos, java.awt.Graphics g, int w, int h, double t, double b, double l, double r)
          Draw the object in a specific spot.
 Vec2 getCenter(Vec2 from)
          Find the center point of the object from a particular location.
 Vec2 getClosestPoint(Vec2 from)
          Find the closest point on the object from a particular location.
 int getID()
          Return the id.
 Vec2 getPosition()
          Find the center point of the object in absolute coordinates.
 double getRadius()
           
 int getVisionClass()
          Return the vision class of the object.
 void init(double xp, double yp, double t, double r, java.awt.Color f, java.awt.Color b, int v, int i, long s)
          Initialize a ObstacleSim object.
 void setID(int i)
          Set the id of the object.
 void setVisionClass(int v)
          Change the way the object is perceived by vision hardware.
 void takeStep(long time_increment, SimulatedObject[] all_objs)
          Take a simulated step;
 
Methods inherited from class EDU.gatech.cc.is.simulation.ObstacleSim
checkCollision, checkCollision, clearTrail, drawIcon, drawID, drawState, drawTrail, isObstacle, isPickupable, isPushable, pickUp, push, putDown, quit, receive, setTrailLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

position

protected Vec2 position

foreground

protected java.awt.Color foreground

background

protected java.awt.Color background

all_objects

protected SimulatedObject[] all_objects

visionclass

protected int visionclass

unique_id

protected int unique_id

RADIUS

protected double RADIUS
Constructor Detail

LandmarkSim

public LandmarkSim()
Instantiate a LandmarkSim object.
Method Detail

init

public void init(double xp,
                 double yp,
                 double t,
                 double r,
                 java.awt.Color f,
                 java.awt.Color b,
                 int v,
                 int i,
                 long s)
Initialize a ObstacleSim object. This is called automatically by JavaBotSim.
Overrides:
init in class ObstacleSim
Parameters:
xp - the x coordinate.
yp - the y coordinate.
t - ingored.
r - the radius.
f - the foreground color.
b - ignored.
v - the vision class.
i - the unique id.
s - random number seed.

getPosition

public Vec2 getPosition()
Description copied from interface: SimulatedObject
Find the center point of the object in absolute coordinates.
Overrides:
getPosition in class ObstacleSim
Tags copied from interface: SimulatedObject
Returns:
the point.

takeStep

public void takeStep(long time_increment,
                     SimulatedObject[] all_objs)
Take a simulated step;
Overrides:
takeStep in class ObstacleSim
Tags copied from interface: SimulatedObject
Parameters:
time_increment - how much time has elapsed since the last call.
all_objects - the other objects in the simulation.

draw

public void draw(java.awt.Graphics g,
                 int w,
                 int h,
                 double t,
                 double b,
                 double l,
                 double r)
Draw the object.
Overrides:
draw in class ObstacleSim
Tags copied from interface: SimulatedObject
Parameters:
g - graphics area to draw the object.
w - the width in pixels of g.
h - the height in pixels of g.
t - the y coordinate represented by the top boundary of the drawing area.
b - the y coordinate represented by the bottom boundary of the drawing area.
l - the x coordinate represented by the left boundary of the drawing area.
r - the x coordinate represented by the right boundary of the drawing area.

getClosestPoint

public Vec2 getClosestPoint(Vec2 from)
Description copied from interface: SimulatedObject
Find the closest point on the object from a particular location. This is useful for obstacle avoidance and so on.
Overrides:
getClosestPoint in class ObstacleSim
Tags copied from interface: SimulatedObject
Parameters:
from - the place from which the point is determined.
Returns:
the closest point.

getCenter

public Vec2 getCenter(Vec2 from)
Description copied from interface: SimulatedObject
Find the center point of the object from a particular location.
Overrides:
getCenter in class ObstacleSim
Tags copied from interface: SimulatedObject
Parameters:
from - the place from which the point is determined.
Returns:
the center point.

getVisionClass

public int getVisionClass()
Description copied from interface: SimulatedObject
Return the vision class of the object.
Overrides:
getVisionClass in class ObstacleSim
Tags copied from interface: SimulatedObject
Parameters:
v - the new vision class.

setVisionClass

public void setVisionClass(int v)
Description copied from interface: SimulatedObject
Change the way the object is perceived by vision hardware. This can be used to make old targets invisible (a simulation hack.... sorry).
Overrides:
setVisionClass in class ObstacleSim
Tags copied from interface: SimulatedObject
Parameters:
v - the new vision class.

setID

public void setID(int i)
Description copied from interface: SimulatedObject
Set the id of the object.
Overrides:
setID in class ObstacleSim
Tags copied from interface: SimulatedObject
Parameters:
id - the new id.

getID

public int getID()
Description copied from interface: SimulatedObject
Return the id.
Overrides:
getID in class ObstacleSim

draw

public void draw(Vec2 pos,
                 java.awt.Graphics g,
                 int w,
                 int h,
                 double t,
                 double b,
                 double l,
                 double r)
Description copied from class: ObstacleSim
Draw the object in a specific spot.
Overrides:
draw in class ObstacleSim
Tags copied from interface: SimulatedObject
Parameters:
p - location to draw it at.
g - graphics area to draw the object.
w - the width in pixels of g.
h - the height in pixels of g.
t - the y coordinate represented by the top boundary of the drawing area.
b - the y coordinate represented by the bottom boundary of the drawing area.
l - the x coordinate represented by the left boundary of the drawing area.
r - the x coordinate represented by the right boundary of the drawing area.

getRadius

public double getRadius()