bool Boundary::partialWithin(const AbstractPoly& poly, SUMOReal offset) const { return poly.around(Position(myXmax, myYmax), offset) || poly.around(Position(myXmin, myYmax), offset) || poly.around(Position(myXmax, myYmin), offset) || poly.around(Position(myXmin, myYmin), offset); }
bool PositionVector::partialWithin(const AbstractPoly& poly, SUMOReal offset) const { for (const_iterator i = begin(); i != end() - 1; i++) { if (poly.around(*i, offset)) { return true; } } return false; }
bool Boundary::overlapsWith(const AbstractPoly& p, SUMOReal offset) const { if ( // check whether one of my points lies within the given poly partialWithin(p, offset) || // check whether the polygon lies within me p.partialWithin(*this, offset)) { return true; } // check whether the bounderies cross return p.crosses(Position(myXmax + offset, myYmax + offset), Position(myXmin - offset, myYmax + offset)) || p.crosses(Position(myXmin - offset, myYmax + offset), Position(myXmin - offset, myYmin - offset)) || p.crosses(Position(myXmin - offset, myYmin - offset), Position(myXmax + offset, myYmin - offset)) || p.crosses(Position(myXmax + offset, myYmin - offset), Position(myXmax + offset, myYmax + offset)); }