- Handle(Geom_Point) aPStart;
- Handle(Geom_Point) aPEnd;
- aLine->Points( aPStart, aPEnd );
- aPnt1 = aPStart->Pnt();
- aPnt2 = aPEnd->Pnt();
- isFound = hasProjectPointOnCurve( theX, theY, aGLine, aPoint );
+ isFound = hasProjectPointOnCurve( theX, theY, aGLine, aParameter );
+ if ( isFound ) {
+ aPoint = aGLine->Value( aParameter );
+
+ Handle(Geom_Point) aPStart;
+ Handle(Geom_Point) aPEnd;
+ aLine->Points( aPStart, aPEnd );
+ aPnt1 = aPStart->Pnt();
+ aPnt2 = aPEnd->Pnt();
+
+ // in case of Geom line a projection is performed to the infinite line,
+ // so it is necessary to bound it by the line size
+ Bnd_Box aLineBox;
+ aLineBox.Set( aPnt1, gp_Vec( aPnt1, aPnt2 ) );
+ isFound = !aLineBox.IsOut( aPoint );
+ }