在SharpGL中使用NURBS
问题描述:
我编写了一个程序来显示一些压力测量结果。我想使用NURBS进行细节可视化。所以我将其定位于 enter link description here在SharpGL中使用NURBS
我的领域有40x48方格的范围。所以40行48列。 Z分量(高度)应该是可变的。
但我不明白如何定义
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.
我不知道如何设置参数在我的情况。 例如u1和u2是什么?或者我的ControlPoints是什么?
答
在这个环节,你可以找到这些参数的详细描述:
https://msdn.microsoft.com/en-us/library/windows/desktop/ee872053(v=vs.85).aspx
在你面X方向由下式给出的u-坐标和Y方向由下式给出v座标。通常将u1-u2和v1-v2设置为[0,1]间隔。
表面的顺序点之间内插(可以执行线性内插与顺序= 1,用顺序二次插值= 2等。2或3应当为您的需求是好的。
有了这个说,恐怕“glMap2f”方法不能准确地代表你的数据,因为通常“控制点”不在表面上(如下图所示)
你必须寻找一个算法从点云内插一个nurbs曲面,然后使用glMap2f和计算出的控制点。
如果你想了解更多关于Nurbs的信息,请查看L. Piegl的“The Nurbs book”