PDA

View Full Version : Easy Method for perfect 2d csg.


rouncer
03-20-2008, 08:51 PM
represent everything with a mixed up normal 2d line primitive
with indexes, a line list.

then intersect weld with line intersections to glue the 2 shapes together,
then just use containment from line centroids to reject lines out due to
intersection type.

and thats it, your left totally infinite concentric holes allowed and the great
thing is you can take it to 3d easy.

for every triangle of shape a do a triangle plane intersection with every
triangle in shape b and your left the 2d slither of the opposing model
on the triangles plane.

perform 2d csg for every triangle - grid weld at the end and presto - 3d csg!

This has got to be the easiest implementation...

Wernaeh
03-21-2008, 11:45 AM
Heya!
I'm not quite sure whether I got your description, but it sounds like somewhat of a mixed-up version of normal BSP-based CSG ?

Basically, for BSP-based CSG, you build a treelike structure with filled space on the negative side of each leaf node. Then, you can push polygons of other shapes through the tree to determine whether these should be deleted (on the negative side of a leaf node) or kept.

This of course requires the construction of a BSP tree for both source shapes, which is costy and ugly for certain primitives (spheres) and a problem for high detail geometry (many splits), and has nasty rounding errors.

Your method sounds like quite an improvement, at least as far as I understood it.
However, are you sure your easy method works in all cases (for example, coplanar contact faces, interpenetrations of volume, without shared edges, points or faces) ?

Could you explain your idea in depth ?

I'm quite curious here, since I did my Facharbeit at the Gymnasium (something like a final thesis for the German high school) on the topic of CSG solutions.

Cheers,
- Wernaeh

rouncer
03-21-2008, 07:01 PM
Its still in theory for myself, but im putting it together today, so ill see
how it goes!

Its not a difficult concept, and ive wanted a robust csg algorythm for ages.
(5 years now since my first attempt at it when i was early 20's, now im
late 20's.)

I sculpt model too, but clean mechanical shapes are just as important to make.

When i implement it I want 100% clean output and coplanar.
(a coplanar 3d union when taken to 2d becomes a 2d union... but a non
coplanar union in 2d is a subtract.)

Ill post again if I get any success, ill just give it out for free.