I am trying to come up with an algorithm that’s gonna allow me to plot a 3d surface. I’ve searched all over the Internet but couldn’t find anything particularly useful. Can anyone point me in the right direction?

That’s a very general question. The answer depends to a large degree on how the 3D surface is defined, so it isn’t possible to give you “the” answer based on the information provided. In general, though, you will need to find a way to approximate your 3D surface with a number of adjacent 3D triangles (since 3D triangles are the fundamental geometry used to plot surfaces)… (unless you want to plot isolines or points that lie on the surface).

So, I guess the general answer is that first you need to understand how to find points on your 3D surface, and then you need to connect those points so that they define the sides of a number of triangles. You need to define those triangles carefully so that triangles share vertices and edges, so that there will not be gaps or overlaps as would occur if you didn’t connect the points properly.