Mercurial > projects > doodle
diff doodle/tk/geometry.d @ 70:0e61702c6ea6
Checkpoint
author | "David Bryant <bagnose@gmail.com>" |
---|---|
date | Sat, 14 Aug 2010 20:05:55 +0930 |
parents | 31d10176415d |
children | 024a5608087f |
line wrap: on
line diff
--- a/doodle/tk/geometry.d Sat Aug 14 19:39:58 2010 +0930 +++ b/doodle/tk/geometry.d Sat Aug 14 20:05:55 2010 +0930 @@ -152,12 +152,19 @@ this(corner1.x, corner1.y, corner.x - corner1.x, corner.y - corner1.y); } - alias position minCorner; + double x0() { return _position.x; } + double y0() { return _position.y; } + double w() { return _size.x; } + double h() { return _size.y; } + double x1() { return x0 + w; } + double y1() { return y0 + h; } + + alias position corner0; Point position() const { return _position; } Vector size() const { return _size; } - Point maxCorner() const { return _position + _size; } + Point corner1() const { return _position + _size; } bool valid() const { return _size.x > 0.0 && _size.y > 0.0; } @@ -171,8 +178,8 @@ return DEFAULT; } else { - Point max = minExtents(maxCorner(), r.maxCorner()); - Point min = maxExtents(minCorner(), r.minCorner()); + Point max = minExtents(corner1(), r.corner1()); + Point min = maxExtents(corner0(), r.corner0()); if (max.x < min.x || max.y < min.y) { return DEFAULT; @@ -192,8 +199,8 @@ return this; } else { - return Rectangle(minExtents(minCorner(), r.minCorner()), - maxExtents(maxCorner(), r.maxCorner())); + return Rectangle(minExtents(corner0(), r.corner0()), + maxExtents(corner1(), r.corner1())); } }