I need to create an intersect method for rectangle class, that takes a rectangle and returning another rectangle representing the overlapping area.
for example, given:
if they are overlapping I should return a rectangle of point (400,420) width = 50 height = 60.
Try using the CGRectIntersection
function, it will return the intersection of two CGRect
instances:
CGRect CGRectIntersection (
CGRect r1,
CGRect r2
);
There are quite a few useful functions detailed here:
http://blogs.oreilly.com/iphone/2008/12/useful-core-graphics-functions.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With