summaryrefslogtreecommitdiff
path: root/inc/IntStart_SearchOnBoundaries_2.gxx
blob: c70f70406a3d773d7add0d71e4cb614d2cb91b17 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <Precision.hxx>
//=======================================================================
//function : IntStart_SearchOnBoundaries::IntStart_SearchOnBoundaries
//purpose  : 
//=======================================================================
  IntStart_SearchOnBoundaries::IntStart_SearchOnBoundaries ()
:  done(Standard_False) 
{
}  

//=======================================================================
//function : Perform
//purpose  : 
//=======================================================================
  void IntStart_SearchOnBoundaries::Perform (TheFunction& Func,
					     const Handle(TheTopolTool)& Domain,
					     const Standard_Real TolBoundary,
					     const Standard_Real TolTangency) 
{
  
  done = Standard_False;
  spnt.Clear();
  sseg.Clear();

  Standard_Boolean Arcsol;
  Standard_Real PDeb,PFin, prm, tol;
  Standard_Integer i, nbknown, nbfound,index;
  gp_Pnt pt;
  
  Domain->Init();

  if (Domain->More()) {
    all  = Standard_True;
  }
  else {
    all = Standard_False;
  }

  while (Domain->More()) {
    TheArc A = Domain->Value();
    if (!TheSOBTool::HasBeenSeen(A)) {
      Func.Set(A);
      FindVertex(A,Domain,Func,spnt,TolBoundary);
      TheSOBTool::Bounds(A,PDeb,PFin);
      if(Precision::IsNegativeInfinite(PDeb) || 
	 Precision::IsPositiveInfinite(PFin)) { 

	InfiniteArc(A,Domain,PDeb,PFin,Func,spnt,sseg,
		    TolBoundary,TolTangency,Arcsol);
      }
      else { 
	BoundedArc(A,Domain,PDeb,PFin,Func,spnt,sseg,
		   TolBoundary,TolTangency,Arcsol);
      }
      all = (all && Arcsol);
    }
    
    else {
      // as it seems we'll never be here, because 
      // TheSOBTool::HasBeenSeen(A) always returns FALSE
      nbfound = spnt.Length();

      // On recupere les points connus
      nbknown = TheSOBTool::NbPoints(A);
      for (i=1; i<=nbknown; i++) {
	TheSOBTool::Value(A,i,pt,tol,prm);
	if (TheSOBTool::IsVertex(A,i)) {
	  TheVertex vtx;
	  TheSOBTool::Vertex(A,i,vtx);
	  spnt.Append(IntStart_ThePathPoint(pt,tol,vtx,A,prm));
	}
	else {
	  spnt.Append(IntStart_ThePathPoint(pt,tol,A,prm));
	}
      }
      // On recupere les arcs solutions
      nbknown = TheSOBTool::NbSegments(A);
      for (i=1; i<=nbknown; i++) {
	IntStart_TheSegment newseg;
	newseg.SetValue(A);
	if (TheSOBTool::HasFirstPoint(A,i,index)) {
	  newseg.SetLimitPoint(spnt.Value(nbfound+index),Standard_True);
	}
	if (TheSOBTool::HasLastPoint(A,i,index)) {
	  newseg.SetLimitPoint(spnt.Value(nbfound+index),Standard_False);
	}
	sseg.Append(newseg);
      }

      all = (all& TheSOBTool::IsAllSolution(A));
    }
    Domain->Next();
  }
  done = Standard_True;
}