mouse pointer to 3d point

Hi,

I'm trying to convert the mouse coordinates into 3d world coardinates. I have checked all the topics on the forum regarding to this area, but neither solution is working correctly in my case. I would like to compute the coordinates of a point - pointed by the mouse - on a given plane. For example the plane is gp_Pln(gp_Pnt(0,0,0), gp_Dir(0,1,0)) - the xz plane through the origo - and I would like to get the coordinates pointed by the mouse on this plane.

I tried the following:
- get the coordinates on the projection plane with v3d_View::Convert
- created a line through the eye point the the point on the projection plane
- computed the intersection of this line and the xz plane.

but the results are totally wrong.
Does anyone have any idea what's wrong in this logic?

Thanks in advance,

Tamas Meszaros

P Dolbey's picture

I've placed the routine I was given in training materials from Matra in

http://www.opencascade.org/org/forum/thread_2785/

Pete

P Dolbey's picture

... note you can change the line
gp_Pln aPlane(myView->Viewer()->PrivilegedPlane());
to
gp_Pln aPlane(gp_Pnt(0,0,0), gp_Dir(0,1,0));
to get the effect you want.

mesztam's picture

Thank's a lot for Your help. It works.

Tamas

P Dolbey's picture

Thank goodness something does!

Pete