PDA

View Full Version : Intersection area

fox
02-01-2002, 07:56 AM
Hi

I have a few objects in the scene - where I need to find their intersection with the floor - I can find the area and coordinates of the intersection of each object with the floor - what I need is to work out the total intersected area - bearing in mind that the objects can be moved around in the scene and their intersected areas may or may not overlap with each other - How do I implement this (may be using boolean operators? - I 'm not quite sure how though) Any ideas and sample code?

Cheers

Menne
02-01-2002, 11:50 AM
Intersection test is a quite huge chapter, maybe an nice example of intersection test would help you.
Have a glance on this Nehe Tutorial, it includes balls moving around in a room intersecting with the walls and each others.
http://nehe.gamedev.net/tutorials/lesson31.asp

fox
02-02-2002, 02:46 AM
Thanx - I 've had a look at the link - it's not quite what I need - I can find the coordinates of interesected area an object in the scene eg cube with the floor. All I need is to know is an easy way to find total intersected area of say three cubes overlap each other and also intersects with the floor - their intersecting area will also overlap - it is this area that I need to find out. There may also be cases when they don't overlap.

any ideas

cheers

[This message has been edited by fox (edited 02-02-2002).]

MikeC
02-02-2002, 04:10 AM
I'd be interested to know why you want to do this...

The big question is what sort of performance you need. The obvious solution would be an image-space one: clear the screen to color A, set up an orthographic camera looking straight down at the floor and with a view volume big enough to contain all your objects, render your objects in colour B, then grab the contents of the framebuffer and count the number of B pixels.

Won't be very fast though...

Hull
02-02-2002, 04:53 AM
Couldnt you just calculate the volumes of the objects in worldspace and sum up the results subtracting it by the ground surface?

Like this:

Volume integral of Shape A + Volume integral of Shape B - Volume integral of Ground.

(Im desperately trying to find my calculus book http://www.opengl.org/discussion_boards/ubb/smile.gif )