All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ch.jp.robwar.Map

java.lang.Object
   |
   +----ch.jp.robwar.Map

public class Map
extends Object
implements Serializable, Cloneable
The Map class contains a description of the simulated world and operators to check for collisions between simulated objects, as well as access to the objects themselves.

See Also:
MapObject

Variable Index

 o externalList
Vector of MapObject containing all walls and objects managed by the Simulation.
 o internalList
Vector of MapObject containing all walls and objects managed by the Map.

Constructor Index

 o Map(double, double)
Constructs a new map with the given width and height

Method Index

 o add(MapObject)
 o addEx(MapObject)
 o addWall(Position, Position)
 o getExternalList()
 o getHeight()
Returns the height of the map
 o getInternalList()
 o getWidth()
Returns the width of the map
 o lineSegmentsIntersect(LinearMapObject, LinearMapObject)
Returns true if the two line segments intersect
 o lineSegmentsTouch(LinearMapObject, LinearMapObject, double)
Return true if the two line segment are separated by a distance smaller than dist
 o lineSegmentTouches(LinearMapObject, Position, double)
Returns true if the distance between the line segment and the point is smaller than radius
 o remove(MapObject)
 o removeEx(MapObject)
 o removeRobot(int)
Removes the robot with the given number from the map, if it exists.
 o robotTouching(Position, double, int)
Returns the number of the robot that is at a distance less than radius from pos, and whose number is different from except.
 o touchesObstacle(Position, double, int)
Returns true if an object, except the robot number exceptRobot is at a distance shorter than radius to the given position.
 o touchesWall(Position, double)
Returns true if a linear object of internalList is at a distance shorter than radius to the given position.
 o traversesWall(LinearMapObject)
Returns true if the given line segment goes through a wall
 o traversesWall(LinearMapObject, double)
Returns true if the given line segment goes through a wall or comes to a distance closer than dist to it.

Variables

 o internalList
 protected Vector internalList
Vector of MapObject containing all walls and objects managed by the Map.

 o externalList
 protected Vector externalList
Vector of MapObject containing all walls and objects managed by the Simulation. This contains the bullets, among others.

Constructors

 o Map
 public Map(double w,
            double h)
Constructs a new map with the given width and height

Methods

 o getInternalList
 public Vector getInternalList()
 o getExternalList
 public Vector getExternalList()
 o getWidth
 public double getWidth()
Returns the width of the map

 o getHeight
 public double getHeight()
Returns the height of the map

 o addWall
 public void addWall(Position from,
                     Position to)
 o add
 public void add(MapObject newObj)
 o remove
 public void remove(MapObject old)
 o addEx
 public void addEx(MapObject newObj)
 o removeEx
 public void removeEx(MapObject old)
 o removeRobot
 public void removeRobot(int no)
Removes the robot with the given number from the map, if it exists.

 o lineSegmentsIntersect
 public boolean lineSegmentsIntersect(LinearMapObject one,
                                      LinearMapObject two)
Returns true if the two line segments intersect

 o lineSegmentTouches
 public boolean lineSegmentTouches(LinearMapObject line,
                                   Position pos,
                                   double radius)
Returns true if the distance between the line segment and the point is smaller than radius

 o lineSegmentsTouch
 public boolean lineSegmentsTouch(LinearMapObject one,
                                  LinearMapObject two,
                                  double dist)
Return true if the two line segment are separated by a distance smaller than dist

 o traversesWall
 public boolean traversesWall(LinearMapObject traj)
Returns true if the given line segment goes through a wall

 o traversesWall
 public boolean traversesWall(LinearMapObject traj,
                              double dist)
Returns true if the given line segment goes through a wall or comes to a distance closer than dist to it.

 o touchesWall
 public boolean touchesWall(Position pos,
                            double radius)
Returns true if a linear object of internalList is at a distance shorter than radius to the given position.

 o robotTouching
 public int robotTouching(Position pos,
                          double radius,
                          int except)
Returns the number of the robot that is at a distance less than radius from pos, and whose number is different from except. If there is no such robot, returns -1.

 o touchesObstacle
 public boolean touchesObstacle(Position pos,
                                double radius,
                                int exceptRobot)
Returns true if an object, except the robot number exceptRobot is at a distance shorter than radius to the given position.


All Packages  Class Hierarchy  This Package  Previous  Next  Index