As is indicated in the following images, the cross section of a cube can be:
Assume that we are getting a hexagon. We can get the intersection points of the cross plane with each side of the cube and get the hexagon ABCDEF. The question is: how do we sort the intersection points so that the hexagon ABCDEF can be divided into 4 triangles ABC, ACD, ADE and AEF.

Notice that the order of the points is very important because if I get the order wrong, I won't be able to draw it out. I want to divide them into triangles because I want to visualized them in OpenGL.
Thanks so much for @HugoRune's answer. Here some result that I want to share with you guys. Left image is the cross section of a 3D volume (from an arbitrary angle). Right image is the result of maximum intensity projection of the 3D volume.

the intersection is a convex polygon, so any sorting that works for convex polygons will work here as well.
In particular:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With