Hi Norman,

I also had unexpected results with getCoveringObjects() and getCoveredObjects() - don't even understand here there are two of them. But using getObjectsWithinDistance() things always work fine. In all likelihood your objects are really not intersecting. Could you print out the coordinates of the lines and the tiles you are sending to getObjectsWithinDistance()?

Another thing: all spatial objects I use/create are contained by a GeomVectorField.



On 26 July 2013 18:25, Norman Langner <[log in to unmask]> wrote:

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

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?