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
-
externalList
-
Vector of MapObject containing all walls and objects managed
by the Simulation.
-
internalList
-
Vector of MapObject containing all walls and objects managed
by the Map.
-
Map(double, double)
- Constructs a new map with the given width and height
-
add(MapObject)
-
-
addEx(MapObject)
-
-
addWall(Position, Position)
-
-
getExternalList()
-
-
getHeight()
- Returns the height of the map
-
getInternalList()
-
-
getWidth()
- Returns the width of the map
-
lineSegmentsIntersect(LinearMapObject, LinearMapObject)
- Returns true if the two line segments intersect
-
lineSegmentsTouch(LinearMapObject, LinearMapObject, double)
- Return true if the two line segment are separated by a distance
smaller than dist
-
lineSegmentTouches(LinearMapObject, Position, double)
- Returns true if the distance between the line segment and the point
is smaller than radius
-
remove(MapObject)
-
-
removeEx(MapObject)
-
-
removeRobot(int)
- Removes the robot with the given number from the map,
if it exists.
-
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.
-
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.
-
touchesWall(Position, double)
-
Returns true if a linear object of internalList is at a distance
shorter than radius to the given position.
-
traversesWall(LinearMapObject)
- Returns true if the given line segment goes through a wall
-
traversesWall(LinearMapObject, double)
- Returns true if the given line segment goes through a wall
or comes to a distance closer than dist to it.
internalList
protected Vector internalList
- Vector of MapObject containing all walls and objects managed
by the Map.
externalList
protected Vector externalList
- Vector of MapObject containing all walls and objects managed
by the Simulation.
This contains the bullets, among others.
Map
public Map(double w,
double h)
- Constructs a new map with the given width and height
getInternalList
public Vector getInternalList()
getExternalList
public Vector getExternalList()
getWidth
public double getWidth()
- Returns the width of the map
getHeight
public double getHeight()
- Returns the height of the map
addWall
public void addWall(Position from,
Position to)
add
public void add(MapObject newObj)
remove
public void remove(MapObject old)
addEx
public void addEx(MapObject newObj)
removeEx
public void removeEx(MapObject old)
removeRobot
public void removeRobot(int no)
- Removes the robot with the given number from the map,
if it exists.
lineSegmentsIntersect
public boolean lineSegmentsIntersect(LinearMapObject one,
LinearMapObject two)
- Returns true if the two line segments intersect
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
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
traversesWall
public boolean traversesWall(LinearMapObject traj)
- Returns true if the given line segment goes through a wall
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.
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.
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.
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