It`s been a long time since i`ve been around.... life just gets in the way sometimes.
I`m trying to clip a mesh against a plane, and rebuild a closed mesh on the positive side of the plane. I have a good understanding of the process, but translating that to code has proven to be hard. After some google fu, i came across Eberly`s paper, and not much else. So I went to work attempting to build the classes and understand his implementation. I`m getting lost during the rebuilding of the edges and faces.
I have a cube with side lengths of 2 centered at origin, a plane centered at origin with the normal pointing in the positive Z axis. After processing verts, I end up with 4 verts marked unseen. But trying to implement process edges is proving to be difficult. I would think that all but 5 edges would need to be rebuilt, and sure enough, what i`ve got so far is 5 edges marked as invisible. It is my understanding that he intends to reuse the existing edges to rebuild the polyhedron. Now this is where psudo meets code, and I get lost. I tried to use a simple array for the CFace.edges member, however the clipped triangles will become quads in this method, as well as an ngon cap, which means that some faces will have more than 3 edges. I`m not familiar enough with stl::containers to know which I should be using for this(though his psuedo uses Set, i can see no append or remove in std::set)
If anyone could help with an implementation, or what ever( I love reading articles ), it would be greatly appreciated. In the mean time I`m going to learn more about std::set.
Clipping a mesh against a plane
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement