Use NURBS in SharpGL

253 views Asked by At

I wrote a program to display some pressure-measurements. I want to use NURBS for a detail visualisation. So I orientated me to enter link description here

My field has a range of 40x48 squares. So 40 rows and 48 columns. The Z component(the height) should be variable.

But I don't understand how to define

glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, &ctrlpoints[0][0][0]);

// Parameter:
        //   target:
        //     What the control points represent (e.g. MAP2_VERTEX_3).
        //
        //   u1:
        //     Range of the variable 'u'.
        //
        //   u2:
        //     Range of the variable 'u.
        //
        //   ustride:
        //     Offset between beginning of one control point and the next.
        //
        //   uorder:
        //     The degree plus one.
        //
        //   v1:
        //     Range of the variable 'v'.
        //
        //   v2:
        //     Range of the variable 'v'.
        //
        //   vstride:
        //     Offset between beginning of one control point and the next.
        //
        //   vorder:
        //     The degree plus one.
        //
        //   points:
        //     The data for the points.

I don't know how to set the parameters in my case. For example what is u1 and u2? OR what are my ControlPoints?

1

There are 1 answers

0
leandro On

In this link you can find a more detailed description of the parameters:

https://msdn.microsoft.com/en-us/library/windows/desktop/ee872053(v=vs.85).aspx

In your surface X direction is given by u-coordinate and Y direction is given by v-coordinate. It is common to set u1-u2 and v1-v2 to the [0,1] interval.

The order of the surface is interpolated between points (you can do linear interpolation with order=1, quadratic interpolation with order=2 and so on. 2 or 3 should be ok for your needs.

With this said, I am afraid that the method "glMap2f" will not accurately represent your data as in general the "control points" are not on the surface itself (as shown in the following image)

You have to look for an algorithm to interpolate a nurbs surface from a point cloud, and then use glMap2f with the control points calculated.

If you want to know more about Nurbs, look for "The Nurbs book" from L. Piegl