views:

97

answers:

1

Say I have a UIImageView that contains an image of an object that is not rectangular, i.e. a round ball. How can I check if another UIImageView (rectangular or not) intersects, or contains a point in, that object (not its frame)?

Basic example:

I have two balls rolling around on the screen, and I want to check for collision. But I don't want to check if their rects intersects eachother, since the balls are not rectangular.

+1  A: 

I think if you have limited set of possible shapes then it is better to perform the check for each possible pair of object shapes rather then some generic algorithm. For example two circles intersect if the distance between their centers is less then the sum of their radiuses etc.

Vladimir
Wow, simplicity at its best. Thanks so much, I didn't even think of that! It's going to work since I will most likely only work with round objects for now.
ressaw