我得到了经度和纬度的地理坐标,例如西北和东南经度/纬度。所以,当我得到它们时,我会翻译成公制。所以在这里我得到了我的第一个矩形,带有north_west和south_east坐标,然后我在具有北、南、西和东坐标的同一公制系统中有边界矩形。我需要在边缘触摸的交叉点上检查这两个矩形,我写的是:
bool filter(TilePosition const& tile_position) const noexcept override
{
MetricBoundingBox tile_bounds{tile_position};
bool cond1 = (tile_bounds.north <= south_east_.lon);
bool cond2 = (tile_bounds.south >= north_west_.lon);
bool cond3 = (tile_bounds.west <= south_east_.lat);
bool cond4 = (tile_bounds.east >= north_west_.lat);
return cond1 && cond2 && cond3 && cond4;
}
而且我不确定我是否做对了?我的要求是,如果第二个矩形的边界与第一个矩形的边界相交,则必须留下第二个。否则,过滤。