0023022: This is desirable to access OpenGl extensions and core API (1.2+) in one...
[occt.git] / src / IntCurve / IntCurve_ProjPCurGen.gxx
1 // File:        IntCurve_ProjPCurGen.gxx
2 // Created:     Tue Oct 13 18:50:18 1992
3 // Author:      Laurent BUCHARD
4 //              <lbr@sdsun2>
5
6
7 #include <Extrema_POnCurv2d.hxx>
8
9 Standard_Real IntCurve_ProjPCurGen::FindParameter 
10   (const TheCurve& C,
11    const gp_Pnt2d& P,
12    const Standard_Real LowParameter,
13    const Standard_Real HighParameter,
14    const Standard_Real) 
15 {
16   Standard_Real theparam,defaultparam;
17   Standard_Integer NbPts = TheCurveTool::NbSamples(C);
18   Standard_Real theEpsX  = TheCurveTool::EpsX(C);
19   Extrema_POnCurv2d POnC;
20   
21   IntCurve_TheCurveLocator::Locate(P,C,NbPts,LowParameter,HighParameter,POnC);
22   defaultparam = POnC.Parameter();
23   IntCurve_TheLocateExtPC Loc(P,C,defaultparam,theEpsX);
24
25   if(Loc.IsDone() == Standard_False) {
26     //-- cout<<"\n Erreur dans LocateExtPC "<<endl;
27     theparam = defaultparam;
28   }
29   else {
30     if(Loc.IsMin() == Standard_False) { 
31       //-- cout<<"\n Erreur dans LocateExtPC (Maximum trouve) "<<endl;
32       theparam = defaultparam;
33     }
34     else {
35       theparam = Loc.Point().Parameter();
36     }
37   }
38   return theparam;
39 }
40
41
42 Standard_Real IntCurve_ProjPCurGen::FindParameter
43   (const TheCurve& C,
44    const gp_Pnt2d& P,
45    const Standard_Real Tol) 
46 {
47
48   Standard_Real theParam;
49   theParam = FindParameter( C
50                            ,P
51                            ,TheCurveTool::FirstParameter(C)
52                            ,TheCurveTool::LastParameter(C)
53                            ,Tol);
54   return theParam;
55 }
56
57
58
59