0028895: Visualization, V3d_View::SetComputedMode() - HLR calculation is performed...
[occt.git] / samples / mfc / standard / 04_Viewer3d / src / ConvertClickToPoint.cxx
CommitLineData
7fd59977 1#include <stdafx.h>
2
3gp_Pnt ConvertClickToPoint(Standard_Real x, Standard_Real y, Handle(V3d_View) aView)
4{
5
ee2be2a8 6 Standard_Real XEye,YEye,ZEye,XAt,YAt,ZAt;
7fd59977 7 aView->Eye(XEye,YEye,ZEye);
8 aView->At(XAt,YAt,ZAt);
9 gp_Pnt EyePoint(XEye,YEye,ZEye);
10 gp_Pnt AtPoint(XAt,YAt,ZAt);
11
12 gp_Vec EyeVector(EyePoint,AtPoint);
13 gp_Dir EyeDir(EyeVector);
14
15 gp_Pln PlaneOfTheView = gp_Pln(AtPoint,EyeDir);
16 Standard_Real X,Y,Z;
17 aView->Convert((int)x,(int)y,X,Y,Z);
18 gp_Pnt ConvertedPoint(X,Y,Z);
19 gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView,ConvertedPoint);
20
21 gp_Pnt ResultPoint = ElSLib::Value(ConvertedPointOnPlane.X(),
22 ConvertedPointOnPlane.Y(),
23 PlaneOfTheView);
24 return ResultPoint;
25}
26
27