}
- SGRect(const SGVec2<T>& pt):
+ explicit SGRect(const SGVec2<T>& pt):
_min(pt),
_max(pt)
{
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
*/