| Package | org.MARS.simulation |
| Class | public final class Environment |
Note: Environment class is implemented as a Singleton, therefore at most one instance of this class can exist. Use Environment.getInstance() to access this instance.
| Method | Defined by | ||
|---|---|---|---|
|
constructor
| Environment | ||
|
addDynamicObject(object:IBody, isDetectable:Boolean):void
Adds a dynamical (movable) object to the Simulation
| Environment | ||
|
Adds a line to the table's surface
| Environment | ||
|
Adds the robot to the Simulation
| Environment | ||
|
addTableShape(shape:Shape):void
Adds a table shape.
| Environment | ||
|
addWallShape(shape:Shape):void
Adds a wall to the Simulation
| Environment | ||
|
checkAllOnTable():void
Checks if all of the dynamic objects, including the robot,
are on the table
| Environment | ||
|
checkAllWallCollisions():void
Checks if all of the dynamic objects, including the robot,
are colliding with any of the walls
| Environment | ||
|
[static]
Gets the instance of the singleton
| Environment | ||
|
isCollidingWithWall(shape:Shape):Boolean
Checks if the shape collides with any of the walls
| Environment | ||
|
Checks if the shape is on ony of the lines
| Environment | ||
|
Checks if the shape is on the table
| Environment | ||
|
updateRobots():void
Call the step() method of all of the robots in the Simulation
| Environment | ||
| Environment | () | constructor |
public function Environment()constructor
| addDynamicObject | () | method |
public function addDynamicObject(object:IBody, isDetectable:Boolean):voidAdds a dynamical (movable) object to the Simulation
Parametersobject:IBody |
|
isDetectable:Boolean — - wheather the object is detectable by the robot's sensors
|
| addLineShape | () | method |
public function addLineShape(start:Vector, end:Vector, width:Number = 10):voidAdds a line to the table's surface
Parametersstart:Vector — - starting point of the line
|
|
end:Vector — - ending point of the line
|
|
width:Number (default = 10) — - width of the line (10 by default)
|
| addRobot | () | method |
| addTableShape | () | method |
public function addTableShape(shape:Shape):voidAdds a table shape. All table shapes combined make up the robot's environment.
Parametersshape:Shape |
| addWallShape | () | method |
| checkAllOnTable | () | method |
public function checkAllOnTable():voidChecks if all of the dynamic objects, including the robot, are on the table
| checkAllWallCollisions | () | method |
public function checkAllWallCollisions():voidChecks if all of the dynamic objects, including the robot, are colliding with any of the walls
| getInstance | () | method |
public static function getInstance():EnvironmentGets the instance of the singleton
ReturnsEnvironment —
Simulation instance
|
| isCollidingWithWall | () | method |
public function isCollidingWithWall(shape:Shape):BooleanChecks if the shape collides with any of the walls
Parametersshape:Shape |
Boolean — true if the shape is within or intersects one of the walls
and false if the shape is outside of all of the walls.
|
| isOnLine | () | method |
public function isOnLine(shape:Shape):BooleanChecks if the shape is on ony of the lines
Parametersshape:Shape |
Boolean — true if the shape is within or intersects one of the lines
and false if the shape is outside of all of the lines.
|
| isOnTable | () | method |
public function isOnTable(shape:Shape):BooleanChecks if the shape is on the table
Parametersshape:Shape |
Boolean — true if the shape is within or intersects one of the table's shapes
and false if the shape is outside of the table's shapes.
|
| updateRobots | () | method |
public function updateRobots():voidCall the step() method of all of the robots in the Simulation
See also