2d crossection of tetrahedrons

Hello i have divided 3d space into tetrahedrons and i wonder is it possible to use opengl to get a crossection of those in given plane- i mean that i want to
cut the 3d space with a plane so tetrahedron borders will give lines on this plane
The goal is to display just those lines on screen

First orogram would need to calculate the intersection of the crossection plane with planes of borders of each tetrahedron if those intersect they will create lines
Then render all of those lines on screen

This is probably not something you’d want to use OpenGL for. Except possibly a compute shader if you want to use the GPU rather than the CPU, but then there’s no advantage to using GLSL for that rather than OpenCL or CUDA.

If you have the vertices and faces which define the tetrahedra, you could just render them with a pair of user-defined clipping planes, parallel and close to your cross-section plane. That would produce something close to the desired result, although the width of the “lines” will vary with the slope of the faces and the end result will probably look quite ugly.

1 Like