project/convert 3D points into screen coordinates?

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 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?


Tilman Leune's picture

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.

svensson's picture

Thank you very much! I should have had a closer look at the various methods of V3d_View.


Tilman Leune's picture

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 ;)