X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fmath%2FSGRect.hxx;h=86dd482c9c8875c54bdd848abff6fe2df6656e32;hb=8c38f799adf4f4ece8c79dd1e6ff5a75d85a17dc;hp=da5cdcfe65dcbace4949ea6a7174cd4764d8a32f;hpb=d3b211e7873e7754e8385937a417187724733e70;p=simgear.git diff --git a/simgear/math/SGRect.hxx b/simgear/math/SGRect.hxx index da5cdcfe..86dd482c 100644 --- a/simgear/math/SGRect.hxx +++ b/simgear/math/SGRect.hxx @@ -113,6 +113,18 @@ class SGRect void setTop(T t) { _min.y() = t; } void setBottom(T b) { _max.y() = b; } + /** + * Expand rectangle to include the given position + */ + void expandBy(T x, T y) + { + if( x < _min.x() ) _min.x() = x; + if( x > _max.x() ) _max.x() = x; + + if( y < _min.y() ) _min.y() = y; + if( y > _max.y() ) _max.y() = y; + } + /** * Move rect by vector */