summaryrefslogtreecommitdiff
path: root/inc/IntCurve_ProjPCurGen.gxx
blob: ad9c2cd78395fdc4c378125e09717ed95b5b0ae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// File:	IntCurve_ProjPCurGen.gxx
// Created:	Tue Oct 13 18:50:18 1992
// Author:	Laurent BUCHARD
//		<lbr@sdsun2>


#include <Extrema_POnCurv2d.hxx>

Standard_Real IntCurve_ProjPCurGen::FindParameter 
  (const TheCurve& C,
   const gp_Pnt2d& P,
   const Standard_Real LowParameter,
   const Standard_Real HighParameter,
   const Standard_Real) 
{
  Standard_Real theparam,defaultparam;
  Standard_Integer NbPts = TheCurveTool::NbSamples(C);
  Standard_Real theEpsX  = TheCurveTool::EpsX(C);
  Extrema_POnCurv2d POnC;
  
  IntCurve_TheCurveLocator::Locate(P,C,NbPts,LowParameter,HighParameter,POnC);
  defaultparam = POnC.Parameter();
  IntCurve_TheLocateExtPC Loc(P,C,defaultparam,theEpsX);

  if(Loc.IsDone() == Standard_False) {
    //-- cout<<"\n Erreur dans LocateExtPC "<<endl;
    theparam = defaultparam;
  }
  else {
    if(Loc.IsMin() == Standard_False) { 
      //-- cout<<"\n Erreur dans LocateExtPC (Maximum trouve) "<<endl;
      theparam = defaultparam;
    }
    else {
      theparam = Loc.Point().Parameter();
    }
  }
  return theparam;
}


Standard_Real IntCurve_ProjPCurGen::FindParameter
  (const TheCurve& C,
   const gp_Pnt2d& P,
   const Standard_Real Tol) 
{

  Standard_Real theParam;
  theParam = FindParameter( C
			   ,P
			   ,TheCurveTool::FirstParameter(C)
			   ,TheCurveTool::LastParameter(C)
			   ,Tol);
  return theParam;
}