]> Shamusworld >> Repos - architektonas/blobdiff - src/rect.cpp
Fix for incorrect return values in TopLeft() and BottomRight().
[architektonas] / src / rect.cpp
index 8207f234a3f397915c25344649462d02896971ac..693cf31582e34b3533bb1df7bbd73a9a60b71fa6 100644 (file)
@@ -98,3 +98,33 @@ void Rect::Expand(double amt)
        b -= amt;
 }
 
+
+double Rect::Width(void)
+{
+       return r - l;
+}
+
+
+double Rect::Height(void)
+{
+       return t - b;
+}
+
+
+bool Rect::Contains(Point p)
+{
+       return ((p.x >= l) && (p.x <= r) && (p.y >= b) && (p.y <= t) ? true : false);
+}
+
+
+Point Rect::TopLeft(void)
+{
+       return Point(l, t);
+}
+
+
+Point Rect::BottomRight(void)
+{
+       return Point(r, b);
+}
+