The goal is to build a surface in OpenGL (but this is not the essence of any toolkit). The surface is given by a function, with sines, cosines.

The main problem is that I don’t understand how to build this surface correctly. The simplest idea that came to mind is to split the construction area into a grid, and connect the nodes as rectangles. But then a problem arises: what if the points lie in a different plane. By definition, any plane is defined by three points, which means a triangle. So it is necessary as it is divided into triangles. But so far, nothing has come to mind.

Maybe there are some ideas? Smash like a grid, and then build as triangles is also not quite suitable. Take four points, (0, 1, 0), (0, -1, 1), (1, 1, 1), (1, -1, 0). So, it turns out that for these four points, we can build as many as 4 triangles. And which one to choose then. Does this approach not quite suit me, or do I demand too much in this case?

    1 answer 1

    Do not complicate your task)

    By 4 points, only 2 variants of a pair of triangles can be constructed (otherwise they intersect and this is not a surface). Choose any orientation. With a sufficiently dense grid, there will be no difference.

    Also, if you are interested in the visualization of the display, then draw a surface of pairs of triangles, and show the edges only from a pair together.

    enter image description here

    • Yes, yes, I meant it. By 4 points, 4 triangles can be constructed, but only two of them form a surface. - van9petryk