b311480e |
1 | // Created on: 1994-10-25 |
2 | // Created by: Laurent BOURESCHE |
3 | // Copyright (c) 1994-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
b311480e |
16 | |
7fd59977 |
17 | // modif : jlr branchement F(t) pour Edge/Face |
7fd59977 |
18 | // Modified by skv - Wed Jun 9 17:16:26 2004 OCC5898 |
19 | // modified by Edward AGAPOV (eap) Fri Feb 8 2002 (bug occ67 == BUC61052) |
20 | // ComputeData(), case where BRepBlend_Walking::Continu() can't get up to Target |
21 | |
c22b52d6 |
22 | #include <Adaptor2d_Curve2d.hxx> |
42cf5bc1 |
23 | #include <Blend_CurvPointFuncInv.hxx> |
42cf5bc1 |
24 | #include <Blend_RstRstFunction.hxx> |
25 | #include <Blend_SurfCurvFuncInv.hxx> |
26 | #include <Blend_SurfPointFuncInv.hxx> |
27 | #include <Blend_SurfRstFunction.hxx> |
7fd59977 |
28 | #include <BRepBlend_AppFunc.hxx> |
29 | #include <BRepBlend_AppFuncRst.hxx> |
30 | #include <BRepBlend_AppFuncRstRst.hxx> |
42cf5bc1 |
31 | #include <BRepBlend_AppSurf.hxx> |
32 | #include <BRepBlend_AppSurface.hxx> |
7fd59977 |
33 | #include <BRepBlend_ConstRad.hxx> |
34 | #include <BRepBlend_ConstRadInv.hxx> |
42cf5bc1 |
35 | #include <BRepBlend_CSWalking.hxx> |
42cf5bc1 |
36 | #include <BRepBlend_Line.hxx> |
42cf5bc1 |
37 | #include <BRepBlend_RstRstLineBuilder.hxx> |
38 | #include <BRepBlend_SurfRstLineBuilder.hxx> |
39 | #include <BRepBlend_Walking.hxx> |
40 | #include <BRepTopAdaptor_HVertex.hxx> |
41 | #include <BRepTopAdaptor_TopolTool.hxx> |
42 | #include <BSplCLib.hxx> |
43 | #include <ChFi3d_Builder.hxx> |
44 | #include <ChFi3d_Builder_0.hxx> |
7fd59977 |
45 | #include <ChFiDS_CommonPoint.hxx> |
42cf5bc1 |
46 | #include <ChFiDS_FaceInterference.hxx> |
c22b52d6 |
47 | #include <ChFiDS_ElSpine.hxx> |
42cf5bc1 |
48 | #include <ChFiDS_Spine.hxx> |
42cf5bc1 |
49 | #include <ChFiDS_SurfData.hxx> |
50 | #include <Geom2d_BSplineCurve.hxx> |
51 | #include <Geom2d_Curve.hxx> |
52 | #include <Geom2d_Line.hxx> |
53 | #include <Geom2d_TrimmedCurve.hxx> |
54 | #include <Geom2dAPI_ProjectPointOnCurve.hxx> |
55 | #include <Geom2dInt_GInter.hxx> |
56 | #include <Geom_BSplineSurface.hxx> |
57 | #include <Geom_Curve.hxx> |
58 | #include <Geom_Surface.hxx> |
c22b52d6 |
59 | #include <GeomAdaptor_Curve.hxx> |
42cf5bc1 |
60 | #include <GeomLib.hxx> |
61 | #include <gp_Dir2d.hxx> |
62 | #include <gp_Pnt.hxx> |
63 | #include <gp_Pnt2d.hxx> |
64 | #include <gp_Vec.hxx> |
65 | #include <gp_Vec2d.hxx> |
66 | #include <IntRes2d_IntersectionPoint.hxx> |
67 | #include <math_Vector.hxx> |
68 | #include <Precision.hxx> |
7fd59977 |
69 | #include <TopExp.hxx> |
42cf5bc1 |
70 | #include <TopoDS_Edge.hxx> |
71 | #include <TopoDS_Face.hxx> |
72 | #include <TopoDS_Shape.hxx> |
73 | #include <TopoDS_Vertex.hxx> |
74 | #include <TopOpeBRepBuild_HBuilder.hxx> |
75 | #include <TopOpeBRepDS_Curve.hxx> |
76 | #include <TopOpeBRepDS_DataStructure.hxx> |
77 | #include <TopOpeBRepDS_HDataStructure.hxx> |
78 | #include <TopOpeBRepDS_Surface.hxx> |
42cf5bc1 |
79 | #include <TopTools_ListOfShape.hxx> |
7fd59977 |
80 | |
42cf5bc1 |
81 | #include <stdio.h> |
7fd59977 |
82 | |
83 | //#define DRAW |
84 | |
85 | #ifdef DRAW |
86 | #include <Draw_Appli.hxx> |
87 | #include <Draw_Segment2D.hxx> |
88 | #include <Draw_Marker2D.hxx> |
89 | #include <Draw_Segment3D.hxx> |
90 | #include <Draw_Marker3D.hxx> |
91 | #include <Draw.hxx> |
92 | #include <DrawTrSurf.hxx> |
c22b52d6 |
93 | #include <BRepAdaptor_Surface.hxx> |
7fd59977 |
94 | static Standard_Integer IndexOfConge = 0; |
95 | #endif |
96 | |
0797d9d3 |
97 | #ifdef OCCT_DEBUG |
7fd59977 |
98 | extern Standard_Boolean ChFi3d_GettraceDRAWFIL(); |
99 | extern Standard_Boolean ChFi3d_GettraceDRAWWALK(); |
100 | extern Standard_Boolean ChFi3d_GetcontextNOOPT(); |
101 | extern void ChFi3d_SettraceDRAWFIL(const Standard_Boolean b); |
102 | extern void ChFi3d_SettraceDRAWWALK(const Standard_Boolean b); |
103 | extern void ChFi3d_SetcontextNOOPT(const Standard_Boolean b); |
104 | #endif |
105 | |
106 | #ifdef DRAW |
107 | static void drawline(const Handle(BRepBlend_Line)& lin, |
108 | const Standard_Boolean iscs) |
109 | { |
110 | Handle(Draw_Marker3D) p3d; |
111 | Handle(Draw_Marker2D) p2d; |
112 | Handle(Draw_Segment3D) tg3d; |
113 | Handle(Draw_Segment2D) tg2d; |
114 | |
115 | for(Standard_Integer i = 1; i <= lin->NbPoints(); i++){ |
116 | const Blend_Point& pt = lin->Point(i); |
117 | gp_Pnt point = pt.PointOnS1(); |
118 | gp_Pnt extr = point.Translated(pt.TangentOnS1()); |
119 | p3d = new Draw_Marker3D(point,Draw_Square,Draw_rouge); |
120 | dout<<p3d; |
121 | tg3d = new Draw_Segment3D(point,extr,Draw_rouge); |
122 | dout<<tg3d; |
123 | point = pt.PointOnS2(); |
124 | extr = point.Translated(pt.TangentOnS2()); |
125 | p3d = new Draw_Marker3D(point,Draw_Plus,Draw_jaune); |
126 | dout<<p3d; |
127 | tg3d = new Draw_Segment3D(point,extr,Draw_jaune); |
128 | dout<<tg3d; |
129 | |
130 | Standard_Real u,v; |
131 | pt.ParametersOnS1(u,v); |
132 | gp_Pnt2d point2d(u,v); |
133 | gp_Pnt2d extr2d = point2d.Translated(pt.Tangent2dOnS1()); |
134 | p2d = new Draw_Marker2D(point2d,Draw_Square,Draw_rouge); |
135 | dout<<p2d; |
136 | tg2d = new Draw_Segment2D(point2d,extr2d,Draw_rouge); |
137 | dout<<tg2d; |
138 | pt.ParametersOnS2(u,v); |
139 | point2d.SetCoord(u,v); |
140 | extr2d = point2d.Translated(pt.Tangent2dOnS2()); |
141 | p2d = new Draw_Marker2D(point2d,Draw_Plus,Draw_jaune); |
142 | dout<<p2d; |
143 | tg2d = new Draw_Segment2D(point2d,extr2d,Draw_jaune); |
144 | dout<<tg2d; |
145 | dout.Flush(); |
146 | } |
147 | } |
148 | #endif |
149 | //======================================================================= |
150 | //function : SearchIndex |
151 | //purpose : |
152 | // |
153 | //======================================================================= |
154 | static Standard_Integer SearchIndex(const Standard_Real Value, |
155 | Handle(BRepBlend_Line)& Lin) |
156 | { |
157 | Standard_Integer NbPnt = Lin->NbPoints(), Ind; |
158 | |
159 | for (Ind = 1; |
160 | (Ind < NbPnt) && (Lin->Point(Ind).Parameter() < Value); ) |
161 | Ind++; |
162 | return Ind; |
163 | } |
164 | |
165 | |
166 | //======================================================================= |
167 | //function : IsObst |
168 | //purpose : |
169 | // |
170 | //======================================================================= |
171 | static Standard_Integer nbedconnex(const TopTools_ListOfShape& L) |
172 | { |
173 | Standard_Integer nb = 0, i = 0; |
174 | TopTools_ListIteratorOfListOfShape It1(L); |
175 | for(;It1.More();It1.Next(),i++){ |
176 | const TopoDS_Shape& curs = It1.Value(); |
177 | Standard_Boolean dejavu = 0; |
178 | TopTools_ListIteratorOfListOfShape It2(L); |
179 | for(Standard_Integer j = 0; j < i && It2.More(); j++, It2.Next()){ |
180 | if(curs.IsSame(It2.Value())){ |
181 | dejavu = 1; |
182 | break; |
183 | } |
184 | } |
185 | if(!dejavu) nb++; |
186 | } |
187 | return nb; |
188 | } |
189 | |
190 | static Standard_Boolean IsVois(const TopoDS_Edge& E, |
191 | const TopoDS_Vertex& Vref, |
192 | const ChFiDS_Map& VEMap, |
193 | TopTools_MapOfShape& DONE, |
194 | const Standard_Integer prof, |
195 | const Standard_Integer profmax) |
196 | { |
197 | if(prof > profmax) return Standard_False; |
198 | if(DONE.Contains(E)) return Standard_False; |
199 | TopoDS_Vertex V1,V2; |
200 | TopExp::Vertices(E,V1,V2); |
201 | if(Vref.IsSame(V1) || Vref.IsSame(V2)) return Standard_True; |
202 | DONE.Add(E); |
203 | const TopTools_ListOfShape& L1 = VEMap(V1); |
204 | Standard_Integer i1 = nbedconnex(L1); |
205 | TopTools_ListIteratorOfListOfShape It1(L1); |
206 | for(;It1.More();It1.Next()){ |
207 | const TopoDS_Edge& curE = TopoDS::Edge(It1.Value()); |
208 | if(i1 <= 2){ |
209 | if(IsVois(curE,Vref,VEMap,DONE,prof,profmax)) return Standard_True; |
210 | } |
211 | else if(IsVois(curE,Vref,VEMap,DONE,prof+1,profmax)) return Standard_True; |
212 | } |
213 | const TopTools_ListOfShape& L2 = VEMap(V2); |
0797d9d3 |
214 | #ifdef OCCT_DEBUG |
7fd59977 |
215 | // Standard_Integer i2 = nbedconnex(L2); |
216 | #endif |
217 | TopTools_ListIteratorOfListOfShape It2(L2); |
218 | for(;It2.More();It2.Next()){ |
219 | const TopoDS_Edge& curE = TopoDS::Edge(It2.Value()); |
220 | if(i1 <= 2){ |
221 | if(IsVois(curE,Vref,VEMap,DONE,prof,profmax)) return Standard_True; |
222 | } |
223 | else if(IsVois(curE,Vref,VEMap,DONE,prof+1,profmax)) return Standard_True; |
224 | } |
225 | return Standard_False; |
226 | } |
227 | |
228 | static Standard_Boolean IsObst(const ChFiDS_CommonPoint& CP, |
229 | const TopoDS_Vertex& Vref, |
230 | const ChFiDS_Map& VEMap) |
231 | { |
232 | if(!CP.IsOnArc()) return Standard_False; |
233 | const TopoDS_Edge& E = CP.Arc(); |
234 | TopTools_MapOfShape DONE; |
235 | Standard_Integer prof = 4; |
236 | return !IsVois(E,Vref,VEMap,DONE,0,prof); |
237 | } |
238 | |
239 | //======================================================================= |
240 | //function : CompParam |
241 | //purpose : |
242 | // |
243 | //======================================================================= |
244 | |
b2fedee6 |
245 | static void CompParam(const Geom2dAdaptor_Curve& Carc, |
7fd59977 |
246 | Handle(Geom2d_Curve) Ctg, |
247 | Standard_Real& parc, |
248 | Standard_Real& ptg, |
249 | const Standard_Real prefarc, |
250 | const Standard_Real preftg) |
251 | { |
252 | Standard_Boolean found = 0; |
81bba717 |
253 | //(1) It is checked if the provided parameters are good |
254 | // if pcurves have the same parameters as the spine. |
7fd59977 |
255 | gp_Pnt2d point = Carc.Value(prefarc); |
256 | Standard_Real distini = point.Distance(Ctg->Value(preftg)); |
257 | if (distini <= Precision::PConfusion()) { |
258 | parc = prefarc; |
259 | ptg = preftg; |
260 | found = Standard_True; |
261 | } |
262 | else { |
81bba717 |
263 | //(2) Intersection |
0797d9d3 |
264 | #ifdef OCCT_DEBUG |
04232180 |
265 | std::cout<< "CompParam : bad intersection parameters"<<std::endl; |
7fd59977 |
266 | #endif |
267 | IntRes2d_IntersectionPoint int2d; |
268 | Geom2dInt_GInter Intersection; |
269 | Standard_Integer nbpt,nbseg; |
270 | Intersection.Perform(Geom2dAdaptor_Curve(Ctg),Carc, |
271 | Precision::PIntersection(), |
272 | Precision::PIntersection()); |
273 | |
274 | Standard_Real dist = Precision::Infinite(), p1, p2; |
275 | if (Intersection.IsDone()){ |
276 | if (!Intersection.IsEmpty()){ |
277 | nbseg = Intersection.NbSegments(); |
278 | if ( nbseg > 0 ){ |
0797d9d3 |
279 | #ifdef OCCT_DEBUG |
04232180 |
280 | std::cout<< "segments of intersection on the restrictions"<<std::endl; |
7fd59977 |
281 | #endif |
282 | } |
283 | nbpt = Intersection.NbPoints(); |
284 | for (Standard_Integer i = 1; i <= nbpt; i++) { |
285 | int2d = Intersection.Point(i); |
286 | p1 = int2d.ParamOnFirst(); |
287 | p2 = int2d.ParamOnSecond(); |
288 | if(Abs(prefarc - p2) < dist){ |
289 | ptg = p1; |
290 | parc = p2; |
291 | dist = Abs(prefarc - p2); |
292 | found = 1; |
293 | } |
294 | } |
295 | } |
296 | } |
297 | } |
298 | |
299 | if(!found){ |
81bba717 |
300 | // (3) Projection... |
0797d9d3 |
301 | #ifdef OCCT_DEBUG |
04232180 |
302 | std::cout<<"CompParam : failed intersection PC, projection is created."<<std::endl; |
7fd59977 |
303 | #endif |
304 | parc = prefarc; |
305 | Geom2dAPI_ProjectPointOnCurve projector(point,Ctg); |
306 | |
307 | if(projector.NbPoints() == 0){ |
81bba717 |
308 | // This happens in some cases when there is a vertex |
309 | // at the end of spine... |
7fd59977 |
310 | ptg = preftg; |
0797d9d3 |
311 | #ifdef OCCT_DEBUG |
04232180 |
312 | std::cout<<"CompParam : failed proj p2d/c2d, the extremity is taken!" <<std::endl; |
7fd59977 |
313 | #endif |
314 | } |
315 | else { |
81bba717 |
316 | // It is checked if everything was calculated correctly (EDC402 C2) |
7fd59977 |
317 | if (projector.LowerDistance() < distini) |
318 | ptg = projector.LowerDistanceParameter(); |
319 | else ptg = preftg; |
320 | } |
321 | } |
322 | } |
323 | |
324 | //======================================================================= |
325 | //function : CompBlendPoint |
81bba717 |
326 | //purpose : create BlendPoint corresponding to a tangency on Vertex |
327 | // pmn : 15/10/1997 : returns false, if there is no pcurve |
7fd59977 |
328 | //======================================================================= |
329 | |
330 | static Standard_Boolean CompBlendPoint(const TopoDS_Vertex& V, |
331 | const TopoDS_Edge& E, |
332 | const Standard_Real W, |
b2fedee6 |
333 | const TopoDS_Face& F1, |
334 | const TopoDS_Face& F2, |
7fd59977 |
335 | Blend_Point& BP) |
336 | { |
337 | gp_Pnt2d P1, P2; |
338 | gp_Pnt P3d; |
339 | Standard_Real param, f, l; |
340 | Handle(Geom2d_Curve) pc; |
341 | |
342 | P3d = BRep_Tool::Pnt(V); |
343 | param = BRep_Tool::Parameter(V,E,F1); |
344 | pc = BRep_Tool::CurveOnSurface(E,F1,f,l); |
345 | if (pc.IsNull()) return Standard_False; |
346 | P1 = pc->Value(param); |
347 | param = BRep_Tool::Parameter(V,E,F2); |
348 | pc = BRep_Tool::CurveOnSurface(E,F2,f,l); |
349 | if (pc.IsNull()) return Standard_False; |
350 | P2 = pc->Value(param); |
351 | BP.SetValue(P3d, P3d, W, P1.X(), P1.Y(), P2.X(), P2.Y()); |
352 | return Standard_True; |
353 | } |
354 | |
355 | //======================================================================= |
356 | //function : UpdateLine |
81bba717 |
357 | //purpose : Updates extremities after a partial invalidation |
7fd59977 |
358 | //======================================================================= |
359 | |
360 | static void UpdateLine(Handle(BRepBlend_Line)& Line, |
361 | const Standard_Boolean isfirst) |
362 | { |
363 | Standard_Real tguide, U, V; |
364 | if (isfirst) { |
365 | const Blend_Point& BP = Line->Point(1); |
366 | tguide = BP.Parameter(); |
367 | if (Line->StartPointOnFirst().ParameterOnGuide() < tguide) { |
368 | BRepBlend_Extremity BE; |
369 | BP.ParametersOnS1(U, V); |
370 | BE.SetValue(BP.PointOnS1(), U, V, Precision::Confusion()); |
371 | Line->SetStartPoints(BE, Line->StartPointOnSecond()); |
372 | } |
373 | if (Line->StartPointOnSecond().ParameterOnGuide() < tguide) { |
374 | BRepBlend_Extremity BE; |
375 | BP.ParametersOnS2(U, V); |
376 | BE.SetValue(BP.PointOnS2(), U, V, Precision::Confusion()); |
377 | Line->SetStartPoints(Line->StartPointOnFirst(), BE); |
378 | } |
379 | } |
380 | else { |
381 | const Blend_Point& BP = Line->Point(Line->NbPoints()); |
382 | tguide = BP.Parameter(); |
383 | if (Line->EndPointOnFirst().ParameterOnGuide() > tguide) { |
384 | BRepBlend_Extremity BE; |
385 | BP.ParametersOnS1(U, V); |
386 | BE.SetValue(BP.PointOnS1(), U, V, Precision::Confusion()); |
387 | Line->SetEndPoints(BE, Line->EndPointOnSecond()); |
388 | } |
389 | if (Line->EndPointOnSecond().ParameterOnGuide() > tguide) { |
390 | BRepBlend_Extremity BE; |
391 | BP.ParametersOnS2(U, V); |
392 | BE.SetValue(BP.PointOnS2(), U, V, Precision::Confusion()); |
393 | Line->SetEndPoints(Line->EndPointOnFirst(), BE); |
394 | } |
395 | } |
396 | } |
397 | |
398 | //======================================================================= |
399 | //function : CompleteData |
81bba717 |
400 | //purpose : Calculates curves and CommonPoints from the data |
401 | // calculated by filling. |
7fd59977 |
402 | //======================================================================= |
403 | |
404 | Standard_Boolean ChFi3d_Builder::CompleteData |
405 | (Handle(ChFiDS_SurfData)& Data, |
406 | const Handle(Geom_Surface)& Surfcoin, |
c22b52d6 |
407 | const Handle(Adaptor3d_Surface)& S1, |
7fd59977 |
408 | const Handle(Geom2d_Curve)& PC1, |
c22b52d6 |
409 | const Handle(Adaptor3d_Surface)& S2, |
7fd59977 |
410 | const Handle(Geom2d_Curve)& PC2, |
411 | const TopAbs_Orientation Or, |
412 | const Standard_Boolean On1, |
413 | const Standard_Boolean Gd1, |
414 | const Standard_Boolean Gd2, |
415 | const Standard_Boolean Gf1, |
416 | const Standard_Boolean Gf2) |
417 | { |
418 | TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS(); |
03275c0b |
419 | Data->ChangeSurf(DStr.AddSurface(TopOpeBRepDS_Surface(Surfcoin,tolapp3d))); |
7fd59977 |
420 | #ifdef DRAW |
421 | ChFi3d_SettraceDRAWFIL(Standard_True); |
422 | if (ChFi3d_GettraceDRAWFIL()) { |
423 | IndexOfConge++; |
424 | // char name[100]; |
425 | char* name = new char[100]; |
426 | sprintf(name,"%s_%d","Surf",IndexOfConge); |
427 | DrawTrSurf::Set(name,Surfcoin); |
428 | } |
429 | #endif |
430 | |
431 | Standard_Real UFirst,ULast,VFirst,VLast; |
432 | Surfcoin->Bounds(UFirst,ULast,VFirst,VLast); |
433 | if(!Gd1) Data->ChangeVertexFirstOnS1().SetPoint(Surfcoin->Value(UFirst,VFirst)); |
434 | if(!Gd2) Data->ChangeVertexFirstOnS2().SetPoint(Surfcoin->Value(UFirst,VLast)); |
435 | if(!Gf1) Data->ChangeVertexLastOnS1().SetPoint(Surfcoin->Value(ULast,VFirst)); |
436 | if(!Gf2) Data->ChangeVertexLastOnS2().SetPoint(Surfcoin->Value(ULast,VLast)); |
437 | |
81bba717 |
438 | //calculate curves side S1 |
7fd59977 |
439 | Handle(Geom_Curve) Crv3d1; |
440 | if(!PC1.IsNull()) Crv3d1= Surfcoin->VIso(VFirst); |
441 | gp_Pnt2d pd1(UFirst,VFirst), pf1(ULast,VFirst); |
442 | gp_Lin2d lfil1(pd1,gp_Dir2d(gp_Vec2d(pd1,pf1))); |
443 | Handle(Geom2d_Curve) PCurveOnSurf = new Geom2d_Line(lfil1); |
444 | TopAbs_Orientation tra1 = TopAbs_FORWARD, orsurf = Or; |
445 | Standard_Real x,y,w = 0.5*(UFirst+ULast); |
446 | gp_Pnt p; |
447 | gp_Vec du,dv; |
448 | Handle(Geom2d_Curve) c2dtrim; |
a8195d65 |
449 | Standard_Real tolreached = 1.e-5; |
7fd59977 |
450 | if(!PC1.IsNull()){ |
c22b52d6 |
451 | Handle(GeomAdaptor_Curve) hcS1 = new GeomAdaptor_Curve(Crv3d1); |
7fd59977 |
452 | c2dtrim = new Geom2d_TrimmedCurve(PC1,UFirst,ULast); |
453 | ChFi3d_SameParameter(hcS1,c2dtrim,S1,tolapp3d,tolreached); |
454 | c2dtrim->Value(w).Coord(x,y); |
455 | S1->D1(x,y,p,du,dv); |
456 | gp_Vec nf = du.Crossed(dv); |
457 | Surfcoin->D1(w,VFirst,p,du,dv); |
458 | gp_Vec ns = du.Crossed(dv); |
459 | if(nf.Dot(ns) > 0.) tra1 = TopAbs_REVERSED; |
460 | else if(On1) orsurf = TopAbs::Reverse(orsurf); |
461 | } |
462 | Standard_Integer Index1OfCurve = |
463 | DStr.AddCurve(TopOpeBRepDS_Curve(Crv3d1,tolreached)); |
464 | ChFiDS_FaceInterference& Fint1 = Data->ChangeInterferenceOnS1(); |
465 | Fint1.SetFirstParameter(UFirst); |
466 | Fint1.SetLastParameter(ULast); |
467 | Fint1.SetInterference(Index1OfCurve,tra1,c2dtrim,PCurveOnSurf); |
81bba717 |
468 | //calculate curves side S2 |
7fd59977 |
469 | Handle(Geom_Curve) Crv3d2; |
470 | if(!PC2.IsNull()) Crv3d2 = Surfcoin->VIso(VLast); |
471 | gp_Pnt2d pd2(UFirst,VLast), pf2(ULast,VLast); |
472 | gp_Lin2d lfil2(pd2,gp_Dir2d(gp_Vec2d(pd2,pf2))); |
473 | PCurveOnSurf = new Geom2d_Line(lfil2); |
474 | TopAbs_Orientation tra2 = TopAbs_FORWARD; |
475 | if(!PC2.IsNull()){ |
c22b52d6 |
476 | Handle(GeomAdaptor_Curve) hcS2 = new GeomAdaptor_Curve(Crv3d2); |
7fd59977 |
477 | c2dtrim = new Geom2d_TrimmedCurve(PC2,UFirst,ULast); |
478 | ChFi3d_SameParameter(hcS2,c2dtrim,S2,tolapp3d,tolreached); |
479 | c2dtrim->Value(w).Coord(x,y); |
480 | S2->D1(x,y,p,du,dv); |
481 | gp_Vec np = du.Crossed(dv); |
482 | Surfcoin->D1(w,VLast,p,du,dv); |
483 | gp_Vec ns = du.Crossed(dv); |
484 | if(np.Dot(ns) < 0.) { |
485 | tra2 = TopAbs_REVERSED; |
486 | if(!On1) orsurf = TopAbs::Reverse(orsurf); |
487 | } |
488 | } |
489 | Standard_Integer Index2OfCurve = |
490 | DStr.AddCurve(TopOpeBRepDS_Curve(Crv3d2,tolreached)); |
491 | ChFiDS_FaceInterference& Fint2 = Data->ChangeInterferenceOnS2(); |
492 | Fint2.SetFirstParameter(UFirst); |
493 | Fint2.SetLastParameter(ULast); |
494 | Fint2.SetInterference(Index2OfCurve,tra2,c2dtrim,PCurveOnSurf); |
495 | Data->ChangeOrientation() = orsurf; |
496 | return Standard_True; |
497 | } |
498 | |
499 | //======================================================================= |
500 | //function : CompleteData |
81bba717 |
501 | //purpose : Calculates the surface of curves and eventually |
502 | // CommonPoints from the data calculated in ComputeData. |
7fd59977 |
503 | // |
81bba717 |
504 | // 11/08/1996 : Use of F(t) |
7fd59977 |
505 | // |
506 | //======================================================================= |
507 | |
508 | Standard_Boolean ChFi3d_Builder::CompleteData |
509 | (Handle(ChFiDS_SurfData)& Data, |
510 | Blend_Function& Func, |
511 | Handle(BRepBlend_Line)& lin, |
c22b52d6 |
512 | const Handle(Adaptor3d_Surface)& S1, |
513 | const Handle(Adaptor3d_Surface)& S2, |
7fd59977 |
514 | const TopAbs_Orientation Or1, |
515 | const Standard_Boolean Gd1, |
516 | const Standard_Boolean Gd2, |
517 | const Standard_Boolean Gf1, |
518 | const Standard_Boolean Gf2, |
519 | const Standard_Boolean Reversed) |
520 | { |
521 | Handle(BRepBlend_AppFunc) TheFunc |
522 | = new (BRepBlend_AppFunc)(lin, Func, tolapp3d, 1.e-5); |
822ffdff |
523 | |
ea9632bc |
524 | Standard_Integer Degmax = 20, Segmax = 5000; |
7fd59977 |
525 | BRepBlend_AppSurface approx (TheFunc, |
526 | lin->Point(1).Parameter(), |
527 | lin->Point(lin->NbPoints()).Parameter(), |
528 | tolapp3d, 1.e-5, //tolapp2d, tolerance max |
529 | tolappangle, // Contact G1 |
822ffdff |
530 | myConti, Degmax, Segmax); |
7fd59977 |
531 | if (!approx.IsDone()) { |
0797d9d3 |
532 | #ifdef OCCT_DEBUG |
04232180 |
533 | std::cout << "Approximation non faite !!!" << std::endl; |
7fd59977 |
534 | #endif |
535 | return Standard_False; |
536 | } |
0797d9d3 |
537 | #ifdef OCCT_DEBUG |
04232180 |
538 | approx.Dump(std::cout); |
7fd59977 |
539 | #endif |
540 | return StoreData( Data, approx, lin, S1, S2, Or1, Gd1, Gd2, Gf1, Gf2, Reversed); |
541 | } |
542 | |
543 | |
544 | //======================================================================= |
545 | //function : CompleteData |
81bba717 |
546 | //purpose : New overload for functions surf/rst |
7fd59977 |
547 | // jlr le 28/07/97 branchement F(t) |
548 | //======================================================================= |
549 | |
550 | Standard_Boolean ChFi3d_Builder::CompleteData |
551 | (Handle(ChFiDS_SurfData)& Data, |
552 | Blend_SurfRstFunction& Func, |
553 | Handle(BRepBlend_Line)& lin, |
c22b52d6 |
554 | const Handle(Adaptor3d_Surface)& S1, |
555 | const Handle(Adaptor3d_Surface)& S2, |
7fd59977 |
556 | const TopAbs_Orientation Or, |
557 | const Standard_Boolean Reversed) |
558 | { |
559 | Handle(BRepBlend_AppFuncRst) TheFunc |
560 | = new (BRepBlend_AppFuncRst)(lin, Func, tolapp3d, 1.e-5); |
561 | BRepBlend_AppSurface approx (TheFunc, |
562 | lin->Point(1).Parameter(), |
563 | lin->Point(lin->NbPoints()).Parameter(), |
564 | tolapp3d, 1.e-5, //tolapp2d, tolerance max |
565 | tolappangle, // Contact G1 |
566 | myConti); |
567 | if (!approx.IsDone()) { |
0797d9d3 |
568 | #ifdef OCCT_DEBUG |
04232180 |
569 | std::cout << "Approximation is not done!" << std::endl; |
7fd59977 |
570 | #endif |
571 | return Standard_False; |
572 | } |
0797d9d3 |
573 | #ifdef OCCT_DEBUG |
04232180 |
574 | approx.Dump(std::cout); |
7fd59977 |
575 | #endif |
576 | |
577 | return StoreData(Data,approx,lin,S1,S2,Or,0,0,0,0,Reversed); |
578 | } |
579 | |
580 | |
581 | |
582 | //======================================================================= |
583 | //function : CompleteData |
81bba717 |
584 | //purpose : New overload for functions rst/rst |
7fd59977 |
585 | // jlr le 28/07/97 branchement F(t) |
586 | //======================================================================= |
587 | |
588 | Standard_Boolean ChFi3d_Builder::CompleteData |
589 | (Handle(ChFiDS_SurfData)& Data, |
590 | Blend_RstRstFunction& Func, |
591 | Handle(BRepBlend_Line)& lin, |
c22b52d6 |
592 | const Handle(Adaptor3d_Surface)& S1, |
593 | const Handle(Adaptor3d_Surface)& S2, |
7fd59977 |
594 | const TopAbs_Orientation Or) |
595 | { |
596 | Handle(BRepBlend_AppFuncRstRst) TheFunc |
597 | = new (BRepBlend_AppFuncRstRst)(lin, Func, tolapp3d, 1.e-5); |
598 | BRepBlend_AppSurface approx (TheFunc, |
599 | lin->Point(1).Parameter(), |
600 | lin->Point(lin->NbPoints()).Parameter(), |
601 | tolapp3d, 1.e-5, //tolapp2d, tolerance max |
602 | tolappangle, // Contact G1 |
603 | myConti); |
604 | if (!approx.IsDone()) { |
0797d9d3 |
605 | #ifdef OCCT_DEBUG |
04232180 |
606 | std::cout << "Approximation non faite !!!" << std::endl; |
7fd59977 |
607 | #endif |
608 | return Standard_False; |
609 | } |
0797d9d3 |
610 | #ifdef OCCT_DEBUG |
04232180 |
611 | approx.Dump(std::cout); |
7fd59977 |
612 | #endif |
613 | |
614 | return StoreData(Data,approx,lin,S1,S2,Or,0,0,0,0); |
615 | } |
616 | |
617 | |
618 | |
619 | |
620 | //======================================================================= |
621 | //function : StoreData |
81bba717 |
622 | //purpose : Copy of an approximation result in SurfData. |
7fd59977 |
623 | //======================================================================= |
624 | |
625 | Standard_Boolean ChFi3d_Builder::StoreData(Handle(ChFiDS_SurfData)& Data, |
626 | const AppBlend_Approx& approx, |
627 | const Handle(BRepBlend_Line)& lin, |
c22b52d6 |
628 | const Handle(Adaptor3d_Surface)& S1, |
629 | const Handle(Adaptor3d_Surface)& S2, |
7fd59977 |
630 | const TopAbs_Orientation Or1, |
631 | const Standard_Boolean Gd1, |
632 | const Standard_Boolean Gd2, |
633 | const Standard_Boolean Gf1, |
634 | const Standard_Boolean Gf2, |
635 | const Standard_Boolean Reversed) |
636 | { |
81bba717 |
637 | // Small control tools. |
c22b52d6 |
638 | static Handle(GeomAdaptor_Curve) checkcurve; |
639 | if(checkcurve.IsNull()) checkcurve = new GeomAdaptor_Curve(); |
640 | GeomAdaptor_Curve& chc = *checkcurve; |
7fd59977 |
641 | Standard_Real tolget3d, tolget2d, tolaux, tolC1, tolcheck; |
7fd59977 |
642 | Standard_Real tolC2 = 0.; |
7fd59977 |
643 | approx.TolReached(tolget3d, tolget2d); |
644 | tolaux = approx.TolCurveOnSurf(1); |
645 | tolC1 = tolget3d + tolaux; |
646 | if(!S2.IsNull()) { |
647 | tolaux = approx.TolCurveOnSurf(2); |
648 | tolC2 = tolget3d + tolaux; |
649 | } |
650 | |
651 | TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS(); |
81bba717 |
652 | // By default parametric space is created using a square surface |
653 | // to be able to parameterize in U by # R*teta // a revoir lbo 29/08/97 |
7fd59977 |
654 | const TColStd_Array1OfReal& ku = approx.SurfUKnots(); |
655 | const TColStd_Array1OfReal& kv = approx.SurfVKnots(); |
656 | Standard_Real larg = (kv(kv.Upper())-kv(kv.Lower())); |
657 | TColStd_Array1OfReal& kku = *((TColStd_Array1OfReal*)((void*)&ku)); |
658 | BSplCLib::Reparametrize(0.,larg,kku); |
659 | Handle(Geom_BSplineSurface) Surf = |
660 | new Geom_BSplineSurface(approx.SurfPoles(),approx.SurfWeights(), |
661 | kku,kv, |
662 | approx.SurfUMults(),approx.SurfVMults(), |
663 | approx.UDegree(),approx.VDegree()); |
81bba717 |
664 | // extension of the surface |
7fd59977 |
665 | |
666 | Standard_Real length1,length2; |
667 | length1=Data->FirstExtensionValue(); |
668 | length2=Data->LastExtensionValue(); |
7f22979e |
669 | |
670 | Handle(Geom_BoundedSurface) aBndSurf = Surf; |
ba7f665d |
671 | Standard_Boolean ext1 = Standard_False, ext2 = Standard_False; |
672 | Standard_Real eps = Max(tolget3d, 2. * Precision::Confusion()); |
673 | if (length1 > eps) |
674 | { |
675 | gp_Pnt P11, P21; |
676 | P11 = Surf->Pole(1, 1); |
677 | P21 = Surf->Pole(Surf->NbUPoles(), 1); |
678 | if (P11.Distance(P21) > eps) |
679 | { |
680 | //to avoid extending surface with singular boundary |
681 | GeomLib::ExtendSurfByLength(aBndSurf, length1, 1, Standard_False, Standard_False); |
682 | ext1 = Standard_True; |
683 | } |
684 | } |
685 | if (length2 > eps) |
686 | { |
687 | gp_Pnt P12, P22; |
688 | P12 = Surf->Pole(1, Surf->NbVPoles()); |
689 | P22 = Surf->Pole(Surf->NbUPoles(), Surf->NbVPoles()); |
690 | if (P12.Distance(P22) > eps) |
691 | { |
692 | //to avoid extending surface with singular boundary |
693 | GeomLib::ExtendSurfByLength(aBndSurf, length2, 1, Standard_False, Standard_True); |
694 | ext2 = Standard_True; |
695 | } |
696 | } |
697 | Surf = Handle(Geom_BSplineSurface)::DownCast(aBndSurf); |
7fd59977 |
698 | |
af99433e |
699 | //Correction of surface on extremities |
ba7f665d |
700 | if (!ext1) |
af99433e |
701 | { |
702 | gp_Pnt P11, P21; |
703 | P11 = lin->StartPointOnFirst().Value(); |
704 | P21 = lin->StartPointOnSecond().Value(); |
705 | Surf->SetPole(1, 1, P11); |
706 | Surf->SetPole(Surf->NbUPoles(), 1, P21); |
707 | } |
ba7f665d |
708 | if (!ext2) |
af99433e |
709 | { |
710 | gp_Pnt P12, P22; |
711 | P12 = lin->EndPointOnFirst().Value(); |
712 | P22 = lin->EndPointOnSecond().Value(); |
713 | Surf->SetPole(1, Surf->NbVPoles(), P12); |
714 | Surf->SetPole(Surf->NbUPoles(), Surf->NbVPoles(), P22); |
715 | } |
716 | |
7fd59977 |
717 | Data->ChangeSurf(DStr.AddSurface(TopOpeBRepDS_Surface(Surf,tolget3d))); |
718 | |
719 | #ifdef DRAW |
720 | ChFi3d_SettraceDRAWFIL(Standard_True); |
721 | if (ChFi3d_GettraceDRAWFIL()) { |
722 | IndexOfConge++; |
723 | // char name[100]; |
724 | char* name=new char[100]; |
725 | sprintf(name,"%s_%d","Surf",IndexOfConge); |
726 | DrawTrSurf::Set(name,Surf); |
727 | } |
728 | #endif |
729 | Standard_Real UFirst,ULast,VFirst,VLast,pppdeb,pppfin; |
730 | Surf->Bounds(UFirst,ULast,VFirst,VLast); |
731 | BRepAdaptor_Curve2d brc; |
732 | BRepAdaptor_Curve CArc; |
c22b52d6 |
733 | Handle(BRepAdaptor_Surface) |
734 | BS1 = Handle(BRepAdaptor_Surface)::DownCast(S1); |
735 | Handle(BRepAdaptor_Surface) |
736 | BS2 = Handle(BRepAdaptor_Surface)::DownCast(S2); |
7fd59977 |
737 | Geom2dAPI_ProjectPointOnCurve projector; |
738 | |
739 | Standard_Real Uon1 = UFirst, Uon2 = ULast; |
740 | Standard_Integer ion1 = 1, ion2 = 2; |
741 | if(Reversed) { Uon1 = ULast; Uon2 = UFirst; ion1 = 2; ion2 = 1; } |
742 | |
81bba717 |
743 | // The SurfData is filled in what concerns S1, |
7fd59977 |
744 | Handle(Geom_Curve) Crv3d1 = Surf->UIso(Uon1); |
745 | gp_Pnt2d pori1(Uon1,0.); |
746 | gp_Lin2d lfil1(pori1,gp::DY2d()); |
747 | Handle(Geom2d_Curve) PCurveOnSurf = new Geom2d_Line(lfil1); |
748 | Handle(Geom2d_Curve) PCurveOnFace; |
749 | PCurveOnFace = new |
750 | Geom2d_BSplineCurve(approx.Curve2dPoles(ion1),approx.Curves2dKnots(), |
751 | approx.Curves2dMults(),approx.Curves2dDegree()); |
752 | |
753 | |
754 | Standard_Real par1=PCurveOnFace->FirstParameter(); |
755 | Standard_Real par2= PCurveOnFace->LastParameter(); |
756 | chc.Load(Crv3d1,par1,par2); |
757 | |
758 | if(!ChFi3d_CheckSameParameter(checkcurve,PCurveOnFace,S1,tolC1,tolcheck)){ |
0797d9d3 |
759 | #ifdef OCCT_DEBUG |
316ea293 |
760 | std::cout<<"approximate tolerance under-valued : "<<tolC1<<" for "<<tolcheck<<std::endl; |
7fd59977 |
761 | #endif |
762 | tolC1 = tolcheck; |
763 | } |
764 | Standard_Integer Index1OfCurve = |
765 | DStr.AddCurve(TopOpeBRepDS_Curve(Crv3d1,tolC1)); |
766 | |
767 | Standard_Real uarc,utg; |
768 | if(Gd1){ |
c22b52d6 |
769 | TopoDS_Face forwfac = BS1->Face(); |
7fd59977 |
770 | forwfac.Orientation(TopAbs_FORWARD); |
771 | brc.Initialize(Data->VertexFirstOnS1().Arc(),forwfac); |
772 | ChFiDS_CommonPoint& V = Data->ChangeVertexFirstOnS1(); |
773 | CArc.Initialize(V.Arc()); |
774 | CompParam(brc,PCurveOnFace,uarc,utg, V.ParameterOnArc(), V.Parameter()); |
775 | tolcheck = CArc.Value(uarc).Distance(V.Point()); |
776 | V.SetArc(tolC1+tolcheck,V.Arc(),uarc,V.TransitionOnArc()); |
777 | pppdeb = utg; |
778 | } |
779 | else pppdeb = VFirst; |
780 | if(Gf1){ |
c22b52d6 |
781 | TopoDS_Face forwfac = BS1->Face(); |
7fd59977 |
782 | forwfac.Orientation(TopAbs_FORWARD); |
783 | ChFiDS_CommonPoint& V = Data->ChangeVertexLastOnS1(); |
784 | brc.Initialize(V.Arc(),forwfac); |
785 | CArc.Initialize(V.Arc()); |
786 | CompParam(brc,PCurveOnFace,uarc,utg, V.ParameterOnArc(), V.Parameter()); |
787 | tolcheck = CArc.Value(uarc).Distance(V.Point()); |
788 | V.SetArc(tolC1+tolcheck,V.Arc(),uarc,V.TransitionOnArc()); |
789 | pppfin = utg; |
790 | } |
791 | else pppfin = VLast; |
792 | ChFiDS_FaceInterference& Fint1 = Data->ChangeInterferenceOnS1(); |
793 | Fint1.SetFirstParameter(pppdeb); |
794 | Fint1.SetLastParameter(pppfin); |
795 | TopAbs_Orientation TraOn1; |
796 | if(Reversed) TraOn1 = ChFi3d_TrsfTrans(lin->TransitionOnS2()); |
797 | else TraOn1 = ChFi3d_TrsfTrans(lin->TransitionOnS1()); |
798 | Fint1.SetInterference(Index1OfCurve,TraOn1,PCurveOnFace,PCurveOnSurf); |
799 | |
81bba717 |
800 | // SurfData is filled in what concerns S2, |
7fd59977 |
801 | Handle(Geom_Curve) Crv3d2 = Surf->UIso(Uon2); |
802 | gp_Pnt2d pori2(Uon2,0.); |
803 | gp_Lin2d lfil2(pori2,gp::DY2d()); |
804 | PCurveOnSurf = new Geom2d_Line(lfil2); |
805 | if(!S2.IsNull()){ |
806 | PCurveOnFace = new Geom2d_BSplineCurve(approx.Curve2dPoles(ion2), |
807 | approx.Curves2dKnots(), |
808 | approx.Curves2dMults(), |
809 | approx.Curves2dDegree()); |
810 | chc.Load(Crv3d2,par1,par2); |
811 | if(!ChFi3d_CheckSameParameter(checkcurve,PCurveOnFace,S2,tolC2,tolcheck)){ |
0797d9d3 |
812 | #ifdef OCCT_DEBUG |
04232180 |
813 | std::cout<<"approximate tolerance under-evaluated : "<<tolC2<<" for "<<tolcheck<<std::endl; |
7fd59977 |
814 | #endif |
815 | tolC2 = tolcheck; |
816 | } |
817 | } |
818 | Standard_Integer Index2OfCurve = |
819 | DStr.AddCurve(TopOpeBRepDS_Curve(Crv3d2,tolC2)); |
820 | if(Gd2){ |
c22b52d6 |
821 | TopoDS_Face forwfac = BS2->Face(); |
7fd59977 |
822 | forwfac.Orientation(TopAbs_FORWARD); |
823 | brc.Initialize(Data->VertexFirstOnS2().Arc(),forwfac); |
824 | ChFiDS_CommonPoint& V = Data->ChangeVertexFirstOnS2(); |
825 | CArc.Initialize(V.Arc()); |
826 | CompParam(brc,PCurveOnFace,uarc,utg, V.ParameterOnArc(), V.Parameter()); |
827 | tolcheck = CArc.Value(uarc).Distance(V.Point()); |
828 | V.SetArc(tolC2+tolcheck,V.Arc(),uarc,V.TransitionOnArc()); |
829 | pppdeb = utg; |
830 | } |
831 | else pppdeb = VFirst; |
832 | if(Gf2){ |
c22b52d6 |
833 | TopoDS_Face forwfac = BS2->Face(); |
7fd59977 |
834 | forwfac.Orientation(TopAbs_FORWARD); |
835 | brc.Initialize(Data->VertexLastOnS2().Arc(),forwfac); |
836 | ChFiDS_CommonPoint& V = Data->ChangeVertexLastOnS2(); |
837 | CArc.Initialize(V.Arc()); |
838 | CompParam(brc,PCurveOnFace,uarc,utg, V.ParameterOnArc(), V.Parameter()); |
839 | tolcheck = CArc.Value(uarc).Distance(V.Point()); |
840 | V.SetArc(tolC2+tolcheck,V.Arc(),uarc,V.TransitionOnArc()); |
841 | pppfin = utg; |
842 | } |
843 | else pppfin = VLast; |
844 | ChFiDS_FaceInterference& Fint2 = Data->ChangeInterferenceOnS2(); |
845 | Fint2.SetFirstParameter(pppdeb); |
846 | Fint2.SetLastParameter(pppfin); |
847 | if(!S2.IsNull()){ |
848 | TopAbs_Orientation TraOn2; |
849 | if(Reversed) TraOn2 = ChFi3d_TrsfTrans(lin->TransitionOnS1()); |
850 | else TraOn2 = ChFi3d_TrsfTrans(lin->TransitionOnS2()); |
851 | Fint2.SetInterference(Index2OfCurve,TraOn2,PCurveOnFace,PCurveOnSurf); |
852 | } |
853 | else { |
854 | Handle(Geom2d_Curve) bidpc; |
855 | Fint2.SetInterference |
856 | (Index2OfCurve,TopAbs_FORWARD,bidpc,PCurveOnSurf); |
857 | } |
858 | |
81bba717 |
859 | // the orientation of the fillet in relation to the faces is evaluated, |
7fd59977 |
860 | |
c22b52d6 |
861 | Handle(Adaptor3d_Surface) Sref = S1; |
7fd59977 |
862 | PCurveOnFace = Fint1.PCurveOnFace(); |
863 | if(Reversed){ Sref = S2; PCurveOnFace = Fint2.PCurveOnFace(); } |
864 | |
865 | // Modified by skv - Wed Jun 9 17:16:26 2004 OCC5898 Begin |
866 | // gp_Pnt2d PUV = PCurveOnFace->Value((VFirst+VLast)/2.); |
867 | // gp_Pnt P; |
868 | // gp_Vec Du1,Du2,Dv1,Dv2; |
869 | // Sref->D1(PUV.X(),PUV.Y(),P,Du1,Dv1); |
870 | // Du1.Cross(Dv1); |
871 | // if (Or1 == TopAbs_REVERSED) Du1.Reverse(); |
872 | // Surf->D1(UFirst,(VFirst+VLast)/2.,P,Du2,Dv2); |
873 | // Du2.Cross(Dv2); |
874 | // if (Du1.Dot(Du2)>0) Data->ChangeOrientation() = TopAbs_FORWARD; |
875 | // else Data->ChangeOrientation() = TopAbs_REVERSED; |
876 | |
877 | Standard_Real aDelta = VLast - VFirst; |
878 | Standard_Integer aDenom = 2; |
879 | |
302f96fb |
880 | for(;;) { |
7fd59977 |
881 | Standard_Real aDeltav = aDelta/aDenom; |
882 | Standard_Real aParam = VFirst + aDeltav; |
883 | gp_Pnt2d PUV = PCurveOnFace->Value(aParam); |
884 | gp_Pnt P; |
885 | gp_Vec Du1,Du2,Dv1,Dv2; |
886 | |
887 | Sref->D1(PUV.X(),PUV.Y(),P,Du1,Dv1); |
888 | Du1.Cross(Dv1); |
889 | |
890 | if (Or1 == TopAbs_REVERSED) |
891 | Du1.Reverse(); |
892 | |
893 | Surf->D1(UFirst, aParam, P, Du2, Dv2); |
894 | Du2.Cross(Dv2); |
895 | |
896 | if (Du1.Magnitude() <= tolget3d || |
897 | Du2.Magnitude() <= tolget3d) { |
898 | aDenom++; |
899 | |
900 | if (Abs(aDeltav) <= tolget2d) |
901 | return Standard_False; |
902 | |
903 | continue; |
904 | } |
905 | |
906 | if (Du1.Dot(Du2)>0) |
907 | Data->ChangeOrientation() = TopAbs_FORWARD; |
908 | else |
909 | Data->ChangeOrientation() = TopAbs_REVERSED; |
910 | |
911 | break; |
912 | } |
913 | // Modified by skv - Wed Jun 9 17:16:26 2004 OCC5898 End |
914 | |
915 | if(!Gd1 && !S1.IsNull()) |
916 | ChFi3d_FilCommonPoint(lin->StartPointOnFirst(),lin->TransitionOnS1(), |
917 | Standard_True, Data->ChangeVertex(1,ion1),tolC1); |
918 | if(!Gf1 && !S1.IsNull()) |
919 | ChFi3d_FilCommonPoint(lin->EndPointOnFirst(),lin->TransitionOnS1(), |
920 | Standard_False,Data->ChangeVertex(0,ion1),tolC1); |
921 | if(!Gd2 && !S2.IsNull()) |
922 | ChFi3d_FilCommonPoint(lin->StartPointOnSecond(),lin->TransitionOnS2(), |
923 | Standard_True, Data->ChangeVertex(1,ion2),tolC2); |
924 | if(!Gf2 && !S2.IsNull()) |
925 | ChFi3d_FilCommonPoint(lin->EndPointOnSecond(),lin->TransitionOnS2(), |
926 | Standard_False, Data->ChangeVertex(0,ion2),tolC2); |
81bba717 |
927 | // Parameters on ElSpine |
7fd59977 |
928 | Standard_Integer nbp = lin->NbPoints(); |
929 | Data->FirstSpineParam(lin->Point(1).Parameter()); |
930 | Data->LastSpineParam(lin->Point(nbp).Parameter()); |
931 | return Standard_True; |
932 | } |
933 | |
934 | |
935 | |
936 | //======================================================================= |
937 | //function : ComputeData |
81bba717 |
938 | //purpose : Head of the path edge/face for the bypass of obstacle. |
7fd59977 |
939 | //======================================================================= |
940 | |
941 | Standard_Boolean ChFi3d_Builder::ComputeData |
942 | (Handle(ChFiDS_SurfData)& Data, |
c22b52d6 |
943 | const Handle(ChFiDS_ElSpine)& HGuide, |
7fd59977 |
944 | Handle(BRepBlend_Line)& Lin, |
c22b52d6 |
945 | const Handle(Adaptor3d_Surface)& S1, |
7fd59977 |
946 | const Handle(Adaptor3d_TopolTool)& I1, |
c22b52d6 |
947 | const Handle(Adaptor3d_Surface)& S2, |
948 | const Handle(Adaptor2d_Curve2d)& PC2, |
7fd59977 |
949 | const Handle(Adaptor3d_TopolTool)& I2, |
950 | Standard_Boolean& Decroch, |
951 | Blend_SurfRstFunction& Func, |
952 | Blend_FuncInv& FInv, |
953 | Blend_SurfPointFuncInv& FInvP, |
954 | Blend_SurfCurvFuncInv& FInvC, |
955 | const Standard_Real PFirst, |
956 | const Standard_Real MaxStep, |
957 | const Standard_Real Fleche, |
958 | const Standard_Real TolGuide, |
959 | Standard_Real& First, |
960 | Standard_Real& Last, |
961 | const math_Vector& Soldep, |
962 | const Standard_Boolean Inside, |
963 | const Standard_Boolean Appro, |
964 | const Standard_Boolean Forward, |
965 | const Standard_Boolean RecP, |
966 | const Standard_Boolean RecS, |
967 | const Standard_Boolean RecRst) |
968 | { |
969 | BRepBlend_SurfRstLineBuilder TheWalk(S1,I1,S2,PC2,I2); |
970 | |
971 | Data->FirstExtensionValue(0); |
972 | Data->LastExtensionValue(0); |
973 | |
974 | Standard_Boolean reverse = (!Forward || Inside); |
975 | Standard_Real SpFirst = HGuide->FirstParameter(); |
976 | Standard_Real SpLast = HGuide->LastParameter(); |
977 | Standard_Real Target = SpLast; |
978 | if(reverse) Target = SpFirst; |
979 | Standard_Real Targetsov = Target; |
980 | |
981 | Standard_Real MS = MaxStep; |
982 | Standard_Integer again = 0; |
983 | Standard_Integer nbptmin = 3; //jlr |
1d47d8d0 |
984 | Standard_Integer Nbpnt = 1; |
81bba717 |
985 | // the initial solution is reframed if necessary. |
7fd59977 |
986 | math_Vector ParSol(1,3); |
987 | Standard_Real NewFirst = PFirst; |
988 | if(RecP || RecS || RecRst){ |
989 | if(!TheWalk.PerformFirstSection(Func,FInv,FInvP,FInvC,PFirst,Target,Soldep, |
03275c0b |
990 | tolapp3d,tolapp2d,TolGuide,RecRst,RecP,RecS, |
7fd59977 |
991 | NewFirst,ParSol)){ |
0797d9d3 |
992 | #ifdef OCCT_DEBUG |
04232180 |
993 | std::cout<<"ChFi3d_Builder::ComputeData : calculation fail first section"<<std::endl; |
7fd59977 |
994 | #endif |
995 | return Standard_False; |
996 | } |
997 | } |
998 | else { |
999 | ParSol = Soldep; |
1000 | } |
1001 | |
1002 | while (again < 2){ |
1003 | TheWalk.Perform (Func,FInv,FInvP,FInvC,NewFirst,Last, |
03275c0b |
1004 | MS,tolapp3d,tolapp2d,TolGuide,ParSol,Fleche,Appro); |
7fd59977 |
1005 | |
1006 | if (!TheWalk.IsDone()) { |
0797d9d3 |
1007 | #ifdef OCCT_DEBUG |
04232180 |
1008 | std::cout << "Path not created" << std::endl; |
7fd59977 |
1009 | #endif |
1010 | return Standard_False; |
1011 | } |
1012 | |
1013 | if (reverse) { |
1014 | if (!TheWalk.Complete(Func,FInv,FInvP,FInvC,SpLast)) { |
0797d9d3 |
1015 | #ifdef OCCT_DEBUG |
04232180 |
1016 | std::cout << "Not completed" << std::endl; |
7fd59977 |
1017 | #endif |
1018 | } |
1019 | } |
1020 | |
1021 | |
1022 | Lin = TheWalk.Line(); |
1023 | Nbpnt = Lin->NbPoints(); |
1024 | if (Nbpnt <= 1 && again == 0) { |
1025 | again++; |
0797d9d3 |
1026 | #ifdef OCCT_DEBUG |
04232180 |
1027 | std::cout <<"one point of the path MS/50 is attempted."<<std::endl; |
7fd59977 |
1028 | #endif |
1029 | MS = MS/50.; Target = Targetsov; |
1030 | } |
1031 | else if (Nbpnt<=nbptmin && again == 0) { |
1032 | again++; |
0797d9d3 |
1033 | #ifdef OCCT_DEBUG |
04232180 |
1034 | std::cout <<"Number of points is too small, the step is reduced"<<std::endl; |
7fd59977 |
1035 | #endif |
1036 | Standard_Real u1 = Lin->Point(1).Parameter(); |
1037 | Standard_Real u2 = Lin->Point(Nbpnt).Parameter(); |
1038 | MS = (u2-u1)/(nbptmin+1.0); |
04232180 |
1039 | // std::cout << " MS : " << MS << " u1 : " << u1 << " u2 : " << u2 << " nbptmin : " << nbptmin << std::endl; |
7fd59977 |
1040 | Target = Targetsov; |
1041 | } |
1042 | else if(Nbpnt<=nbptmin){ |
0797d9d3 |
1043 | #ifdef OCCT_DEBUG |
04232180 |
1044 | std::cout <<"Number of points is still too small, quit"<<std::endl; |
7fd59977 |
1045 | #endif |
1046 | return Standard_False; |
1047 | } |
1048 | else { |
1049 | again = 2; |
1050 | } |
1051 | } |
1052 | #ifdef DRAW |
1053 | ChFi3d_SettraceDRAWWALK(Standard_True); |
1054 | if(ChFi3d_GettraceDRAWWALK()) drawline(Lin,Standard_True); |
1055 | #endif |
1056 | if(Forward) Decroch = TheWalk.DecrochEnd(); |
1057 | else Decroch = TheWalk.DecrochStart(); |
1058 | Last = Lin->Point(Nbpnt).Parameter(); |
1059 | First = Lin->Point(1).Parameter(); |
1060 | return Standard_True; |
1061 | } |
1062 | |
1063 | |
1064 | //======================================================================= |
1065 | //function : ComputeData |
81bba717 |
1066 | //purpose : Heading of the path edge/edge for the bypass of obstacle. |
7fd59977 |
1067 | //======================================================================= |
1068 | |
1069 | Standard_Boolean ChFi3d_Builder::ComputeData |
1070 | (Handle(ChFiDS_SurfData)& Data, |
c22b52d6 |
1071 | const Handle(ChFiDS_ElSpine)& HGuide, |
7fd59977 |
1072 | Handle(BRepBlend_Line)& Lin, |
c22b52d6 |
1073 | const Handle(Adaptor3d_Surface)& S1, |
1074 | const Handle(Adaptor2d_Curve2d)& PC1, |
7fd59977 |
1075 | const Handle(Adaptor3d_TopolTool)& I1, |
1076 | Standard_Boolean& Decroch1, |
c22b52d6 |
1077 | const Handle(Adaptor3d_Surface)& S2, |
1078 | const Handle(Adaptor2d_Curve2d)& PC2, |
7fd59977 |
1079 | const Handle(Adaptor3d_TopolTool)& I2, |
1080 | Standard_Boolean& Decroch2, |
1081 | Blend_RstRstFunction& Func, |
1082 | Blend_SurfCurvFuncInv& FInv1, |
1083 | Blend_CurvPointFuncInv& FInvP1, |
1084 | Blend_SurfCurvFuncInv& FInv2, |
1085 | Blend_CurvPointFuncInv& FInvP2, |
1086 | const Standard_Real PFirst, |
1087 | const Standard_Real MaxStep, |
1088 | const Standard_Real Fleche, |
1089 | const Standard_Real TolGuide, |
1090 | Standard_Real& First, |
1091 | Standard_Real& Last, |
1092 | const math_Vector& Soldep, |
1093 | const Standard_Boolean Inside, |
1094 | const Standard_Boolean Appro, |
1095 | const Standard_Boolean Forward, |
1096 | const Standard_Boolean RecP1, |
1097 | const Standard_Boolean RecRst1, |
1098 | const Standard_Boolean RecP2, |
1099 | const Standard_Boolean RecRst2) |
1100 | { |
1101 | BRepBlend_RstRstLineBuilder TheWalk(S1, PC1, I1, S2, PC2, I2); |
1102 | |
1103 | Data->FirstExtensionValue(0); |
1104 | Data->LastExtensionValue(0); |
1105 | |
1106 | Standard_Boolean reverse = (!Forward || Inside); |
1107 | Standard_Real SpFirst = HGuide->FirstParameter(); |
1108 | Standard_Real SpLast = HGuide->LastParameter(); |
1109 | Standard_Real Target = SpLast; |
1110 | if(reverse) Target = SpFirst; |
1111 | Standard_Real Targetsov = Target; |
1112 | |
1113 | Standard_Real MS = MaxStep; |
1114 | Standard_Integer again = 0; |
1115 | Standard_Integer nbptmin = 3; //jlr |
7fd59977 |
1116 | Standard_Integer Nbpnt = 0; |
81bba717 |
1117 | // the initial solution is reframed if necessary. |
7fd59977 |
1118 | math_Vector ParSol(1,2); |
1119 | Standard_Real NewFirst = PFirst; |
1120 | if (RecP1 || RecRst1 || RecP2 || RecRst2) { |
1121 | if (!TheWalk.PerformFirstSection(Func, FInv1, FInvP1, FInv2, FInvP2, PFirst, Target, Soldep, |
03275c0b |
1122 | tolapp3d, TolGuide, RecRst1, RecP1, RecRst2, RecP2, |
7fd59977 |
1123 | NewFirst, ParSol)){ |
0797d9d3 |
1124 | #ifdef OCCT_DEBUG |
04232180 |
1125 | std::cout<<"ChFi3d_Builder::ComputeData : fail calculation first section"<<std::endl; |
7fd59977 |
1126 | #endif |
1127 | return Standard_False; |
1128 | } |
1129 | } |
1130 | else { |
1131 | ParSol = Soldep; |
1132 | } |
1133 | |
1134 | while (again < 2){ |
1135 | TheWalk.Perform (Func, FInv1, FInvP1, FInv2, FInvP2, NewFirst, Last, |
03275c0b |
1136 | MS, tolapp3d, TolGuide, ParSol, Fleche, Appro); |
7fd59977 |
1137 | |
1138 | if (!TheWalk.IsDone()) { |
0797d9d3 |
1139 | #ifdef OCCT_DEBUG |
04232180 |
1140 | std::cout << "Path not done" << std::endl; |
7fd59977 |
1141 | #endif |
1142 | return Standard_False; |
1143 | } |
1144 | |
1145 | if (reverse) { |
1146 | if (!TheWalk.Complete(Func, FInv1, FInvP1, FInv2, FInvP2, SpLast)) { |
0797d9d3 |
1147 | #ifdef OCCT_DEBUG |
04232180 |
1148 | std::cout << "Not completed" << std::endl; |
7fd59977 |
1149 | #endif |
1150 | } |
1151 | } |
1152 | |
1153 | |
1154 | Lin = TheWalk.Line(); |
1155 | Nbpnt = Lin->NbPoints(); |
1156 | if (Nbpnt <= 1 && again == 0) { |
1157 | again++; |
0797d9d3 |
1158 | #ifdef OCCT_DEBUG |
04232180 |
1159 | std::cout <<"one point of path MS/50 is attempted."<<std::endl; |
7fd59977 |
1160 | #endif |
1161 | MS = MS/50.; Target = Targetsov; |
1162 | } |
1163 | else if (Nbpnt<=nbptmin && again == 0) { |
1164 | again++; |
0797d9d3 |
1165 | #ifdef OCCT_DEBUG |
04232180 |
1166 | std::cout <<"Number of points is too small, the step is reduced"<<std::endl; |
7fd59977 |
1167 | #endif |
1168 | Standard_Real u1 = Lin->Point(1).Parameter(); |
1169 | Standard_Real u2 = Lin->Point(Nbpnt).Parameter(); |
1170 | MS = (u2-u1)/(nbptmin+1); |
1171 | Target = Targetsov; |
1172 | } |
1173 | else if(Nbpnt<=nbptmin){ |
0797d9d3 |
1174 | #ifdef OCCT_DEBUG |
04232180 |
1175 | std::cout <<"Number of points is still too small, quit"<<std::endl; |
7fd59977 |
1176 | #endif |
1177 | return Standard_False; |
1178 | } |
1179 | else { |
1180 | again = 2; |
1181 | } |
1182 | } |
1183 | #ifdef DRAW |
1184 | ChFi3d_SettraceDRAWWALK(Standard_True); |
1185 | if(ChFi3d_GettraceDRAWWALK()) drawline(Lin,Standard_True); |
1186 | #endif |
1187 | if (Forward) { |
1188 | Decroch1 = TheWalk.Decroch1End(); |
1189 | Decroch2 = TheWalk.Decroch2End(); |
1190 | } |
1191 | else { |
1192 | Decroch1 = TheWalk.Decroch1Start(); |
1193 | Decroch2 = TheWalk.Decroch2Start(); |
1194 | } |
1195 | Last = Lin->Point(Nbpnt).Parameter(); |
1196 | First = Lin->Point(1).Parameter(); |
1197 | return Standard_True; |
1198 | } |
1199 | |
1200 | |
1201 | //======================================================================= |
1202 | //function : SimulData |
81bba717 |
1203 | //purpose : Heading of the path edge/face for the bypass of obstacle in simulation mode. |
7fd59977 |
1204 | //======================================================================= |
1205 | |
1206 | Standard_Boolean ChFi3d_Builder::SimulData |
1207 | (Handle(ChFiDS_SurfData)& /*Data*/, |
c22b52d6 |
1208 | const Handle(ChFiDS_ElSpine)& HGuide, |
7fd59977 |
1209 | Handle(BRepBlend_Line)& Lin, |
c22b52d6 |
1210 | const Handle(Adaptor3d_Surface)& S1, |
7fd59977 |
1211 | const Handle(Adaptor3d_TopolTool)& I1, |
c22b52d6 |
1212 | const Handle(Adaptor3d_Surface)& S2, |
1213 | const Handle(Adaptor2d_Curve2d)& PC2, |
7fd59977 |
1214 | const Handle(Adaptor3d_TopolTool)& I2, |
1215 | Standard_Boolean& Decroch, |
1216 | Blend_SurfRstFunction& Func, |
1217 | Blend_FuncInv& FInv, |
1218 | Blend_SurfPointFuncInv& FInvP, |
1219 | Blend_SurfCurvFuncInv& FInvC, |
1220 | const Standard_Real PFirst, |
1221 | const Standard_Real MaxStep, |
1222 | const Standard_Real Fleche, |
1223 | const Standard_Real TolGuide, |
1224 | Standard_Real& First, |
1225 | Standard_Real& Last, |
1226 | const math_Vector& Soldep, |
1227 | const Standard_Integer NbSecMin, |
1228 | const Standard_Boolean Inside, |
1229 | const Standard_Boolean Appro, |
1230 | const Standard_Boolean Forward, |
1231 | const Standard_Boolean RecP, |
1232 | const Standard_Boolean RecS, |
1233 | const Standard_Boolean RecRst) |
1234 | { |
1235 | BRepBlend_SurfRstLineBuilder TheWalk(S1,I1,S2,PC2,I2); |
1236 | |
1237 | Standard_Boolean reverse = (!Forward || Inside); |
1238 | Standard_Real SpFirst = HGuide->FirstParameter(); |
1239 | Standard_Real SpLast = HGuide->LastParameter(); |
1240 | Standard_Real Target = SpLast; |
1241 | if(reverse) Target = SpFirst; |
1242 | Standard_Real Targetsov = Target; |
1243 | |
1244 | Standard_Real MS = MaxStep; |
1245 | Standard_Integer again = 0; |
7fd59977 |
1246 | Standard_Integer Nbpnt = 0; |
81bba717 |
1247 | // the starting solution is reframed if needed. |
7fd59977 |
1248 | math_Vector ParSol(1,3); |
1249 | Standard_Real NewFirst = PFirst; |
1250 | if(RecP || RecS || RecRst){ |
1251 | if(!TheWalk.PerformFirstSection(Func,FInv,FInvP,FInvC,PFirst,Target,Soldep, |
03275c0b |
1252 | tolapp3d,tolapp2d,TolGuide,RecRst,RecP,RecS, |
7fd59977 |
1253 | NewFirst,ParSol)){ |
0797d9d3 |
1254 | #ifdef OCCT_DEBUG |
7fd59977 |
1255 | |
04232180 |
1256 | std::cout<<"ChFi3d_Builder::SimulData : fail calculate first section"<<std::endl; |
7fd59977 |
1257 | #endif |
1258 | return Standard_False; |
1259 | } |
1260 | } |
1261 | else { |
1262 | ParSol = Soldep; |
1263 | } |
1264 | |
1265 | while (again < 2){ |
1266 | TheWalk.Perform (Func,FInv,FInvP,FInvC,NewFirst,Last, |
03275c0b |
1267 | MS,tolapp3d,tolapp2d,TolGuide,ParSol,Fleche,Appro); |
7fd59977 |
1268 | if (!TheWalk.IsDone()) { |
0797d9d3 |
1269 | #ifdef OCCT_DEBUG |
04232180 |
1270 | std::cout << "Path not done" << std::endl; |
7fd59977 |
1271 | #endif |
1272 | return Standard_False; |
1273 | } |
1274 | if (reverse) { |
1275 | if (!TheWalk.Complete(Func,FInv,FInvP,FInvC,SpLast)) { |
0797d9d3 |
1276 | #ifdef OCCT_DEBUG |
04232180 |
1277 | std::cout << "Not completed" << std::endl; |
7fd59977 |
1278 | #endif |
1279 | } |
1280 | } |
1281 | Lin = TheWalk.Line(); |
1282 | Nbpnt = Lin->NbPoints(); |
1283 | if (Nbpnt <= 1 && again == 0) { |
1284 | again++; |
0797d9d3 |
1285 | #ifdef OCCT_DEBUG |
04232180 |
1286 | std::cout <<"one point of path MS/50 is attempted."<<std::endl; |
7fd59977 |
1287 | #endif |
1288 | MS = MS/50.; Target = Targetsov; |
1289 | } |
1290 | else if (Nbpnt <= NbSecMin && again == 0) { |
1291 | again++; |
0797d9d3 |
1292 | #ifdef OCCT_DEBUG |
04232180 |
1293 | std::cout <<"Number of points is too small, the step is reduced"<<std::endl; |
7fd59977 |
1294 | #endif |
1295 | Standard_Real u1 = Lin->Point(1).Parameter(); |
1296 | Standard_Real u2 = Lin->Point(Nbpnt).Parameter(); |
1297 | MS = (u2-u1)/(NbSecMin+1); |
1298 | Target = Targetsov; |
1299 | } |
1300 | else if(Nbpnt<=NbSecMin){ |
0797d9d3 |
1301 | #ifdef OCCT_DEBUG |
04232180 |
1302 | std::cout <<"Number of points is still too small, quit"<<std::endl; |
7fd59977 |
1303 | #endif |
1304 | return Standard_False; |
1305 | } |
1306 | else { |
1307 | again = 2; |
1308 | } |
1309 | } |
1310 | #ifdef DRAW |
1311 | ChFi3d_SettraceDRAWWALK(Standard_True); |
1312 | if(ChFi3d_GettraceDRAWWALK()) drawline(Lin,Standard_True); |
1313 | #endif |
1314 | if(Forward) Decroch = TheWalk.DecrochEnd(); |
1315 | else Decroch = TheWalk.DecrochStart(); |
1316 | Last = Lin->Point(Nbpnt).Parameter(); |
1317 | First = Lin->Point(1).Parameter(); |
1318 | return Standard_True; |
1319 | } |
1320 | |
1321 | |
1322 | //======================================================================= |
1323 | //function : SimulData |
81bba717 |
1324 | //purpose : Heading of path edge/edge for the bypass |
1325 | // of obstacle in simulation mode. |
7fd59977 |
1326 | //======================================================================= |
1327 | |
1328 | Standard_Boolean ChFi3d_Builder::SimulData |
1329 | (Handle(ChFiDS_SurfData)& /*Data*/, |
c22b52d6 |
1330 | const Handle(ChFiDS_ElSpine)& HGuide, |
7fd59977 |
1331 | Handle(BRepBlend_Line)& Lin, |
c22b52d6 |
1332 | const Handle(Adaptor3d_Surface)& S1, |
1333 | const Handle(Adaptor2d_Curve2d)& PC1, |
7fd59977 |
1334 | const Handle(Adaptor3d_TopolTool)& I1, |
1335 | Standard_Boolean& Decroch1, |
c22b52d6 |
1336 | const Handle(Adaptor3d_Surface)& S2, |
1337 | const Handle(Adaptor2d_Curve2d)& PC2, |
7fd59977 |
1338 | const Handle(Adaptor3d_TopolTool)& I2, |
1339 | Standard_Boolean& Decroch2, |
1340 | Blend_RstRstFunction& Func, |
1341 | Blend_SurfCurvFuncInv& FInv1, |
1342 | Blend_CurvPointFuncInv& FInvP1, |
1343 | Blend_SurfCurvFuncInv& FInv2, |
1344 | Blend_CurvPointFuncInv& FInvP2, |
1345 | const Standard_Real PFirst, |
1346 | const Standard_Real MaxStep, |
1347 | const Standard_Real Fleche, |
1348 | const Standard_Real TolGuide, |
1349 | Standard_Real& First, |
1350 | Standard_Real& Last, |
1351 | const math_Vector& Soldep, |
1352 | const Standard_Integer NbSecMin, |
1353 | const Standard_Boolean Inside, |
1354 | const Standard_Boolean Appro, |
1355 | const Standard_Boolean Forward, |
1356 | const Standard_Boolean RecP1, |
1357 | const Standard_Boolean RecRst1, |
1358 | const Standard_Boolean RecP2, |
1359 | const Standard_Boolean RecRst2) |
1360 | { |
1361 | BRepBlend_RstRstLineBuilder TheWalk(S1, PC1, I1, S2, PC2, I2); |
1362 | |
1363 | Standard_Boolean reverse = (!Forward || Inside); |
1364 | Standard_Real SpFirst = HGuide->FirstParameter(); |
1365 | Standard_Real SpLast = HGuide->LastParameter(); |
1366 | Standard_Real Target = SpLast; |
1367 | if(reverse) Target = SpFirst; |
1368 | Standard_Real Targetsov = Target; |
1369 | |
1370 | Standard_Real MS = MaxStep; |
1371 | Standard_Integer again = 0; |
7fd59977 |
1372 | Standard_Integer Nbpnt = 0; |
81bba717 |
1373 | // The initial solution is reframed if necessary. |
7fd59977 |
1374 | math_Vector ParSol(1,2); |
1375 | Standard_Real NewFirst = PFirst; |
1376 | if (RecP1 || RecRst1 || RecP2 || RecRst2) { |
1377 | if(!TheWalk.PerformFirstSection(Func, FInv1, FInvP1, FInv2, FInvP2, PFirst, Target, Soldep, |
03275c0b |
1378 | tolapp3d, TolGuide, RecRst1, RecP1, RecRst2, RecP2, |
7fd59977 |
1379 | NewFirst,ParSol)){ |
0797d9d3 |
1380 | #ifdef OCCT_DEBUG |
7fd59977 |
1381 | |
04232180 |
1382 | std::cout<<"ChFi3d_Builder::SimulData : calculation fail first section"<<std::endl; |
7fd59977 |
1383 | #endif |
1384 | return Standard_False; |
1385 | } |
1386 | } |
1387 | else { |
1388 | ParSol = Soldep; |
1389 | } |
1390 | |
1391 | while (again < 2){ |
1392 | TheWalk.Perform (Func, FInv1, FInvP1, FInv2, FInvP2, NewFirst, Last, |
03275c0b |
1393 | MS, tolapp3d, TolGuide, ParSol, Fleche, Appro); |
7fd59977 |
1394 | if (!TheWalk.IsDone()) { |
0797d9d3 |
1395 | #ifdef OCCT_DEBUG |
04232180 |
1396 | std::cout << "Path not created" << std::endl; |
7fd59977 |
1397 | #endif |
1398 | return Standard_False; |
1399 | } |
1400 | if (reverse) { |
1401 | if (!TheWalk.Complete(Func, FInv1, FInvP1, FInv2, FInvP2, SpLast)) { |
0797d9d3 |
1402 | #ifdef OCCT_DEBUG |
04232180 |
1403 | std::cout << "Not completed" << std::endl; |
7fd59977 |
1404 | #endif |
1405 | } |
1406 | } |
1407 | Lin = TheWalk.Line(); |
1408 | Nbpnt = Lin->NbPoints(); |
1409 | if (Nbpnt <= 1 && again == 0) { |
1410 | again++; |
0797d9d3 |
1411 | #ifdef OCCT_DEBUG |
04232180 |
1412 | std::cout <<"only one point of path MS/50 is attempted."<<std::endl; |
7fd59977 |
1413 | #endif |
1414 | MS = MS/50.; Target = Targetsov; |
1415 | } |
1416 | else if (Nbpnt <= NbSecMin && again == 0) { |
1417 | again++; |
0797d9d3 |
1418 | #ifdef OCCT_DEBUG |
04232180 |
1419 | std::cout <<"Number of points is too small, the step is reduced"<<std::endl; |
7fd59977 |
1420 | #endif |
1421 | Standard_Real u1 = Lin->Point(1).Parameter(); |
1422 | Standard_Real u2 = Lin->Point(Nbpnt).Parameter(); |
1423 | MS = (u2-u1)/(NbSecMin+1); |
1424 | Target = Targetsov; |
1425 | } |
1426 | else if(Nbpnt<=NbSecMin){ |
0797d9d3 |
1427 | #ifdef OCCT_DEBUG |
04232180 |
1428 | std::cout <<"Number of points is still too small, quit"<<std::endl; |
7fd59977 |
1429 | #endif |
1430 | return Standard_False; |
1431 | } |
1432 | else { |
1433 | again = 2; |
1434 | } |
1435 | } |
1436 | #ifdef DRAW |
1437 | if(ChFi3d_GettraceDRAWWALK()) drawline(Lin,Standard_True); |
1438 | #endif |
1439 | if (Forward) { |
1440 | Decroch1 = TheWalk.Decroch1End(); |
1441 | Decroch2 = TheWalk.Decroch2End(); |
1442 | } |
1443 | else { |
1444 | Decroch1 = TheWalk.Decroch1Start(); |
1445 | Decroch2 = TheWalk.Decroch2Start(); |
1446 | } |
1447 | |
1448 | Last = Lin->Point(Nbpnt).Parameter(); |
1449 | First = Lin->Point(1).Parameter(); |
1450 | return Standard_True; |
1451 | } |
1452 | |
1453 | |
1454 | |
1455 | |
1456 | //======================================================================= |
1457 | //function : ComputeData |
81bba717 |
1458 | //purpose : Construction of elementary fillet by path. |
7fd59977 |
1459 | // |
1460 | //======================================================================= |
1461 | |
1462 | Standard_Boolean ChFi3d_Builder::ComputeData |
1463 | (Handle(ChFiDS_SurfData)& Data, |
c22b52d6 |
1464 | const Handle(ChFiDS_ElSpine)& HGuide, |
7fd59977 |
1465 | const Handle(ChFiDS_Spine)& Spine, |
1466 | Handle(BRepBlend_Line)& Lin, |
c22b52d6 |
1467 | const Handle(Adaptor3d_Surface)& S1, |
7fd59977 |
1468 | const Handle(Adaptor3d_TopolTool)& I1, |
c22b52d6 |
1469 | const Handle(Adaptor3d_Surface)& S2, |
7fd59977 |
1470 | const Handle(Adaptor3d_TopolTool)& I2, |
1471 | Blend_Function& Func, |
1472 | Blend_FuncInv& FInv, |
1473 | const Standard_Real PFirst, |
1474 | const Standard_Real MaxStep, |
1475 | const Standard_Real Fleche, |
1476 | const Standard_Real tolguide, |
1477 | Standard_Real& First, |
1478 | Standard_Real& Last, |
1479 | const Standard_Boolean Inside, |
1480 | const Standard_Boolean Appro, |
1481 | const Standard_Boolean Forward, |
1482 | const math_Vector& Soldep, |
dde68833 |
1483 | Standard_Integer& intf, |
1484 | Standard_Integer& intl, |
7fd59977 |
1485 | Standard_Boolean& Gd1, |
1486 | Standard_Boolean& Gd2, |
1487 | Standard_Boolean& Gf1, |
1488 | Standard_Boolean& Gf2, |
1489 | const Standard_Boolean RecOnS1, |
1490 | const Standard_Boolean RecOnS2) |
1491 | { |
1d54b807 |
1492 | //Get offset guide if exists |
c22b52d6 |
1493 | Handle(ChFiDS_ElSpine) OffsetHGuide; |
1d54b807 |
1494 | if (!Spine.IsNull() && |
1495 | Spine->Mode() == ChFiDS_ConstThroatWithPenetrationChamfer) |
1496 | { |
1497 | ChFiDS_ListOfHElSpine& ll = Spine->ChangeElSpines(); |
1498 | ChFiDS_ListOfHElSpine& ll_offset = Spine->ChangeOffsetElSpines(); |
1499 | ChFiDS_ListIteratorOfListOfHElSpine ILES(ll), ILES_offset(ll_offset); |
1500 | for ( ; ILES.More(); ILES.Next(),ILES_offset.Next()) |
1501 | { |
c22b52d6 |
1502 | const Handle(ChFiDS_ElSpine)& aHElSpine = ILES.Value(); |
1d54b807 |
1503 | if (aHElSpine == HGuide) |
1504 | OffsetHGuide = ILES_offset.Value(); |
1505 | } |
1506 | } |
1507 | |
81bba717 |
1508 | //The extrensions are created in case of output of two domains |
1509 | //directly and not by path ( too hasardous ). |
7fd59977 |
1510 | Data->FirstExtensionValue(0); |
1511 | Data-> LastExtensionValue(0); |
1512 | |
81bba717 |
1513 | //The eventual faces are restored to test the jump of edge. |
7fd59977 |
1514 | TopoDS_Face F1, F2; |
c22b52d6 |
1515 | Handle(BRepAdaptor_Surface) HS = Handle(BRepAdaptor_Surface)::DownCast(S1); |
1516 | if(!HS.IsNull()) F1 = HS->Face(); |
1517 | HS = Handle(BRepAdaptor_Surface)::DownCast(S2); |
1518 | if(!HS.IsNull()) F2 = HS->Face(); |
7fd59977 |
1519 | |
81bba717 |
1520 | // Path framing variables |
03275c0b |
1521 | Standard_Real TolGuide=tolguide; |
7fd59977 |
1522 | Standard_Integer nbptmin = 4; |
1523 | |
af99433e |
1524 | BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide); |
7fd59977 |
1525 | |
81bba717 |
1526 | //Start of removal, 2D path controls |
1527 | //that qui s'accomodent mal des surfaces a parametrages non homogenes |
1528 | //en u et en v are extinguished. |
7fd59977 |
1529 | TheWalk.Check2d(0); |
1530 | |
1531 | Standard_Real MS = MaxStep; |
1532 | Standard_Integer Nbpnt; |
1533 | Standard_Real SpFirst = HGuide->FirstParameter(); |
1534 | Standard_Real SpLast = HGuide->LastParameter(); |
1535 | |
81bba717 |
1536 | // When the start point is inside, the path goes first to the left |
1537 | // to determine the Last for the periodicals. |
7fd59977 |
1538 | Standard_Boolean reverse = (!Forward || Inside); |
1539 | Standard_Real Target; |
1540 | if(reverse){ |
1541 | Target = SpFirst; |
1542 | if(!intf) Target = Last; |
1543 | } |
1544 | else{ |
1545 | Target = SpLast + Abs(SpLast); |
1546 | if(!intl) Target = Last; |
1547 | } |
1548 | |
81bba717 |
1549 | // In case if the singularity is pre-determined, |
1550 | // the path is indicated. |
7fd59977 |
1551 | if (!Spine.IsNull()){ |
1552 | if (Spine->IsTangencyExtremity(Standard_True)) { |
1553 | TopoDS_Vertex V = Spine->FirstVertex(); |
1554 | TopoDS_Edge E = Spine->Edges(1); |
1555 | Standard_Real param = Spine->FirstParameter(); |
1556 | Blend_Point BP; |
1557 | if (CompBlendPoint(V, E, param, F1, F2, BP)) { |
1558 | math_Vector vec(1,4); |
1559 | BP.ParametersOnS1(vec(1),vec(2)); |
1560 | BP.ParametersOnS2(vec(3),vec(4)); |
1561 | Func.Set(param); |
03275c0b |
1562 | if (Func.IsSolution(vec, tolapp3d)) { |
7fd59977 |
1563 | TheWalk.AddSingularPoint(BP); |
1564 | } |
1565 | } |
1566 | } |
1567 | if (Spine->IsTangencyExtremity(Standard_False)) { |
1568 | TopoDS_Vertex V = Spine->LastVertex(); |
1569 | TopoDS_Edge E = Spine->Edges( Spine->NbEdges()); |
1570 | Standard_Real param = Spine->LastParameter(); |
1571 | Blend_Point BP; |
1572 | if (CompBlendPoint(V, E, param, F1, F2, BP)) { |
1573 | math_Vector vec(1,4); |
1574 | BP.ParametersOnS1(vec(1),vec(2)); |
1575 | BP.ParametersOnS2(vec(3),vec(4)); |
1576 | Func.Set(param); |
03275c0b |
1577 | if (Func.IsSolution(vec, tolapp3d)) { |
7fd59977 |
1578 | TheWalk.AddSingularPoint(BP); |
1579 | } |
1580 | } |
1581 | } |
1582 | } |
1583 | |
81bba717 |
1584 | //The starting solution is reframed if necessary. |
7fd59977 |
1585 | //**********************************************// |
1586 | math_Vector ParSol(1,4); |
1587 | Standard_Real NewFirst = PFirst; |
1588 | if(RecOnS1 || RecOnS2){ |
1589 | if(!TheWalk.PerformFirstSection(Func,FInv,PFirst,Target,Soldep, |
03275c0b |
1590 | tolapp3d,TolGuide,RecOnS1,RecOnS2, |
7fd59977 |
1591 | NewFirst,ParSol)){ |
0797d9d3 |
1592 | #ifdef OCCT_DEBUG |
04232180 |
1593 | std::cout<<"ChFi3d_Builder::ComputeData : calculation fail first section"<<std::endl; |
7fd59977 |
1594 | #endif |
1595 | return Standard_False; |
1596 | } |
1597 | } |
1598 | else { |
1599 | ParSol = Soldep; |
1600 | } |
1601 | |
81bba717 |
1602 | //First the valid part is calculate, without caring for the extensions. |
7fd59977 |
1603 | //******************************************************************// |
1604 | Standard_Integer again = 0; |
1605 | Standard_Boolean tchernobyl = 0; |
7fd59977 |
1606 | Standard_Real u1sov = 0., u2sov = 0.; |
7fd59977 |
1607 | TopoDS_Face bif; |
81bba717 |
1608 | //Max step is relevant, but too great, the vector is required to detect |
1609 | //the twists. |
7fd59977 |
1610 | if( (Abs(Last-First) <= MS * 5.) && |
1611 | (Abs(Last-First) >= 0.01*Abs(NewFirst-Target)) ){ |
1612 | MS = Abs(Last-First)*0.2; |
1613 | } |
1614 | |
1615 | while(again < 3){ |
81bba717 |
1616 | //Path. |
7fd59977 |
1617 | if(!again && (MS < 5*TolGuide)) MS = 5*TolGuide; |
1618 | else { |
1619 | if (5*TolGuide > MS) TolGuide = MS/5; |
7fd59977 |
1620 | } |
03275c0b |
1621 | TheWalk.Perform(Func,FInv,NewFirst,Target,MS,tolapp3d,TolGuide, |
1622 | ParSol,Fleche,Appro); |
7fd59977 |
1623 | if (!TheWalk.IsDone()) { |
0797d9d3 |
1624 | #ifdef OCCT_DEBUG |
04232180 |
1625 | std::cout << "Path is not created" << std::endl; |
7fd59977 |
1626 | #endif |
1627 | return Standard_False; |
1628 | } |
1629 | Lin = TheWalk.Line(); |
1630 | if(HGuide->IsPeriodic() && Inside) { |
1631 | SpFirst = Lin->Point(1).Parameter(); |
1632 | SpLast = SpFirst + HGuide->Period(); |
c22b52d6 |
1633 | HGuide->FirstParameter(SpFirst); |
1634 | HGuide->LastParameter (SpLast ); |
1635 | HGuide->SetOrigin(SpFirst); |
1d54b807 |
1636 | if (!OffsetHGuide.IsNull()) |
1637 | { |
c22b52d6 |
1638 | OffsetHGuide->FirstParameter(SpFirst); |
1639 | OffsetHGuide->LastParameter (SpLast ); |
1640 | OffsetHGuide->SetOrigin(SpFirst); |
1d54b807 |
1641 | } |
7fd59977 |
1642 | } |
1643 | Standard_Boolean complmnt = Standard_True; |
1644 | if (Inside) complmnt = TheWalk.Complete(Func,FInv,SpLast); |
1645 | if(!complmnt){ |
0797d9d3 |
1646 | #ifdef OCCT_DEBUG |
04232180 |
1647 | std::cout << "Not completed" << std::endl; |
7fd59977 |
1648 | #endif |
1649 | return Standard_False; |
1650 | } |
1651 | |
81bba717 |
1652 | //The result is controlled using two criterions : |
1653 | //- if there is enough points, |
1654 | //- if one has gone far enough. |
7fd59977 |
1655 | Nbpnt = Lin->NbPoints(); |
1656 | if (Nbpnt == 0){ |
0797d9d3 |
1657 | #ifdef OCCT_DEBUG |
04232180 |
1658 | std::cout <<"0 point of path, quit."<<std::endl; |
7fd59977 |
1659 | #endif |
1660 | return Standard_False; |
1661 | } |
1662 | Standard_Real fpointpar = Lin->Point(1).Parameter(); |
1663 | Standard_Real lpointpar = Lin->Point(Nbpnt).Parameter(); |
1664 | |
1665 | Standard_Real factor = 1./(nbptmin + 1); |
1666 | Standard_Boolean okdeb = (Forward && !Inside); |
1667 | Standard_Boolean okfin = (!Forward && !Inside); |
1668 | if(!okdeb){ |
1669 | Standard_Integer narc1 = Lin->StartPointOnFirst().NbPointOnRst(); |
1670 | Standard_Integer narc2 = Lin->StartPointOnSecond().NbPointOnRst(); |
1671 | okdeb = (narc1 > 0 || narc2 > 0 || (fpointpar-First) < 10*TolGuide); |
1672 | } |
1673 | if(!okfin){ |
1674 | Standard_Integer narc1 = Lin->EndPointOnFirst().NbPointOnRst(); |
1675 | Standard_Integer narc2 = Lin->EndPointOnSecond().NbPointOnRst(); |
1676 | okfin = (narc1 > 0 || narc2 > 0 || (Last-lpointpar) < 10*TolGuide); |
1677 | } |
1678 | if(!okdeb || !okfin || Nbpnt == 1){ |
81bba717 |
1679 | //It drags, the controls are extended, it is expected to evaluate a |
1680 | //satisfactory maximum step. If it already done, quit. |
7fd59977 |
1681 | if(tchernobyl){ |
0797d9d3 |
1682 | #ifdef OCCT_DEBUG |
04232180 |
1683 | std::cout <<"If it drags without control, quit."<<std::endl; |
7fd59977 |
1684 | #endif |
1685 | return Standard_False; |
1686 | } |
1687 | tchernobyl = Standard_True; |
1688 | TheWalk.Check(0); |
1689 | if (Nbpnt == 1){ |
0797d9d3 |
1690 | #ifdef OCCT_DEBUG |
04232180 |
1691 | std::cout <<"only one point of path MS/100 is attempted"<<std::endl; |
1692 | std::cout <<"and the controls are extended."<<std::endl; |
7fd59977 |
1693 | #endif |
1694 | MS *= 0.01; |
1695 | } |
1696 | else{ |
0797d9d3 |
1697 | #ifdef OCCT_DEBUG |
04232180 |
1698 | std::cout <<"It drags, the controls are extended."<<std::endl; |
7fd59977 |
1699 | #endif |
1700 | MS = (lpointpar-fpointpar)/Nbpnt; //EvalStep(Lin); |
1701 | } |
1702 | } |
1703 | else if (Nbpnt < nbptmin){ |
1704 | if(again == 0){ |
0797d9d3 |
1705 | #ifdef OCCT_DEBUG |
04232180 |
1706 | std::cout <<"Number of points is too small, the step is reduced"<<std::endl; |
7fd59977 |
1707 | #endif |
1708 | u1sov = fpointpar; |
1709 | u2sov = lpointpar; |
1710 | MS = (lpointpar - fpointpar) * factor; |
1711 | } |
1712 | else if(again == 1){ |
1713 | if(Abs(fpointpar-u1sov)>=TolGuide || |
1714 | Abs(lpointpar-u2sov)>=TolGuide){ |
0797d9d3 |
1715 | #ifdef OCCT_DEBUG |
04232180 |
1716 | std::cout <<"Number of points is still too small, the step is reduced"<<std::endl; |
7fd59977 |
1717 | #endif |
1718 | MS = (lpointpar - fpointpar) * factor; |
1719 | } |
1720 | else{ |
0797d9d3 |
1721 | #ifdef OCCT_DEBUG |
04232180 |
1722 | std::cout <<"Number of points is still too small, quit"<<std::endl; |
7fd59977 |
1723 | #endif |
1724 | return Standard_False; |
1725 | } |
1726 | } |
1727 | again++; |
1728 | } |
1729 | else { |
1730 | again = 3; |
1731 | } |
1732 | } |
1733 | |
1734 | if(TheWalk.TwistOnS1()){ |
1735 | Data->TwistOnS1(Standard_True); |
0797d9d3 |
1736 | #ifdef OCCT_DEBUG |
04232180 |
1737 | std::cout<<"Path completed, but TWIST on S1"<<std::endl; |
7fd59977 |
1738 | #endif |
1739 | } |
1740 | if(TheWalk.TwistOnS2()){ |
1741 | Data->TwistOnS2(Standard_True); |
0797d9d3 |
1742 | #ifdef OCCT_DEBUG |
04232180 |
1743 | std::cout<<"Parh completed, but TWIST on S2"<<std::endl; |
7fd59977 |
1744 | #endif |
1745 | } |
1746 | |
1747 | |
81bba717 |
1748 | //Here there is a more or less presentable result |
1749 | //however it covers a the minimum zone. |
1750 | //The extensions are targeted. |
7fd59977 |
1751 | //*****************************// |
1752 | |
1753 | Gd1 = Gd2 = Gf1 = Gf2 = Standard_False; |
1754 | |
1755 | Standard_Boolean unseulsuffitdeb = (intf >= 2); |
1756 | Standard_Boolean unseulsuffitfin = (intl >= 2); |
1757 | Standard_Boolean noproldeb = (intf >= 3); |
1758 | Standard_Boolean noprolfin = (intl >= 3); |
1759 | |
1760 | Standard_Real Rab = 0.03*(SpLast-SpFirst); |
1761 | |
1762 | Standard_Boolean debarc1 = 0, debarc2 = 0; |
1763 | Standard_Boolean debcas1 = 0, debcas2 = 0; |
1764 | Standard_Boolean debobst1 = 0, debobst2 = 0; |
1765 | |
1766 | Standard_Boolean finarc1 = 0, finarc2 = 0; |
1767 | Standard_Boolean fincas1 = 0, fincas2 = 0; |
1768 | Standard_Boolean finobst1 = 0, finobst2 = 0; |
1769 | |
1770 | Standard_Integer narc1, narc2; |
1771 | |
1772 | Standard_Boolean backwContinueFailed = Standard_False; // eap |
1773 | if(reverse && intf) { |
1774 | narc1 = Lin->StartPointOnFirst().NbPointOnRst(); |
1775 | narc2 = Lin->StartPointOnSecond().NbPointOnRst(); |
1776 | if(narc1 != 0) { |
1777 | ChFi3d_FilCommonPoint(Lin->StartPointOnFirst(),Lin->TransitionOnS1(), |
03275c0b |
1778 | Standard_True, Data->ChangeVertexFirstOnS1(), tolapp3d); |
7fd59977 |
1779 | debarc1 = Standard_True; |
1780 | if(!SearchFace(Spine,Data->VertexFirstOnS1(),F1,bif)){ |
81bba717 |
1781 | //It is checked if there is not an obstacle. |
7fd59977 |
1782 | debcas1 = Standard_True; |
1783 | if(!Spine.IsNull()){ |
1784 | if(Spine->IsPeriodic()){ |
1785 | debobst1 = 1; |
1786 | } |
1787 | else{ |
1788 | debobst1 = IsObst(Data->VertexFirstOnS1(), |
1789 | Spine->FirstVertex(),myVEMap); |
1790 | } |
1791 | } |
1792 | } |
1793 | } |
1794 | if(narc2 != 0){ |
1795 | ChFi3d_FilCommonPoint(Lin->StartPointOnSecond(),Lin->TransitionOnS2(), |
03275c0b |
1796 | Standard_True, Data->ChangeVertexFirstOnS2(),tolapp3d); |
7fd59977 |
1797 | debarc2 = Standard_True; |
1798 | if(!SearchFace(Spine,Data->VertexFirstOnS2(),F2,bif)){ |
81bba717 |
1799 | //It is checked if it is not an obstacle. |
7fd59977 |
1800 | debcas2 = Standard_True; |
1801 | if(!Spine.IsNull()){ |
1802 | if(Spine->IsPeriodic()){ |
1803 | debobst2 = 1; |
1804 | } |
1805 | else{ |
1806 | debobst2 = IsObst(Data->VertexFirstOnS2(), |
1807 | Spine->FirstVertex(),myVEMap); |
1808 | } |
1809 | } |
1810 | } |
1811 | } |
1812 | Standard_Boolean oncontinue = !noproldeb && (narc1 != 0 || narc2 != 0); |
1813 | if(debobst1 || debobst2) oncontinue = Standard_False; |
1814 | else if(debcas1 && debcas2) oncontinue = Standard_False; |
1815 | else if((!debcas1 && debarc1) || (!debcas2 && debarc2)) oncontinue = Standard_False; |
1816 | |
1817 | if(oncontinue) { |
1818 | TheWalk.ClassificationOnS1(!debarc1); |
1819 | TheWalk.ClassificationOnS2(!debarc2); |
81bba717 |
1820 | TheWalk.Check2d(Standard_True); // It should be strict (PMN) |
7fd59977 |
1821 | TheWalk.Continu(Func,FInv,Target); |
1822 | TheWalk.ClassificationOnS1(Standard_True); |
1823 | TheWalk.ClassificationOnS2(Standard_True); |
1824 | TheWalk.Check2d(Standard_False); |
1825 | narc1 = Lin->StartPointOnFirst().NbPointOnRst(); |
1826 | narc2 = Lin->StartPointOnSecond().NbPointOnRst(); |
1827 | // modified by eap Fri Feb 8 11:43:48 2002 ___BEGIN___ |
eafb234b |
1828 | if(!debarc1) { |
7fd59977 |
1829 | if (narc1 == 0) |
1830 | backwContinueFailed = Lin->StartPointOnFirst().ParameterOnGuide() > Target; |
1831 | else { |
1832 | ChFi3d_FilCommonPoint(Lin->StartPointOnFirst(),Lin->TransitionOnS1(), |
03275c0b |
1833 | Standard_True, Data->ChangeVertexFirstOnS1(), tolapp3d); |
7fd59977 |
1834 | debarc1 = Standard_True; |
1835 | if(!SearchFace(Spine,Data->VertexFirstOnS1(),F1,bif)){ |
81bba717 |
1836 | //It is checked if it is not an obstacle. |
7fd59977 |
1837 | debcas1 = Standard_True; |
1838 | // if(!Spine.IsNull()) { |
1839 | // if(Spine->IsPeriodic()){ |
1840 | // debobst1 = 1; |
1841 | // } |
1842 | // else{ |
1843 | // debobst1 = IsObst(Data->VertexFirstOnS1(), |
1844 | // Spine->FirstVertex(),myVEMap); |
1845 | // } |
1846 | // } |
1847 | } |
1848 | } |
eafb234b |
1849 | } |
1850 | if(!debarc2) { |
7fd59977 |
1851 | if (narc2 == 0) |
1852 | backwContinueFailed = Lin->StartPointOnSecond().ParameterOnGuide() > Target; |
1853 | else { |
1854 | ChFi3d_FilCommonPoint(Lin->StartPointOnSecond(),Lin->TransitionOnS2(), |
03275c0b |
1855 | Standard_True, Data->ChangeVertexFirstOnS2(), tolapp3d); |
7fd59977 |
1856 | debarc2 = Standard_True; |
1857 | if(!SearchFace(Spine,Data->VertexFirstOnS2(),F2,bif)){ |
81bba717 |
1858 | //It is checked if it is not an obstacle. |
7fd59977 |
1859 | debcas2 = Standard_True; |
1860 | // if(!Spine.IsNull()){ |
1861 | // if(Spine->IsPeriodic()){ |
1862 | // debobst2 = 1; |
1863 | // } |
1864 | // else{ |
1865 | // debobst2 = IsObst(Data->VertexFirstOnS2(), |
1866 | // Spine->FirstVertex(),myVEMap); |
1867 | // } |
1868 | // } |
1869 | } |
1870 | } |
eafb234b |
1871 | } |
7fd59977 |
1872 | if (backwContinueFailed) { |
1873 | // if we leave backwContinueFailed as is, we will stop in this direction |
1874 | // but we are to continue if there are no more faces on the side with arc |
1875 | // check this condition |
1876 | const ChFiDS_CommonPoint& aCP |
1877 | = debarc1 ? Data->VertexFirstOnS1() : Data->VertexFirstOnS2(); |
1878 | if (aCP.IsOnArc() && bif.IsNull()) |
1879 | backwContinueFailed = Standard_False; |
1880 | } |
1881 | } |
1882 | } |
1883 | Standard_Boolean forwContinueFailed = Standard_False; |
1884 | // modified by eap Fri Feb 8 11:44:11 2002 ___END___ |
1885 | if(Forward && intl) { |
1886 | Target = SpLast; |
1887 | narc1 = Lin->EndPointOnFirst().NbPointOnRst(); |
1888 | narc2 = Lin->EndPointOnSecond().NbPointOnRst(); |
1889 | if(narc1 != 0){ |
1890 | ChFi3d_FilCommonPoint(Lin->EndPointOnFirst(),Lin->TransitionOnS1(), |
03275c0b |
1891 | Standard_False, Data->ChangeVertexLastOnS1(), tolapp3d); |
7fd59977 |
1892 | finarc1 = Standard_True; |
1893 | if(!SearchFace(Spine,Data->VertexLastOnS1(),F1,bif)){ |
81bba717 |
1894 | //It is checked if it is not an obstacle. |
7fd59977 |
1895 | fincas1 = Standard_True; |
1896 | if(!Spine.IsNull()){ |
1897 | finobst1 = IsObst(Data->VertexLastOnS1(), |
1898 | Spine->LastVertex(),myVEMap); |
1899 | } |
1900 | } |
1901 | } |
1902 | if(narc2 != 0){ |
1903 | ChFi3d_FilCommonPoint(Lin->EndPointOnSecond(),Lin->TransitionOnS2(), |
03275c0b |
1904 | Standard_False, Data->ChangeVertexLastOnS2(), tolapp3d); |
7fd59977 |
1905 | finarc2 = Standard_True; |
1906 | if(!SearchFace(Spine,Data->VertexLastOnS2(),F2,bif)){ |
81bba717 |
1907 | //It is checked if it is not an obstacle. |
7fd59977 |
1908 | fincas2 = Standard_True; |
1909 | if(!Spine.IsNull()){ |
1910 | finobst2 = IsObst(Data->VertexLastOnS2(), |
1911 | Spine->LastVertex(),myVEMap); |
1912 | } |
1913 | } |
1914 | } |
1915 | Standard_Boolean oncontinue = !noprolfin && (narc1 != 0 || narc2 != 0); |
1916 | if(finobst1 || finobst2) oncontinue = Standard_False; |
1917 | else if(fincas1 && fincas2) oncontinue = Standard_False; |
1918 | else if((!fincas1 && finarc1) || (!fincas2 && finarc2)) oncontinue = Standard_False; |
1919 | |
1920 | if(oncontinue){ |
1921 | TheWalk.ClassificationOnS1(!finarc1); |
1922 | TheWalk.ClassificationOnS2(!finarc2); |
81bba717 |
1923 | TheWalk.Check2d(Standard_True); // It should be strict (PMN) |
7fd59977 |
1924 | TheWalk.Continu(Func,FInv,Target); |
1925 | TheWalk.ClassificationOnS1(Standard_True); |
1926 | TheWalk.ClassificationOnS2(Standard_True); |
1927 | TheWalk.Check2d(Standard_False); |
1928 | narc1 = Lin->EndPointOnFirst().NbPointOnRst(); |
1929 | narc2 = Lin->EndPointOnSecond().NbPointOnRst(); |
1930 | // modified by eap Fri Feb 8 11:44:57 2002 ___BEGIN___ |
eafb234b |
1931 | if(!finarc1) { |
7fd59977 |
1932 | if (narc1 == 0) |
1933 | forwContinueFailed = Lin->EndPointOnFirst().ParameterOnGuide() < Target; |
1934 | else { |
1935 | ChFi3d_FilCommonPoint(Lin->EndPointOnFirst(),Lin->TransitionOnS1(), |
03275c0b |
1936 | Standard_False, Data->ChangeVertexLastOnS1(), tolapp3d); |
7fd59977 |
1937 | finarc1 = Standard_True; |
1938 | if(!SearchFace(Spine,Data->VertexLastOnS1(),F1,bif)){ |
81bba717 |
1939 | //It is checked if it is not an obstacle. |
7fd59977 |
1940 | fincas1 = Standard_True; |
1941 | // if(!Spine.IsNull()){ |
1942 | // finobst1 = IsObst(Data->VertexLastOnS1(), |
1943 | // Spine->LastVertex(),myVEMap); |
1944 | // } |
1945 | } |
1946 | } |
eafb234b |
1947 | } |
1948 | if(!finarc2) { |
7fd59977 |
1949 | if (narc2 == 0) |
1950 | forwContinueFailed = Lin->EndPointOnSecond().ParameterOnGuide() < Target; |
1951 | else { |
1952 | ChFi3d_FilCommonPoint(Lin->EndPointOnSecond(),Lin->TransitionOnS2(), |
03275c0b |
1953 | Standard_False, Data->ChangeVertexLastOnS2(), tolapp3d); |
7fd59977 |
1954 | finarc2 = Standard_True; |
1955 | if(!SearchFace(Spine,Data->VertexLastOnS2(),F2,bif)){ |
1956 | //On regarde si ce n'est pas un obstacle. |
1957 | fincas2 = Standard_True; |
1958 | // if(!Spine.IsNull()){ |
1959 | // finobst2 = IsObst(Data->VertexLastOnS2(), |
1960 | // Spine->LastVertex(),myVEMap); |
1961 | // } |
1962 | } |
1963 | } |
eafb234b |
1964 | } |
7fd59977 |
1965 | if (forwContinueFailed) { |
1966 | // if we leave forwContinueFailed as is, we will stop in this direction |
1967 | // but we are to continue if there are no more faces on the side with arc |
1968 | // check this condition |
1969 | const ChFiDS_CommonPoint& aCP |
1970 | = finarc1 ? Data->VertexLastOnS1() : Data->VertexLastOnS2(); |
1971 | if (aCP.IsOnArc() && bif.IsNull()) |
1972 | forwContinueFailed = Standard_False; |
1973 | } |
1974 | // modified by eap Fri Feb 8 11:45:10 2002 ___END___ |
1975 | } |
1976 | } |
1977 | Nbpnt = Lin->NbPoints(); |
1978 | #ifdef DRAW |
1979 | if(ChFi3d_GettraceDRAWWALK()) drawline(Lin,Standard_False); |
1980 | #endif |
1981 | First = Lin->Point(1).Parameter(); |
1982 | Last = Lin->Point(Nbpnt).Parameter(); |
1983 | |
1984 | // ============= INVALIDATION EVENTUELLE ============= |
1985 | // ------ Preparation des prolongement par plan tangent ----- |
1986 | if(reverse && intf){ |
1987 | Gd1 = debcas1/* && !debobst1*/; // skv(occ67) |
1988 | Gd2 = debcas2/* && !debobst2*/; // skv(occ67) |
1989 | if ((debarc1^debarc2) && !unseulsuffitdeb && (First!=SpFirst)) { |
81bba717 |
1990 | // Case of incomplete path, of course this ends badly : |
1991 | // the result is truncated instead of exit. |
7fd59977 |
1992 | Standard_Real sortie; |
1993 | Standard_Integer ind; |
1994 | if (debarc1) sortie = Data->VertexFirstOnS1().Parameter(); |
1995 | else sortie = Data->VertexFirstOnS2().Parameter(); |
1996 | if (sortie - First > tolesp) { |
1997 | ind = SearchIndex(sortie, Lin); |
1998 | if (Lin->Point(ind).Parameter() == sortie) ind--; |
1999 | if (ind >= 1) { |
2000 | Lin->Remove(1, ind); |
2001 | UpdateLine(Lin, Standard_True); |
2002 | } |
2003 | Nbpnt = Lin->NbPoints(); |
2004 | First = Lin->Point(1).Parameter(); |
2005 | } |
2006 | } |
2007 | else if ((intf>=5) && !debarc1 && !debarc2 && (First!=SpFirst)) { |
2008 | Standard_Real sortie = (2*First+Last)/3; |
2009 | Standard_Integer ind; |
2010 | if (sortie - First > tolesp) { |
2011 | ind = SearchIndex(sortie, Lin); |
2012 | if (Lin->Point(ind).Parameter() == sortie) ind--; |
2013 | if (Nbpnt-ind < 3) ind = Nbpnt -3; |
2014 | if (ind >= 1) { |
2015 | Lin->Remove(1, ind); |
2016 | UpdateLine(Lin, Standard_True); |
2017 | } |
2018 | Nbpnt = Lin->NbPoints(); |
2019 | First = Lin->Point(1).Parameter(); |
2020 | } |
2021 | } |
2022 | if(Gd1 && Gd2){ |
2023 | Target = Min((Lin->Point(1).Parameter() - Rab),First); |
2024 | Target = Max(Target,SpFirst); |
2025 | Data->FirstExtensionValue(Abs(Lin->Point(1).Parameter()-Target)); |
2026 | } |
2027 | if (intf && !unseulsuffitdeb) intf = (Gd1 && Gd2)//; |
2028 | || backwContinueFailed; // eap |
2029 | else if (intf && unseulsuffitdeb && (intf<5)) { |
2030 | intf = (Gd1 || Gd2); |
81bba717 |
2031 | // It is checked if there is no new face. |
7fd59977 |
2032 | if (intf && |
2033 | ((!debcas1 && debarc1) || (!debcas2 && debarc2)) ) intf = 0; |
2034 | } |
2035 | else if (intf < 5) intf = 0; |
2036 | } |
2037 | |
2038 | if(Forward && intl){ |
2039 | Gf1 = fincas1/* && !finobst1*/; // skv(occ67) |
2040 | Gf2 = fincas2/* && !finobst2*/; // skv(occ67) |
2041 | if ((finarc1 ^finarc2) && !unseulsuffitfin && (Last!=SpLast)) { |
81bba717 |
2042 | // Case of incomplete path, of course, this ends badly : |
2043 | // the result is truncated instead of exit. |
7fd59977 |
2044 | Standard_Real sortie; |
2045 | Standard_Integer ind; |
2046 | if (finarc1) sortie = Data->VertexLastOnS1().Parameter(); |
2047 | else sortie = Data->VertexLastOnS2().Parameter(); |
2048 | if (Last - sortie > tolesp) { |
2049 | ind = SearchIndex(sortie, Lin); |
2050 | if (Lin->Point(ind).Parameter() == sortie) ind++; |
2051 | if (ind<= Nbpnt) { |
2052 | Lin->Remove(ind, Nbpnt); |
2053 | UpdateLine(Lin, Standard_False); |
2054 | } |
2055 | Nbpnt = Lin->NbPoints(); |
2056 | Last = Lin->Point(Nbpnt).Parameter(); |
2057 | } |
2058 | } |
2059 | else if ((intl>=5) && !finarc1 && !finarc2 && (Last!=SpLast) ) { |
81bba717 |
2060 | // The same in case when the entire "Lin" is an extension |
7fd59977 |
2061 | Standard_Real sortie = (First+2*Last)/3; |
2062 | Standard_Integer ind; |
2063 | if (Last - sortie > tolesp) { |
2064 | ind = SearchIndex(sortie, Lin); |
2065 | if (Lin->Point(ind).Parameter() == sortie) ind++; |
2066 | if (ind < 3) ind = 3; |
2067 | if (ind <= Nbpnt) { |
2068 | Lin->Remove(ind, Nbpnt); |
2069 | UpdateLine(Lin, Standard_False); |
2070 | } |
2071 | Nbpnt = Lin->NbPoints(); |
2072 | Last = Lin->Point(Nbpnt).Parameter(); |
2073 | } |
2074 | } |
2075 | if(Gf1 && Gf2) { |
2076 | Target = Max((Lin->Point(Nbpnt).Parameter() + Rab),Last); |
2077 | Target = Min(Target,SpLast); |
2078 | Data->LastExtensionValue(Abs(Target-Lin->Point(Nbpnt).Parameter())); |
2079 | } |
2080 | |
2081 | if (intl && !unseulsuffitfin) intl = (Gf1 && Gf2)//; |
2082 | || forwContinueFailed; // eap |
2083 | else if (intl && unseulsuffitfin && (intl<5)) { |
81bba717 |
2084 | intl = (Gf1 || Gf2);// It is checked if there is no new face. |
7fd59977 |
2085 | if (intl && |
2086 | ((!fincas1 && finarc1) || (!fincas2 && finarc2)) ) intl = 0; |
2087 | } |
2088 | else if (intl <5) intl = 0; |
2089 | } |
2090 | return Standard_True; |
2091 | } |
2092 | |
2093 | //======================================================================= |
2094 | //function : SimulData |
2095 | //purpose : |
2096 | //======================================================================= |
2097 | |
2098 | Standard_Boolean ChFi3d_Builder::SimulData |
2099 | (Handle(ChFiDS_SurfData)& /*Data*/, |
c22b52d6 |
2100 | const Handle(ChFiDS_ElSpine)& HGuide, |
2101 | const Handle(ChFiDS_ElSpine)& AdditionalHGuide, |
7fd59977 |
2102 | Handle(BRepBlend_Line)& Lin, |
c22b52d6 |
2103 | const Handle(Adaptor3d_Surface)& S1, |
7fd59977 |
2104 | const Handle(Adaptor3d_TopolTool)& I1, |
c22b52d6 |
2105 | const Handle(Adaptor3d_Surface)& S2, |
7fd59977 |
2106 | const Handle(Adaptor3d_TopolTool)& I2, |
2107 | Blend_Function& Func, |
2108 | Blend_FuncInv& FInv, |
2109 | const Standard_Real PFirst, |
2110 | const Standard_Real MaxStep, |
2111 | const Standard_Real Fleche, |
2112 | const Standard_Real tolguide, |
2113 | Standard_Real& First, |
2114 | Standard_Real& Last, |
2115 | const Standard_Boolean Inside, |
2116 | const Standard_Boolean Appro, |
2117 | const Standard_Boolean Forward, |
2118 | const math_Vector& Soldep, |
2119 | const Standard_Integer NbSecMin, |
2120 | const Standard_Boolean RecOnS1, |
2121 | const Standard_Boolean RecOnS2) |
2122 | { |
af99433e |
2123 | BRepBlend_Walking TheWalk(S1,S2,I1,I2,HGuide); |
7fd59977 |
2124 | TheWalk.Check2d(Standard_False); |
2125 | |
2126 | Standard_Real MS = MaxStep; |
03275c0b |
2127 | Standard_Real TolGuide=tolguide; |
1d47d8d0 |
2128 | Standard_Integer Nbpnt = 0; |
7fd59977 |
2129 | Standard_Real SpFirst = HGuide->FirstParameter(); |
2130 | Standard_Real SpLast = HGuide->LastParameter(); |
2131 | Standard_Boolean reverse = (!Forward || Inside); |
2132 | Standard_Real Target; |
2133 | if(reverse){ |
2134 | Target = SpFirst; |
2135 | } |
2136 | else{ |
2137 | Target = SpLast; |
2138 | } |
2139 | |
2140 | Standard_Real Targetsov = Target; |
7fd59977 |
2141 | Standard_Real u1sov = 0., u2sov = 0.; |
7fd59977 |
2142 | // on recadre la solution de depart a la demande. |
2143 | math_Vector ParSol(1,4); |
2144 | Standard_Real NewFirst = PFirst; |
2145 | if(RecOnS1 || RecOnS2){ |
2146 | if(!TheWalk.PerformFirstSection(Func,FInv,PFirst,Target,Soldep, |
03275c0b |
2147 | tolapp3d,TolGuide,RecOnS1,RecOnS2, |
7fd59977 |
2148 | NewFirst,ParSol)){ |
0797d9d3 |
2149 | #ifdef OCCT_DEBUG |
04232180 |
2150 | std::cout<<"ChFi3d_Builder::SimulData : calculation fail first section"<<std::endl; |
7fd59977 |
2151 | #endif |
2152 | return Standard_False; |
2153 | } |
2154 | } |
2155 | else { |
2156 | ParSol = Soldep; |
2157 | } |
2158 | Standard_Integer again = 0; |
2159 | while(again < 3){ |
81bba717 |
2160 | // When the start point is inside, the path goes first to the left |
2161 | // to determine the Last for the periodicals. |
7fd59977 |
2162 | if(!again && (MS < 5*TolGuide)) MS = 5*TolGuide; |
2163 | else { |
2164 | if (5*TolGuide > MS) TolGuide = MS/5; |
7fd59977 |
2165 | } |
2166 | |
03275c0b |
2167 | TheWalk.Perform(Func,FInv,NewFirst,Target,MS,tolapp3d,TolGuide, |
2168 | ParSol,Fleche,Appro); |
7fd59977 |
2169 | |
2170 | if (!TheWalk.IsDone()) { |
0797d9d3 |
2171 | #ifdef OCCT_DEBUG |
04232180 |
2172 | std::cout << "Path not created" << std::endl; |
7fd59977 |
2173 | #endif |
2174 | return Standard_False; |
2175 | } |
2176 | Lin = TheWalk.Line(); |
2177 | if(reverse){ |
2178 | if(HGuide->IsPeriodic()) { |
2179 | SpFirst = Lin->Point(1).Parameter(); |
2180 | SpLast = SpFirst + HGuide->Period(); |
c22b52d6 |
2181 | HGuide->FirstParameter(SpFirst); |
2182 | HGuide->LastParameter (SpLast ); |
1d54b807 |
2183 | if (!AdditionalHGuide.IsNull()) |
2184 | { |
c22b52d6 |
2185 | AdditionalHGuide->FirstParameter(SpFirst); |
2186 | AdditionalHGuide->LastParameter (SpLast ); |
1d54b807 |
2187 | } |
7fd59977 |
2188 | } |
2189 | Standard_Boolean complmnt = Standard_True; |
2190 | if (Inside) complmnt = TheWalk.Complete(Func,FInv,SpLast); |
2191 | if(!complmnt){ |
0797d9d3 |
2192 | #ifdef OCCT_DEBUG |
04232180 |
2193 | std::cout << "Not completed" << std::endl; |
7fd59977 |
2194 | #endif |
2195 | return Standard_False; |
2196 | } |
2197 | } |
2198 | Nbpnt = Lin->NbPoints(); |
2199 | Standard_Real factor = 1./(NbSecMin + 1); |
2200 | if (Nbpnt == 0){ |
0797d9d3 |
2201 | #ifdef OCCT_DEBUG |
04232180 |
2202 | std::cout <<"0 point of path, quit."<<std::endl; |
7fd59977 |
2203 | #endif |
2204 | return Standard_False; |
2205 | } |
2206 | else if (Nbpnt == 1 && again == 0) { |
2207 | again++; |
0797d9d3 |
2208 | #ifdef OCCT_DEBUG |
04232180 |
2209 | std::cout <<"only one point of path, MS/100 is attempted."<<std::endl; |
7fd59977 |
2210 | #endif |
2211 | MS *= 0.01; Target = Targetsov; |
2212 | u1sov = u2sov = Lin->Point(1).Parameter(); |
2213 | } |
2214 | else if (Nbpnt< NbSecMin && again == 0) { |
2215 | again++; |
0797d9d3 |
2216 | #ifdef OCCT_DEBUG |
04232180 |
2217 | std::cout <<"Number of points is too small, the step is reduced"<<std::endl; |
7fd59977 |
2218 | #endif |
2219 | Standard_Real u1 = u1sov = Lin->Point(1).Parameter(); |
2220 | Standard_Real u2 = u2sov = Lin->Point(Nbpnt).Parameter(); |
2221 | MS = (u2-u1)*factor; |
2222 | Target = Targetsov; |
2223 | } |
2224 | else if (Nbpnt < NbSecMin && again == 1) { |
2225 | Standard_Real u1 = Lin->Point(1).Parameter(); |
2226 | Standard_Real u2 = Lin->Point(Nbpnt).Parameter(); |
2227 | if(Abs(u1-u1sov)>=TolGuide || Abs(u2-u2sov)>=TolGuide){ |
2228 | again++; |
0797d9d3 |
2229 | #ifdef OCCT_DEBUG |
04232180 |
2230 | std::cout <<"Number of points is still too small, the step is reduced"<<std::endl; |
7fd59977 |
2231 | #endif |
2232 | MS /= 100; |
2233 | Target = Targetsov; |
2234 | } |
2235 | else{ |
0797d9d3 |
2236 | #ifdef OCCT_DEBUG |
04232180 |
2237 | std::cout <<"Number of points is still too small, quit"<<std::endl; |
7fd59977 |
2238 | #endif |
2239 | return Standard_False; |
2240 | } |
2241 | } |
2242 | else if(Nbpnt < NbSecMin){ |
0797d9d3 |
2243 | #ifdef OCCT_DEBUG |
04232180 |
2244 | std::cout <<"Number of points is still too small, quit"<<std::endl; |
7fd59977 |
2245 | #endif |
2246 | return Standard_False; |
2247 | } |
2248 | else { |
2249 | again = 3; |
2250 | } |
2251 | } |
2252 | #ifdef DRAW |
2253 | if(ChFi3d_GettraceDRAWWALK()) drawline(Lin,Standard_False); |
2254 | #endif |
2255 | First = Lin->Point(1).Parameter(); |
2256 | Last = Lin->Point(Nbpnt).Parameter(); |
2257 | return Standard_True; |
2258 | } |
2259 | |