Any ideas how todo mesh to mesh union, difference and intersection.
Has someone already managed this?
basicly I would like to take a mesh and cut it into two (like in modeling software) but all programaticly.
Any ideas how todo mesh to mesh union, difference...
-
- Posts: 1215
- Joined: Tue Jan 09, 2007 7:03 pm
- Location: Leuven, Belgium
This can be a difficult problem to tackle since you'll always have situations where vertex addition/removal is needed, maintaining a correct (and optimal) triangulation
I've never done anything like this before (I always do these kinds of things in modelling applications), but I assume the functionality you'd have to implement would be something like this:
1. Define a plane to slice the mesh and find all edge intersections
2. Create a second mesh (or meshbuffer) and move over one half of the sliced mesh
3. Create new vertices in both meshes at the intersection points, and recalculate your indices so your triangulation is correct
4. If you need closed meshes, calculate vertex positions to create a fill-plane where the mesh was sliced for both meshes
5. Recalculate normals, etc. where needed
As I said, I've never attempted this before so I could be missing something here, I can't really help you out with specifics, but designing and implementing these kinds of algorithms is part of the job
EDIT:
Yay! Post #600!
I've never done anything like this before (I always do these kinds of things in modelling applications), but I assume the functionality you'd have to implement would be something like this:
1. Define a plane to slice the mesh and find all edge intersections
2. Create a second mesh (or meshbuffer) and move over one half of the sliced mesh
3. Create new vertices in both meshes at the intersection points, and recalculate your indices so your triangulation is correct
4. If you need closed meshes, calculate vertex positions to create a fill-plane where the mesh was sliced for both meshes
5. Recalculate normals, etc. where needed
As I said, I've never attempted this before so I could be missing something here, I can't really help you out with specifics, but designing and implementing these kinds of algorithms is part of the job
EDIT:
Yay! Post #600!
Constructive Solid Geometry operations (union, difference, intersection)
an useful link:
http://createuniverses.blogspot.com/200 ... ogram.html
and an open library CSG:
http://www.opencsg.org/
an useful link:
http://createuniverses.blogspot.com/200 ... ogram.html
and an open library CSG:
http://www.opencsg.org/