Making 3D graphcs with math functions ------------------------------------------------------ By: Jorge Ham Trujillo - Mexico. This program allows you to draw 3D graph that represents 1, 2 or 3 mathematical functions. The program is based in OpenGL and contains anything you can need, no download of libraries or other component, it was programmed using Visual Basic 6.0. All source code is included, however, the most important thing you should remember is the module: “calcmat.bas”, here you will need to change the math functions in order to see different graphs, it implies that you need Visual Basic 6.0 installed and running, load the project, change the math functions and execute it, it worth it, believe me. In the following example you will get a surface based on the function f2 that returns f2 = Sin(u) * Sin(v), in this case f2 = Y, f1 = delta values for axis X (parameter u) and f3 = delta values for axis Z (parameter v). ‘math function for axis X Function f1(u As Single, v As Single) f1 = u End Function ‘math function for axis Y Function f2(u As Single, v As Single) f2 = Sin(u) * Sin(v) End Function ‘math function for axis Z Function f3(u As Single, v As Single) f3 = v End Function If you put math functions instead of delta values for X and Z, you will obtain interesting graphics – your imagination is the only limit. For example, if you put: f1 = cos(u)*cos(v) f2 = cos(u)*sin(v) f3= sin(u) and change the initial values for umin, umax, vmin, vmax to (this can be changed via pop up menu): umin = -1.57 umax = 1.57 vmin = 0.0 vmax = 6.30 You will see a beautiful sphere. You can also change: textures and color show and hide --grid --frame --axis how to see the graph (flat surface, little spheres, only lines and a mixture of all) You can also: --Use graph zoom --resize the window --Move the graph up, down, left and right --Copy the graph to clipboard --Save the picture to disk So, enjoy --- If you have any suggestion or comment I’ll be glad to hear from you, please e-mail me at: jorgeham2000@yahoo.com jham53@hotmail.com Jorge Ham Trujillo (Mexico) The program is not copyrighted but it would be nice if you put my name and e-mail where you use it. Note: I have a greater version of this program that includes, animation, stereograms (see your math function in real 3D!!!), math parser - you will not need ever to change any function and recompile the program – it generates also graphs in VRML, so you can see them in any browser, etc.