I want to divide a rectange with following definition: four numbers (left, bottom, right, top) so that a rectangle that has the bottom-left vertice of (0,0) and right-top of (4,4) would be defined by the numbers, (0 0 4 4). I need to divide it into four quadrants, but can't work out the code to do this...any suggestions? Or ask if you need clarification ........C++ coding question?
The vertices of the four rectangles can be defined as
(left,bottom),(left+(right-left)/2,bot鈥?br>
(right,top),(left+(right-left)/2,botto鈥?br>
(left,top),(left+(right-left)/2,bottom鈥?br>
(right,bottom),(left+(right-left)/2,bo鈥?br>
Hope this will suffice your need.C++ coding question?
Hope this is what you need.
rectangle has: bottom (b), left (l), right (r), top (t);
quadrant 1 (q1) has: bottom1 (b1), left1 (l1), right1 (r1), top1 (t1);
quadrant 2 (q2) has: bottom2 (b2), left2 (l2), right2 (r2), top2 (t2);
and so on.
We have four quadrants:
q3 q4
q1 q2
where:
b1 = b;
l1 = l;
r1 = (r-l)/2;
t1 = (t-b)/2;
b2 = b1;
l2 = r1;
r2 = r;
t2 = t1;
b3 = t1;
l3 = l1;
r3 = r1;
t3 = t;
b4 = t1;
l4 = r1;
r4 = r;
t4 = t;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment