Your task is to implement a nice and practical tool to visualise real functions of two variables. You should display the graph of a function given as y = f (x, z), and allow the user to view it from all sides as well as allowing them to change the area over which the function is being visualised.
Expression evaluation: in order for a user to be able to enter a function of two variables, we use the NCalc, library, which is able to repeatedly evaluate a given expression, bind variables to numerical values, etc. In our application the two free variables are named x and z, and the function we display in 3D is y = y(x,z). Example code how to use the NCalc library to evaluate an expression can be found in the RegenerateGraph() function in Graph.cs.
The template application 113graph from the repository grcis serves as the basis of this project. This is an OpenGL-based application which renders the user-supplied function, and reads and sets parameters.
To implement your solution, you will have to complete the following functions in Graph.cs:
We recommend to retain the basic workflow of the demo application: the function RegenerateGraph() (only in case of changes having occurred) re-allocates or otherwise just fills out the needed VBO buffers, one with the attributes of the vertices, and the other with index information. The function RenderScene() does not re-compute the actual function values, but uses these buffered values instead.
This function is used to initialise the interface elemenst, and to set application parameters. It is called once, when the application starts up:
The project uses the Trackball functionality, and you can choose which mouse button serves as the trackball trigger. The other buttons are available for your own function extension (such as triggering of a view ray).
Making the appearance of the visualised function more interesting (transparency, complex illumination, showing coordinate axes/planes), providing diagnostics at a point the user clicks on (tangent vectors, curvature, tangent plane), interactive changing of the definition area, reading the function definition from a text file (config.txt, auxiliary variables? ..), and anything else that will lead to a more elegant and comfortable application.
Hand in until: 28. 02. 2022
Basis: 8 points (for a simple but functional visualisation).
Bonus: up to 12 additional points for additional features (see above)
Visual Studio projects: 113function
Modify and hand in the source file: Graph.cs
As a comment in the first line, please include your name!
Copyright (C) 2010-2022 J. Pelikán & V. Tázlar, last change: 2022-02-02 01:03:41 +0100 (Wed, 02 Feb 2022)