
Tue, 03/02/2010 - 19:46
Hi all!
I am looking for an explanation how to get the screen coordinates at which some 3D point will be displayed. (A more abstract description is: I have some imaginary 3D line, which is not displayed. Think of the screen representation of this line. I want to find the point on this line which is closest to the mouse pointer, assuming it was displayed.)
In the thread http://www.opencascade.org/org/forum/thread_2785/ I found the function ConvertToPlane that projects mouse coordinates into 3D space, and there into a specific plane to be more precise. For this purpose the View class offers the methods Convert() and Proj().
But how can I go the other direction? How do I project a 3D point onto the view plane and then convert it into mouse/screen coordinates? Are some methods available for this calculation?
Thanks
Jonas
Wed, 03/03/2010 - 09:27
The functionality you need can be found in the V3d-Package.
From the reference documentation:
V3d_View::Convert (const V3d_Coordinate Xv, const V3d_Coordinate Yv, Standard_Integer &Xp, Standard_Integer &Yp) const
Converts the point defined in the reference frame
of the projection plane into a point PIXEL.
Wed, 03/03/2010 - 13:58
Thank you very much! I should have had a closer look at the various methods of V3d_View.
Jonas
Wed, 03/03/2010 - 14:17
Well, OCC provides about 15k-20k different classes, so it is quite easy not to find what you are looking for. Thats what this forumis for: giving nudges in the rigth direction ;)