diff options
author | neoraider <devnull@localhost> | 2008-04-06 15:29:03 +0200 |
---|---|---|
committer | neoraider <devnull@localhost> | 2008-04-06 15:29:03 +0200 |
commit | 356efaf89afdad141b313767e1a2b89de3c08d0a (patch) | |
tree | 37edb2a0fc0ea15f4f60e45ed411cbea7b4c12c5 /Rectangle.cpp | |
parent | 258eb984bafe0f667d1e76de61c8afaa23f39ef4 (diff) | |
download | zoomedit-356efaf89afdad141b313767e1a2b89de3c08d0a.tar zoomedit-356efaf89afdad141b313767e1a2b89de3c08d0a.zip |
zoomedit: Recreated ZoomEdit based on Glademm.
Diffstat (limited to 'Rectangle.cpp')
-rw-r--r-- | Rectangle.cpp | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/Rectangle.cpp b/Rectangle.cpp deleted file mode 100644 index c90ab0d..0000000 --- a/Rectangle.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "Rectangle.h" - -bool Rectangle::contains(const Vertex &v) const { - return (edges(v) == EDGE_NONE); -} - -int Rectangle::edges(const Vertex &v) const { - int ret = EDGE_NONE; - - if(v.getX() < v1.getX()) ret |= EDGE_LEFT; - else if(v.getX() >= v2.getX()) ret |= EDGE_RIGHT; - - if(v.getY() < v1.getY()) ret |= EDGE_TOP; - else if(v.getY() >= v2.getY()) ret |= EDGE_BOTTOM; - - return ret; -} - -int Rectangle::intersects(const Line &l, Vertex *v, int edge) const { - const Line top(v1.getX(), v1.getY(), v2.getX(), v1.getY()); - const Line bottom(v1.getX(), v2.getY(), v2.getX(), v2.getY()); - const Line left(v1.getX(), v1.getY(), v1.getX(), v2.getY()); - const Line right(v2.getX(), v1.getY(), v2.getX(), v2.getY()); - - if(edge == EDGE_NONE) edge = edges(l.getVertex1()); - - if((edge & EDGE_TOP) && (top.intersects(l, v) == INTERSECTION_SEGMENT_SEGMENT)) - return EDGE_TOP; - if((edge & EDGE_BOTTOM) && (bottom.intersects(l, v) == INTERSECTION_SEGMENT_SEGMENT)) - return EDGE_BOTTOM; - if((edge & EDGE_LEFT) && (left.intersects(l, v) == INTERSECTION_SEGMENT_SEGMENT)) - return EDGE_LEFT; - if((edge & EDGE_RIGHT) && (right.intersects(l, v) == INTERSECTION_SEGMENT_SEGMENT)) - return EDGE_RIGHT; - - v->setLocation(0, 0); - - return EDGE_NONE; -} - -int Rectangle::intersects(const Line &l, Vertex *v1, Vertex *v2, int edge) const { - int ret = EDGE_NONE; - - if(edge == EDGE_NONE) edge = edges(l.getVertex1()); - - ret |= intersects(l, v1, edge); - ret |= intersects(l, v2, EDGE_ALL^edge); - - return ret; -} |