ContRap surfaces tutorial

This tutorial demonstrates how to use the OpenGL GLSurface class to create parametrized surfaces. The OpenGL library of ContRap supports parametrized surfaces with planar, cylindric and spheric parametrization domains. It is, of course, easy to define your own domains.

We start by loading the Qt plugin library.
load("qtopengl","qt");
Next, we create an instance of the Qt backend for OpenGL visualization.
v := QtGLWidget()

Planar surfaces


Let us create a planar surface. A planar surface is a surface, which is a real-valued function of a parametrization domain possibly isometrically transformed in space. Planar surfaces are basically defined by a function, which takes two doubles (or double-castable values) and returns a double.
f := function(x,y) 0.5*x^2*sin(x-y);
Now we are going to create the OpenGL primitive, which defines the surface. The 'cells' value defines the plotter resolution.
s := planarSurface(f;size=QSizeF(5.0,5.0),cells=30);
The surface has being copied on creation. You can now add the surface to the widget.
v:add(s)

Cylindric surfaces

Cylindric surfaces are defined within a coordinate system, which has the two parameters: height and alpha. The height desrcibes a "vertical" offset in the top direction and the angle describes a rotation around the "vertical"-axis.s
g := function(h,alpha) arcsin(alpha)*h;
We can now add a cylindric surface to our scene.
v:add(cylindricSurface(f;size=QSizeF(5.0,5.0),cells=30));

Advanced topics

The surfaces described above are only examples of a more general concept of two-dimensionally parametrized three-dimensionally vector-valued surfaces. Such a surface is a function defined over the real plane. Its domain is the three dimensional space.

Have a look at the documentation of the GLSurface class to design your own parametrizations.