I am using OpenGL to create a nurbs surface (gluNurbSurface(...)) and I would like to know how reach the normal value to the control points(black dot) to the surface market as a red dot. With this information I will be able to calculate the distance between them.
我正在使用OpenGL创建一个nurbs曲面(gluNurbSurface(…)),我想知道如何将控制点(黑点)作为一个红点到达曲面市场。有了这些信息,我就能计算出它们之间的距离。
Added In order to get another answers or improve the subjected I would like to write part of the code, I hope can get more help:
为了得到另一个答案或改进我想写的部分代码的被试,我希望能得到更多的帮助:
In this part you can observe how I initialize the nurbs.
在这一部分中,您可以观察我如何初始化nurbs。
init_surface();
theNurb = gluNewNurbsRenderer();
gluNurbsProperty(theNurb, GLU_SAMPLING_TOLERANCE, 50.0);
gluNurbsProperty(theNurb, GLU_DISPLAY_MODE, GLU_FILL);
gluNurbsCallback(theNurb, GLU_ERROR,
(GLvoid (*)()) nurbsError);
Next the surface is created with their parameters.
接下来,使用它们的参数创建表面。
gluBeginSurface(theNurb);
gluNurbsSurface(theNurb,
U+ordenU, knotsU,
V+ordenV, knotsV,
V * 3,
3,
&ctlpoints[0][0][0],
ordenU, ordenV,
GL_MAP2_VERTEX_3);
gluEndSurface(theNurb);
Remember I am using C. And in this moment I am trying to introduce the values of the nurbs into a vector with the function proposed by genpfault in the first answer but I do not know in which part I have to add them.
记住,我用的是c,在这一刻,我试图把nurbs的值引入到一个向量中,第一个答案是由genpfault提出的函数,但是我不知道我要在哪一部分添加它们。
1 个解决方案
#1
2
Set a GLU_NURBS_NORMAL_DATA
callback via gluNurbsCallback()
. A GLU_NURBS_VERTEX_DATA
callback would also be useful.
通过gluNurbsCallback()设置GLU_NURBS_NORMAL_DATA回调。GLU_NURBS_VERTEX_DATA回调也很有用。
Point *userData
(via gluNurbsCallbackData()
) at some sort of dynamic array data-structure to hold the points/normals. If you were using C++ I'd recommend a std::vector
of Eigen::Vector3f
s.
点*userData(通过gluNurbsCallbackData())在某种动态数组数据结构上保存点/法线。如果您正在使用c++,我建议您使用std::: Eigen::Vector3fs的向量。
#1
2
Set a GLU_NURBS_NORMAL_DATA
callback via gluNurbsCallback()
. A GLU_NURBS_VERTEX_DATA
callback would also be useful.
通过gluNurbsCallback()设置GLU_NURBS_NORMAL_DATA回调。GLU_NURBS_VERTEX_DATA回调也很有用。
Point *userData
(via gluNurbsCallbackData()
) at some sort of dynamic array data-structure to hold the points/normals. If you were using C++ I'd recommend a std::vector
of Eigen::Vector3f
s.
点*userData(通过gluNurbsCallbackData())在某种动态数组数据结构上保存点/法线。如果您正在使用c++,我建议您使用std::: Eigen::Vector3fs的向量。