Solved

# Rectangle intersection

Posted on 2004-09-25

hi all,

how to calculate the intersection of 2 rectangle?

a rectangle is the following:

Rectangle makeRectangle (Point lowerLeft, Point upperRight) {

Rectangle r;

r.pt1 = lowerLeft;

r.pt2 = upperRight;

return r;

}

and Point is the following:

Point makePoint(int x, int y) {

Point p;

p.x = x;

p.y = y;

return p;

}

And i want the know how to make:

Rectangle intersection(Rectangle r1, Rectangle r2)

this should return the intersection of the 2 rectangles

anyone can help me plz?

i am not good in math