• Advertisement
Sign in to follow this  

C++ Library for Slicing/Bisecting a TriangleMesh in half

This topic is 866 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey All,

 

I'm looking for a quick solution for slicing a Mesh in half. I need to subdivide a large Concave Mesh into N parts. These N parts need to be closed. Are there any libraries that have this functionality built in? I've been looking around, and the best I've found is this:

 

http://stackoverflow.com/questions/9709970/algorithm-or-software-for-slicing-a-mesh

 

Which unfortunately links to a project that isn't abstracted enough to where I can pull out a small section of code for my own use. If I can't find one in the next two days I'm going to have to try and write my own in a quick and dirty way.

 

Cheers,

Share this post


Link to post
Share on other sites
Advertisement

depending on your detailed requirements, but you could slice meshes by planes with some simple stencil tricks.

 

http://opencsg.org/

ftp://ftp.sgi.com/opengl/contrib/blythe/advanced99/notes/node22.html

 

that might be a simpler solution than to actually slice and close meshes. (it's easy to get 'something' working, but you can run into tons of float precision issues etc. and every now and then find a mesh and a plane that will cause issues).

Share this post


Link to post
Share on other sites

If you wanted to simply slice through a mesh, just pass the plane data where the slide is to the shaders and for any pixels that are in front of the plane discard.

If you then wanted to close the sliced area you can just add another step: Render backfaces as if they have the normal of the slicing plane and fill with a solid color (can handle basic lighting).

If you want to add proper and detailed lighting you add the next step of detecting where in the slice that pixel would be, which means a ray-plane intersect.  Do not modify the depth buffer, just calculate it and light the pixel as if it had that position in space and that derived normal.

 

 

L. Spiro

Share this post


Link to post
Share on other sites

To clarify, I'm not doing this purely for Rendering purposes. This is going to be modifying actual object data. I'm doing something with Physics, but I first need to clip a mesh into a few smaller meshes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement