mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-14 09:38:34 +05:00
Mantis 0054772: crash when select point in viewer inside created face
This commit is contained in:
parent
a3eca73f94
commit
46676347f2
@ -1089,17 +1089,17 @@ gp_Pnt GEOMUtils::ProjectPointOnFace(const gp_Pnt& thePoint,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
gp_Pnt GEOMUtils::ConvertClickToPoint( int x, int y, Handle(V3d_View) aView )
|
gp_Pnt GEOMUtils::ConvertClickToPoint( int x, int y, Handle(V3d_View) aView )
|
||||||
{
|
{
|
||||||
V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt;
|
// We can't rely on Eye and At points to get EyeDir, because they collapse
|
||||||
aView->Eye( XEye, YEye, ZEye );
|
// for views with flat bounding boxes. For example if you create a circle and
|
||||||
|
// switch to the top view, then both camera's Eye and At points will fall to zero
|
||||||
|
// inside V3d_View::FitMinMax() method. It's by occt design.
|
||||||
|
// So, we should use camera direction instead.
|
||||||
|
|
||||||
aView->At( XAt, YAt, ZAt );
|
V3d_Coordinate XAt, YAt, ZAt;
|
||||||
gp_Pnt EyePoint( XEye, YEye, ZEye );
|
aView->At(XAt, YAt, ZAt);
|
||||||
gp_Pnt AtPoint( XAt, YAt, ZAt );
|
gp_Pnt AtPoint(XAt, YAt, ZAt);
|
||||||
|
|
||||||
gp_Vec EyeVector( EyePoint, AtPoint );
|
gp_Pln PlaneOfTheView = gp_Pln( AtPoint, aView->Camera()->Direction() );
|
||||||
gp_Dir EyeDir( EyeVector );
|
|
||||||
|
|
||||||
gp_Pln PlaneOfTheView = gp_Pln( AtPoint, EyeDir );
|
|
||||||
Standard_Real X, Y, Z;
|
Standard_Real X, Y, Z;
|
||||||
aView->Convert( x, y, X, Y, Z );
|
aView->Convert( x, y, X, Y, Z );
|
||||||
gp_Pnt ConvertedPoint( X, Y, Z );
|
gp_Pnt ConvertedPoint( X, Y, Z );
|
||||||
|
Loading…
Reference in New Issue
Block a user