Print

Print


Hi,

I'm still trying to get used to MASON/GEOMASON and it seems I can't 
solve the actual problem alone.
I have agents moving in a Room (movingSpace) which move from one point 
to another using the shortest path.
Therefore i made my own grid which consists of tiles who cover the MBR 
of the movingSpace.
My agents are moving fine and don't move out of it. Now I included 
obstacles - 2 walls which make a small exit.
I want to know which Tile is near those walls or intersects/ is 
covered/contains/touched/ by it or in a certain distance of it. But none 
of those methods gives me a positive result.

This is my setup:
class Room (SimState) has these variables:

GeomVectorField movingSpace -> includes a polygon as MasonGeometry (Polygon)
GeomVectorField agents -> include the agents as MasonGeometry (Points)
GeomVectorField obstacles -> includes 2 walls represented as 
MasonGeometry (LineString)

I build tiles and every tile is a polygon (square):
[...]
Coordinate p1 = new Coordinate(xTile, yTile);
Coordinate p2 = new Coordinate(xTile + Room.TILESIZE, yTile);
Coordinate p3 = new Coordinate(xTile, yTile + Room.TILESIZE);
Coordinate p4 = new Coordinate(xTile+ Room.TILESIZE, yTile+ Room.TILESIZE);
Coordinate[] points = {p1, p2, p3, p4, p1};
LinearRing lr = new GeometryFactory().createLinearRing(points);
Polygon poly = new GeometryFactory().createPolygon(lr);
Tile tile = new Tile(i,j); //Tile extends MasonGeometry
tile.setPolygon(poly);

I tried obstacles.isCovered(tile), 
obstacles.getObjectswithinDistance(tile, 1.0), intersects etc. pp nearly 
everything which should give me a positive feedback.
Do you have any clue what I'm doing wrong? Should I add every tile to 
another GeomVectorField to make those operations work?

Thanks!
Norman