View Full Version : algorithms for CSG

01-22-2002, 02:22 AM

has anyone some ideas how to do CSG. I would like to do following

class object;

object sphere, cube;
// adding faces (triangles)to cube and sphere so they describe themselves

object intersect,combined;
intersect = intersection(cube,shpere);
combined = merge(cube,shere);

//or using overloaded operators

object op= (box&shpere) | (cylinder & ! pyramid);

it would be helpful for me to get some ideas, perhaps some links or code ??

Bye ScottManDeath

01-22-2002, 05:48 AM
i really dont know what you mean by this combined logic expression, but for a csg algo that support intersect, union and all those things, i would use the bsp tree method. i want to know more let me know.

01-23-2002, 05:00 AM

yes I think that intersections and unions describe that what i want to do
i would like to use operator & to get the object beeing the intersection between 2 others.
the operator | would be the union object from 2 others

Ive read something about BSP, but I think for a basic understandung of CSG it would be overkill?.

Bye the way, the csg isn't menat to be done in realtime every frame, just once at startup

What do you think about ?