How to find out the position of a certain value using Nurbs with OpenGL?

I use OpenGL to create a nurbs surface (gluNurbSurface (...)), and I would like to know how to reach the normal value for control points (black dot) in the surface market as a red dot. Using this information, I can calculate the distance between them.

Nurbs

Added To get other answers or improve the actions taken, I would like to write a piece of code, I hope this can help you:

In this part, you can watch me initialize 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 that I am using C. And at this point I am trying to inject nurbs values โ€‹โ€‹into a vector with the function suggested by genpfault in the first answer, but I donโ€™t know in which part I should add.

+4
source share
1 answer

Set the GLU_NURBS_NORMAL_DATA via gluNurbsCallback() . A callback to GLU_NURBS_VERTEX_DATA will also be useful.

Point *userData (via gluNurbsCallbackData() ) in some data structure of a dynamic array for storing points / normals. If you used C ++, I would recommend std::vector from Eigen::Vector3f s.

+2
source

All Articles