How to truncate geometry by vertex?

Hi,

I’m trying to truncate a geometry object as shown in the gif below:

discourse

How would I achieve this?

My current idea is:

  • find an equation for the desired truncation plane
  • find equations for the edges being truncated and their intersections with the truncating plane
  • remove the vertex that was truncated from the vertex array
  • add three new vertices into the vertex array (intersection points)
  • update the faces array to include the newly created vertices

Is this the best approach or is there an easier way?

Thanks,
Vishal

Hi!
Maybe you try this approach: https://threejs.org/examples/?q=clip#webgl_clipping_stencil

Thanks for your response.

Since the clipping is applied to the material in those examples, though, it constantly clips a different portion of the geometry as it is transformed. How would I go about clipping the actual geometry so that I can apply transformations without the clip changing?

I actually came across this comment of yours on operations with geometry and it seems like this library may do what I want. I think all I would need to do is subtract an appropriate plane mesh from the tetrahedron mesh to produce a new, truncated mesh.