Visible surface determination

Official forum for the Chipmunk2D Physics Library.
Post Reply
Lucidus
Posts: 3
Joined: Fri Oct 28, 2011 7:21 am
Contact:

Visible surface determination

Post by Lucidus »

I'm trying to calculate the total area all bodies or shapes are occupying on the screen. I.e. if I have 2 circles, A and B, that intersect each other, I want to calculate the area that A union B covers (on the screen).

I've been reading through the chipmunk documentation and looked in the chipmunk API for a method that I might use, but I haven't found anything that I can use directly.

The only two methods I found, that might be useful, are these two: pointQueryFirst:layers:group: and segmentQueryFirstFrom:to:layers:group:

I have tried a solution with pointQueryFirst on all points on the screen, but as I excepted, the performance was terrible. Is there another way of doing this in a more efficient way? Perhahps there are some non-documented functions that can be used for this?

Thanks in advance.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Visible surface determination

Post by slembcke »

Hmm. I think I answered this question on stack overflow last night.

http://stackoverflow.com/questions/7920 ... 85#7922985
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests