For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

mouse vertex coordinates reported differ from one view to another

Venugopal Gudimetla's picture
Forums: 

Hi I create a vertex in Axo view using sample tutorial that comes with OCC. The vertex has coordinates (100.0, -60.0, 150.0).

I read through similar topics relating to Problem converting mouse point to 3d point conversion but couldn't get it to work:

http://www.opencascade.org/org/forum/thread_3185/
and
http://www.opencascade.org/org/forum/thread_15505/

The problem I am encountering with the below function which I have used to convert my mouse point to 3d point is that in Axo view, the converted 3d point when the above vertex is picked doesn't give me the above coordinates but a different set way different from (100.0, -60.0, 150.0). But in Front, Back, left and right views the coordinates of the vertex are reported correctly eg. (0, -60.0, 150). In Axo view the Z coordinate is not correct. Please help me understand why this is so and how can I get the correct coordinate in the Z direction in *Axo* view.

The function I used to convert mouse point tp 3d point is :

gp_Pnt ConvertClickToPoint(Standard_Real x, Standard_Real y, Handle(V3d_View) aView)
{

V3d_Coordinate XEye,YEye,ZEye,XAt,YAt,ZAt;
aView->Eye(XEye,YEye,ZEye);
aView->At(XAt,YAt,ZAt);
gp_Pnt EyePoint(XEye,YEye,ZEye);
gp_Pnt AtPoint(XAt,YAt,ZAt);

gp_Vec EyeVector(EyePoint,AtPoint);
gp_Dir EyeDir(EyeVector);

gp_Pln PlaneOfTheView = gp_Pln(AtPoint,EyeDir);
Standard_Real X,Y,Z;
aView->Convert(x,y,X,Y,Z);
gp_Pnt ConvertedPoint(X,Y,Z);
gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView,ConvertedPoint);

gp_Pnt ResultPoint = ElSLib::Value(ConvertedPointOnPlane.X(),
ConvertedPointOnPlane.Y(),
PlaneOfTheView);
return ResultPoint;
}

Thanks,
V
I am not able to proceed further...kindly help I just started learining OCC.