1 // File: PartSet_Tools.h
2 // Created: 28 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #include <PartSet_Tools.h>
7 #include <V3d_View.hxx>
16 gp_Pnt PartSet_Tools::ConvertClickToPoint(QPoint thePoint, Handle(V3d_View) theView)
18 V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt;
19 theView->Eye( XEye, YEye, ZEye );
21 theView->At( XAt, YAt, ZAt );
22 gp_Pnt EyePoint( XEye, YEye, ZEye );
23 gp_Pnt AtPoint( XAt, YAt, ZAt );
25 gp_Vec EyeVector( EyePoint, AtPoint );
26 gp_Dir EyeDir( EyeVector );
28 gp_Pln PlaneOfTheView = gp_Pln( AtPoint, EyeDir );
29 Standard_Real X, Y, Z;
30 theView->Convert( thePoint.x(), thePoint.y(), X, Y, Z );
31 gp_Pnt ConvertedPoint( X, Y, Z );
33 gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project( PlaneOfTheView, ConvertedPoint );
34 gp_Pnt ResultPoint = ElSLib::Value( ConvertedPointOnPlane.X(), ConvertedPointOnPlane.Y(), PlaneOfTheView );