1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 Blend_CSWalking::Blend_CSWalking(const TheCurve& Curv,
16 const TheSurface& Surf,
17 const Handle(TheTopolTool)& Domain):
18 done(Standard_False),surf(Surf),
26 void Blend_CSWalking::Perform(Blend_CSFunction& Func,
27 // Blend_CSFuncInv& FuncInv,
28 const Standard_Real Pdep,
29 const Standard_Real Pmax,
30 const Standard_Real MaxStep,
31 const Standard_Real TolGuide,
32 const math_Vector& ParDep,
33 const Standard_Real Tolesp,
34 const Standard_Real Fleche,
35 const Standard_Boolean Appro)
38 done = Standard_False;
39 iscomplete = Standard_False;
40 comptra = Standard_False;
41 line = new TheLine ();
42 Standard_Integer Nbvar = Func.NbVariables();
44 tolgui = Abs(TolGuide);
46 rebrou = Standard_False;
47 pasmax = Abs(MaxStep);
48 math_Vector sol(1,Nbvar);
50 firstsol = new TColStd_HArray1OfReal(1,Nbvar);
52 if (Pmax-Pdep >= 0.) {
60 TheExtremity ptf1,ptf2;
69 // math_Vector tolerance(1,3),infbound(1,3),supbound(1,3);
70 math_Vector tolerance(1,Nbvar),infbound(1,Nbvar),supbound(1,Nbvar);
71 Func.GetTolerance(tolerance,tolesp);
72 Func.GetBounds(infbound,supbound);
73 math_FunctionSetRoot rsnld(Func,tolerance,30);
75 rsnld.Perform(Func,ParDep,infbound,supbound);
77 if (!rsnld.IsDone()) {
82 // situ1 = TheTopolTool::Classify(surf1,gp_Pnt2d(sol(1),sol(2)),
83 // Max(tolerance(1),tolerance(2)));
84 // situ2 = TheTopolTool::Classify(surf2,gp_Pnt2d(sol(3),sol(4)),
85 // Max(tolerance(3),tolerance(4)));
87 situ = domain->Classify(gp_Pnt2d(sol(1),sol(2)),
88 Min(tolerance(1),tolerance(2)));
90 situ = domain->Classify(Func.Pnt2d(),
91 Min(tolerance(1),tolerance(2)));
93 if (situ != TopAbs_IN ) {
101 for (Standard_Integer i=1; i<= Nbvar; i++) {
102 firstsol->ChangeValue(i) = sol(i);
104 State = TestArret(Func,sol,Standard_False,Blend_OK);
105 if (State!=Blend_OK) {
109 if (Blend_GettraceDRAWSECT()){
110 Drawsect(surf,curv,param,Func);
113 // Mettre a jour la ligne.
114 line->Append(previousP);
116 previousP.ParametersOnS(U,V);
117 W = previousP.ParameterOnC();
118 TheExtremity P1(previousP.PointOnS(),U,V,previousP.Parameter(),tolesp);
119 TheExtremity P2(previousP.PointOnC(),W,previousP.Parameter(),tolesp);
121 line->SetStartPoints(P1,P2);
124 line->SetEndPoints(P1,P2);
127 // InternalPerform(Func,FuncInv,Pmax);
128 InternalPerform(Func,sol,Pmax);
130 done = Standard_True;
135 Standard_Boolean Blend_CSWalking::Complete(Blend_CSFunction& Func,
136 // Blend_CSFuncInv& FuncInv,
137 const Standard_Real Pmin)
139 if (!done) {throw StdFail_NotDone();}
140 if (iscomplete) {return Standard_True;}
144 previousP = line->Point(1);
147 previousP = line->Point(line->NbPoints());
153 param = previousP.Parameter();
154 previousP.ParametersOnS(sol(1),sol(2));
155 sol(3) = previousP.ParameterOnC();
157 Standard_Integer Nbvar = Func.NbVariables();
158 math_Vector sol(1,Nbvar);
159 for (Standard_Integer i =1; i<= Nbvar; i++) {
160 sol(i) = firstsol->Value(i);
165 // InternalPerform(Func,FuncInv,Pmin);
166 InternalPerform(Func,sol,Pmin);
169 iscomplete = Standard_True;
170 return Standard_True;