I have a problem. I'm finding an intersection using the code below:
Envelope[][] extents = new Envelope[tilesCountX][tilesCountY];
// some code here to set "extents" values
var intersectedTiles =
extents
.SelectMany(es => es)
.Where(e => EnvIntersects(e, bounds))
.ToList();
private static bool EnvIntersects(Envelope e1, Envelope e2)
{
return e1.MinX >= e2.MinX && e1.MaxX <= e2.MaxX && e1.MinY >= e2.MinY && e1.MaxY <= e2.MaxY;
}
It works but I want to get the indexes of intersected extents.
e.g.
If extents[2][7]
is an intersected element, I want to get 2
and 7
.
Is it possible by modifying my code?
[edit]
bounds
is an Envelope
that has MinX
, MinY
, MaxX
and MaxY
properties inside.
Envelope bounds = new Envelope();
bounds.MinX = some_value_1;
bounds.MaxX = some_value_2;
bounds.MinY = some_value_3;
bounds.MaxY = some_value_4;