Elencu007

07-25-2013, 02:28 AM

Hello!

Is there a function which can return a vertex x, y, z coordinates if I use the mouse to select a specific vertex? I found a function which returns the x and y coordinates of the mouse, i.e. void glutMotionFunc(void (*func)(int x, int y)); but the x and y coordinates of the mouse aren't the same as the x and y coordinates of the vertex. More specific, I need to find this function in order to get a certain distance from the initial vertex to the final vertex position after I pull it using the mouse. Sorry if the post doesn't contain enough information, or information written in a basic language, but I am new to OpenGL and I am trying to learn as many things as possible. I have found a way to implement what I need, but using VTK functions, i.e. :

d[0]=this->MoveActor->GetPosition()[0]-Position[0];

d[1]=this->MoveActor->GetPosition()[1]-Position[1];

d[2]=this->MoveActor->GetPosition()[2]-Position[2];

where MoveActor->GetPosition()[0] is the x coordinate of the moved vertex, MoveActor->GetPosition()[1] is the y coordinate of the moved vertex etc. Position[0], [1], [2] are the initial vertex x,y and z coordinates, and d[0], [1], [2] are the distance's x, y and z coordinates.

Waiting for some help. Thanks a lot for your time, guys :).

Is there a function which can return a vertex x, y, z coordinates if I use the mouse to select a specific vertex? I found a function which returns the x and y coordinates of the mouse, i.e. void glutMotionFunc(void (*func)(int x, int y)); but the x and y coordinates of the mouse aren't the same as the x and y coordinates of the vertex. More specific, I need to find this function in order to get a certain distance from the initial vertex to the final vertex position after I pull it using the mouse. Sorry if the post doesn't contain enough information, or information written in a basic language, but I am new to OpenGL and I am trying to learn as many things as possible. I have found a way to implement what I need, but using VTK functions, i.e. :

d[0]=this->MoveActor->GetPosition()[0]-Position[0];

d[1]=this->MoveActor->GetPosition()[1]-Position[1];

d[2]=this->MoveActor->GetPosition()[2]-Position[2];

where MoveActor->GetPosition()[0] is the x coordinate of the moved vertex, MoveActor->GetPosition()[1] is the y coordinate of the moved vertex etc. Position[0], [1], [2] are the initial vertex x,y and z coordinates, and d[0], [1], [2] are the distance's x, y and z coordinates.

Waiting for some help. Thanks a lot for your time, guys :).