b311480e |
1 | // Created on: 1994-03-29 |
2 | // Created by: Isabelle GRIGNON |
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. |
7fd59977 |
16 | |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <Adaptor3d_CurveOnSurface.hxx> |
c22b52d6 |
19 | #include <Adaptor3d_CurveOnSurface.hxx> |
42cf5bc1 |
20 | #include <Adaptor3d_TopolTool.hxx> |
21 | #include <BRep_Tool.hxx> |
22 | #include <BRepAdaptor_Curve.hxx> |
23 | #include <BRepAdaptor_Curve2d.hxx> |
c22b52d6 |
24 | #include <BRepAdaptor_Curve.hxx> |
25 | #include <BRepAdaptor_Curve2d.hxx> |
26 | #include <BRepAdaptor_Surface.hxx> |
42cf5bc1 |
27 | #include <BRepAdaptor_Surface.hxx> |
28 | #include <BRepBlend_CSCircular.hxx> |
29 | #include <BRepBlend_Line.hxx> |
30 | #include <BRepLProp_CLProps.hxx> |
31 | #include <BRepTopAdaptor_TopolTool.hxx> |
32 | #include <BSplCLib.hxx> |
7fd59977 |
33 | #include <ChFi3d.hxx> |
34 | #include <ChFi3d_Builder_0.hxx> |
42cf5bc1 |
35 | #include <ChFi3d_FilBuilder.hxx> |
36 | #include <ChFiDS_CommonPoint.hxx> |
37 | #include <ChFiDS_FaceInterference.hxx> |
38 | #include <ChFiDS_FilSpine.hxx> |
39 | #include <ChFiDS_HData.hxx> |
c22b52d6 |
40 | #include <ChFiDS_ElSpine.hxx> |
42cf5bc1 |
41 | #include <ChFiDS_ListIteratorOfListOfStripe.hxx> |
42 | #include <ChFiDS_Regul.hxx> |
43 | #include <ChFiDS_SequenceOfSurfData.hxx> |
44 | #include <ChFiDS_Spine.hxx> |
45 | #include <ChFiDS_State.hxx> |
46 | #include <ChFiDS_Stripe.hxx> |
47 | #include <ChFiDS_SurfData.hxx> |
48 | #include <ChFiKPart_ComputeData.hxx> |
7fd59977 |
49 | #include <Geom2d_BSplineCurve.hxx> |
42cf5bc1 |
50 | #include <Geom2d_TrimmedCurve.hxx> |
51 | #include <Geom2dAdaptor_Curve.hxx> |
c22b52d6 |
52 | #include <Geom2dAdaptor_Curve.hxx> |
7fd59977 |
53 | #include <Geom2dConvert.hxx> |
42cf5bc1 |
54 | #include <Geom_BSplineCurve.hxx> |
55 | #include <Geom_BSplineSurface.hxx> |
7fd59977 |
56 | #include <GeomAdaptor_Curve.hxx> |
c22b52d6 |
57 | #include <GeomAdaptor_Curve.hxx> |
58 | #include <GeomAdaptor_Surface.hxx> |
42cf5bc1 |
59 | #include <GeomAdaptor_Surface.hxx> |
7fd59977 |
60 | #include <GeomFill_ConstrainedFilling.hxx> |
61 | #include <GeomFill_SimpleBound.hxx> |
42cf5bc1 |
62 | #include <gp_Ax3.hxx> |
63 | #include <gp_Dir.hxx> |
64 | #include <gp_Lin.hxx> |
65 | #include <gp_Pln.hxx> |
66 | #include <gp_Pnt.hxx> |
67 | #include <gp_Pnt2d.hxx> |
68 | #include <gp_XY.hxx> |
69 | #include <IntCurveSurface_HInter.hxx> |
70 | #include <IntCurveSurface_IntersectionPoint.hxx> |
7fd59977 |
71 | #include <IntSurf_LineOn2S.hxx> |
72 | #include <IntSurf_Transition.hxx> |
73 | #include <IntSurf_TypeTrans.hxx> |
42cf5bc1 |
74 | #include <Law_Function.hxx> |
75 | #include <Law_Linear.hxx> |
76 | #include <math_Vector.hxx> |
77 | #include <Standard_ErrorHandler.hxx> |
78 | #include <Standard_NotImplemented.hxx> |
79 | #include <StdFail_NotDone.hxx> |
80 | #include <TColgp_Array1OfPnt.hxx> |
81 | #include <TColgp_Array1OfPnt2d.hxx> |
82 | #include <TColStd_Array1OfInteger.hxx> |
83 | #include <TColStd_Array1OfReal.hxx> |
84 | #include <TColStd_ListOfInteger.hxx> |
85 | #include <TopAbs.hxx> |
86 | #include <TopAbs_Orientation.hxx> |
87 | #include <TopExp.hxx> |
7fd59977 |
88 | #include <TopoDS.hxx> |
42cf5bc1 |
89 | #include <TopoDS_Edge.hxx> |
7fd59977 |
90 | #include <TopoDS_Face.hxx> |
42cf5bc1 |
91 | #include <TopoDS_Shape.hxx> |
92 | #include <TopoDS_Vertex.hxx> |
7fd59977 |
93 | #include <TopOpeBRepDS_DataStructure.hxx> |
42cf5bc1 |
94 | #include <TopOpeBRepDS_HDataStructure.hxx> |
7fd59977 |
95 | #include <TopOpeBRepDS_ListOfInterference.hxx> |
7fd59977 |
96 | #include <TopTools_ListIteratorOfListOfShape.hxx> |
7fd59977 |
97 | |
98 | #ifdef DRAW |
99 | #include <DrawTrSurf.hxx> |
100 | #endif |
0797d9d3 |
101 | #ifdef OCCT_DEBUG |
7fd59977 |
102 | #include <Geom_TrimmedCurve.hxx> |
103 | extern Standard_Boolean ChFi3d_GettraceDRAWSPINE(); |
104 | extern Standard_Boolean ChFi3d_GetcontextFORCEFILLING(); |
105 | #include <OSD_Chronometer.hxx> |
106 | |
107 | extern Standard_Real t_t2cornerinit ,t_perf2cornerbyinter,t_chfikpartcompdata, |
108 | t_cheminement,t_remplissage,t_t2cornerDS; |
109 | extern void ChFi3d_InitChron(OSD_Chronometer& ch); |
110 | extern void ChFi3d_ResultChron(OSD_Chronometer & ch,Standard_Real& time); |
111 | #endif |
112 | |
113 | //======================================================================= |
114 | //function : ToricRotule |
81bba717 |
115 | //purpose : Test if it is a particular case of torus routine. |
116 | // Three planes with two constant incident fillets |
117 | // of the same radius and the third face perpendicular to |
118 | // two others are required. |
7fd59977 |
119 | //======================================================================= |
120 | |
121 | static Standard_Boolean ToricRotule(const BRepAdaptor_Surface& fac, |
122 | const BRepAdaptor_Surface& s1, |
123 | const BRepAdaptor_Surface& s2, |
124 | const Handle(ChFiDS_Stripe)& c1, |
125 | const Handle(ChFiDS_Stripe)& c2) |
126 | |
127 | { |
128 | Standard_Real tolesp = 1.e-7; |
129 | |
130 | Handle(ChFiDS_FilSpine) sp1=Handle(ChFiDS_FilSpine)::DownCast(c1->Spine()); |
131 | Handle(ChFiDS_FilSpine) sp2=Handle(ChFiDS_FilSpine)::DownCast(c2->Spine()); |
132 | if(sp1.IsNull() || sp2.IsNull()) return Standard_False; |
133 | if (!sp1->IsConstant() || !sp2->IsConstant()) |
134 | return Standard_False; |
135 | if ((fac.GetType() != GeomAbs_Plane) || |
136 | (s1.GetType() != GeomAbs_Plane) || |
137 | (s2.GetType() != GeomAbs_Plane)) return Standard_False; |
138 | gp_Dir df = fac.Plane().Position().Direction(); |
139 | gp_Dir ds1 = s1.Plane().Position().Direction(); |
140 | gp_Dir ds2 = s2.Plane().Position().Direction(); |
141 | if ( Abs(df.Dot(ds1)) >= tolesp || Abs(df.Dot(ds2)) >= tolesp ) |
142 | return Standard_False; |
143 | Standard_Real r1 = sp1->Radius(); |
144 | Standard_Real r2 = sp2->Radius(); |
145 | if(Abs(r1 - r2) >= tolesp) return Standard_False; |
146 | return Standard_True; |
147 | } |
148 | |
149 | static void RemoveSD(Handle(ChFiDS_Stripe)& Stripe, |
150 | const Standard_Integer num1, |
151 | const Standard_Integer num2 ) |
152 | { |
153 | ChFiDS_SequenceOfSurfData& Seq = |
154 | Stripe->ChangeSetOfSurfData()->ChangeSequence(); |
155 | if(Seq.IsEmpty()) return; |
156 | if (num1==num2) |
157 | Seq.Remove(num1); |
158 | else |
159 | Seq.Remove(num1,num2); |
160 | } |
161 | |
162 | |
163 | //======================================================================= |
164 | //function : PerformTwoCorner |
165 | //purpose : |
166 | //======================================================================= |
167 | |
168 | void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index) |
169 | { |
0797d9d3 |
170 | #ifdef OCCT_DEBUG |
7fd59977 |
171 | OSD_Chronometer ch; |
172 | ChFi3d_InitChron(ch); // init perf initialisation |
173 | #endif |
174 | |
175 | done = 0; |
176 | const TopoDS_Vertex& Vtx = myVDataMap.FindKey(Index); |
177 | TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS(); |
178 | ChFiDS_ListIteratorOfListOfStripe It; |
179 | It.Initialize(myVDataMap(Index)); |
180 | Handle(ChFiDS_Stripe) st1,st2; |
181 | Standard_Integer Sens1,Sens2; |
182 | Standard_Integer Isd1,Isd2,i1,i2; |
183 | Handle(ChFiDS_SurfData) sd1,sd2; |
184 | ChFiDS_SequenceOfSurfData SeqFil1,SeqFil2; |
185 | Handle(Geom_Surface) surf1,surf2; |
186 | Standard_Boolean OkinterCC,Okvisavis,SameSide; |
187 | Standard_Integer IFaCo1,IFaCo2; |
188 | Standard_Real UIntPC1,UIntPC2; |
189 | TopoDS_Face FaCo; |
190 | TopoDS_Edge E1,E2,E; |
191 | TopoDS_Vertex V1,V2; |
192 | // gp_Pnt P1,P2; |
193 | Standard_Integer nbsurf1,nbsurf2,deb1,fin1,deb2,fin2; |
194 | Standard_Real parE1,parE2; |
81bba717 |
195 | //Necessary information on fillets is extracted |
7fd59977 |
196 | //------------------------------------------------------ |
197 | |
81bba717 |
198 | //the first |
7fd59977 |
199 | //---------- |
200 | |
201 | st1 = It.Value(); |
202 | Isd1 = ChFi3d_IndexOfSurfData(Vtx,st1,Sens1); |
203 | |
204 | |
81bba717 |
205 | //the second |
7fd59977 |
206 | //---------- |
207 | It.Next(); |
208 | st2 = It.Value(); |
209 | if(st2 == st1) { |
210 | Sens2 = -1; |
211 | Isd2 = st2->SetOfSurfData()->Length(); |
212 | } |
213 | else{ Isd2 = ChFi3d_IndexOfSurfData(Vtx,st2,Sens2); } |
214 | |
81bba717 |
215 | // If two edges to rounded are tangent GeomPlate is called |
7fd59977 |
216 | |
217 | if (Sens1==1) E1= st1->Spine()->Edges(1); |
218 | else E1= st1->Spine()->Edges( st1->Spine()->NbEdges()); |
219 | |
220 | if (Sens2==1) E2= st2->Spine()->Edges(1); |
221 | else E2= st2->Spine()->Edges( st2->Spine()->NbEdges()); |
222 | |
223 | BRepAdaptor_Curve BCurv1(E1); |
224 | BRepAdaptor_Curve BCurv2(E2); |
225 | parE1=BRep_Tool::Parameter(Vtx,E1); |
226 | parE2=BRep_Tool::Parameter(Vtx,E2); |
227 | BRepLProp_CLProps CL1(BCurv1,parE1 , 1, 1.e-4); |
228 | BRepLProp_CLProps CL2(BCurv2,parE2 , 1, 1.e-4); |
229 | gp_Dir dir1,dir2 ; |
230 | CL1.Tangent(dir1); |
231 | CL2.Tangent(dir2); |
232 | if (Sens1==-1) dir1.Reverse(); |
233 | if (Sens2==-1) dir2.Reverse(); |
234 | Standard_Real ang1; |
235 | ang1=Abs(dir1.Angle(dir2)); |
c6541a0c |
236 | if (ang1<M_PI/180.) { |
7fd59977 |
237 | PerformMoreThreeCorner(Index,2); |
238 | done=1; |
239 | return; |
240 | } |
241 | |
242 | OkinterCC = ChFi3d_IsInFront(DStr,st1,st2,Isd1,Isd2,Sens1,Sens2, |
243 | UIntPC1,UIntPC2,FaCo,SameSide, |
244 | IFaCo1,IFaCo2,Okvisavis,Vtx,Standard_True); |
245 | |
246 | Standard_Boolean trouve=Standard_False; |
247 | if (!Okvisavis) { |
248 | |
249 | |
81bba717 |
250 | // one is not limited to the first or the last surfdata |
251 | // to find the opposing data |
7fd59977 |
252 | nbsurf1=st1->SetOfSurfData()->Length(); |
253 | nbsurf2=st2->SetOfSurfData()->Length(); |
254 | deb1=1; |
255 | deb2=1; |
256 | fin1=1; |
257 | fin2=1; |
258 | if (nbsurf1!=1) { |
259 | if (Sens1==1) { |
260 | deb1=1; |
261 | fin1=2; |
262 | } |
263 | else { |
264 | deb1=nbsurf1-1; |
265 | fin1=nbsurf1; |
266 | } |
267 | } |
268 | if (nbsurf2!=1) { |
269 | if (Sens2==1 ) { |
270 | deb2=1; |
271 | fin2=2; |
272 | } |
273 | else { |
274 | deb2=nbsurf2-1; |
275 | fin2=nbsurf2; |
276 | } |
277 | } |
278 | |
279 | for (i1=deb1;i1<=fin1 &&!trouve;i1++) { |
280 | Isd1=i1; |
281 | for (i2=deb2;i2<=fin2 &&!trouve;i2++) { |
282 | Isd2=i2; |
283 | |
284 | OkinterCC = ChFi3d_IsInFront(DStr,st1,st2,Isd1,Isd2,Sens1,Sens2, |
285 | UIntPC1,UIntPC2,FaCo,SameSide, |
286 | IFaCo1,IFaCo2,Okvisavis,Vtx,Standard_True); |
287 | trouve=Okvisavis; |
288 | } |
289 | } |
290 | if (!trouve){ |
291 | PerformMoreThreeCorner(Index,2); |
292 | done=1; |
293 | return; |
294 | } |
295 | else { |
296 | if (Sens1==1 && Isd1!=1) RemoveSD(st1,1,1); |
297 | if (Sens1!=1 && Isd1!=nbsurf1) RemoveSD(st1,fin1,fin1); |
298 | if (Sens2==1 && Isd2!=1) RemoveSD(st2,1,1); |
299 | if (Sens2!=1 && Isd2!=nbsurf2) RemoveSD(st2,fin2,fin2); |
300 | |
301 | } |
302 | Isd1=ChFi3d_IndexOfSurfData(Vtx,st1,Sens1); |
303 | Isd2=ChFi3d_IndexOfSurfData(Vtx,st2,Sens2); |
304 | } |
9775fa61 |
305 | // throw StdFail_NotDone("TwoCorner : no common face"); |
7fd59977 |
306 | Standard_Integer IFaArc1 = 3-IFaCo1, IFaArc2 = 3-IFaCo2; |
307 | SeqFil1 = st1->ChangeSetOfSurfData()->ChangeSequence(); |
308 | SeqFil2 = st2->ChangeSetOfSurfData()->ChangeSequence(); |
309 | sd1 = SeqFil1.ChangeValue(Isd1); |
310 | surf1 = DStr.Surface(sd1->Surf()).Surface(); |
311 | sd2 = SeqFil2.ChangeValue(Isd2); |
312 | surf2 = DStr.Surface(sd2->Surf()).Surface(); |
313 | TopAbs_Orientation OFaCo = FaCo.Orientation(); |
81bba717 |
314 | // The concavities are analyzed and the opposite face and the |
315 | // eventual intersection of 2 pcurves on this face are found. |
7fd59977 |
316 | |
317 | ChFiDS_State Stat1,Stat2; |
318 | Standard_Boolean isfirst1 = (Sens1 == 1); |
319 | Standard_Boolean isfirst2 = (Sens2 == 1); |
320 | Stat1 = st1->Spine()->Status(isfirst1); |
321 | Stat2 = st2->Spine()->Status(isfirst2); |
322 | Standard_Boolean c1biseau = (Stat1 == ChFiDS_AllSame); |
323 | Standard_Boolean c1rotule = (Stat1 == ChFiDS_OnSame && Stat2 == ChFiDS_OnSame); |
324 | |
81bba717 |
325 | // It is checked if the fillets have a commonpoint on a common arc. |
326 | // This edge is the pivot of the bevel or the knee. |
7fd59977 |
327 | |
328 | ChFiDS_CommonPoint& CP1 = sd1->ChangeVertex(isfirst1,IFaArc1); |
329 | ChFiDS_CommonPoint& CP2 = sd2->ChangeVertex(isfirst2,IFaArc2); |
330 | |
331 | Standard_Boolean resetcp1 = 0; |
332 | Standard_Boolean resetcp2 = 0; |
333 | |
334 | TopoDS_Edge pivot; |
335 | Standard_Boolean yapiv = Standard_False; |
336 | if(CP1.IsOnArc()) pivot = CP1.Arc(); |
337 | else { |
338 | PerformMoreThreeCorner(Index,2); |
339 | done=1; |
340 | return; |
341 | } |
342 | if(CP1.IsOnArc()&& CP2.IsOnArc()){ |
343 | yapiv = (pivot.IsSame(CP2.Arc())); |
344 | } |
c22b52d6 |
345 | Handle(BRepAdaptor_Curve) Hpivot; |
7fd59977 |
346 | Standard_Boolean sameparam = Standard_False; |
347 | Standard_Real parCP1 = 0., parCP2 = 0.; |
7fd59977 |
348 | if(yapiv) { |
c22b52d6 |
349 | Hpivot = new BRepAdaptor_Curve(pivot); |
7fd59977 |
350 | parCP1 = CP1.ParameterOnArc(); |
351 | parCP2 = CP2.ParameterOnArc(); |
352 | gp_Pnt tst1 = Hpivot->Value(parCP1); |
353 | gp_Pnt tst2 = Hpivot->Value(parCP2); |
354 | sameparam = tst1.Distance(tst2) <= tolesp; |
355 | } |
c22b52d6 |
356 | Handle(BRepAdaptor_Surface) HFaCo = new BRepAdaptor_Surface(); |
357 | Handle(BRepAdaptor_Surface) HFaPiv; |
358 | Handle(BRepAdaptor_Surface) HBRS1 = new BRepAdaptor_Surface(); |
359 | Handle(BRepAdaptor_Surface) HBRS2 = new BRepAdaptor_Surface(); |
7fd59977 |
360 | |
c22b52d6 |
361 | BRepAdaptor_Surface& BRS1 = *HBRS1; |
362 | BRepAdaptor_Surface& BRS2 = *HBRS2; |
363 | BRepAdaptor_Surface& BRFaCo = *HFaCo; |
7fd59977 |
364 | BRFaCo.Initialize(FaCo); |
365 | |
366 | TopoDS_Face FF1,FF2,F,FaPiv; |
7fd59977 |
367 | TopAbs_Orientation pctrans = TopAbs_FORWARD ; |
7fd59977 |
368 | Handle(Geom2d_BSplineCurve) PCurveOnPiv; |
369 | FF1 = TopoDS::Face(DStr.Shape(sd1->Index(IFaArc1))); |
370 | FF2 = TopoDS::Face(DStr.Shape(sd2->Index(IFaArc2))); |
371 | if (FF1.IsNull()||FF2.IsNull()) |
372 | {PerformMoreThreeCorner(Index,2); |
373 | done=1; |
374 | return; |
375 | } |
376 | BRS1.Initialize(FF1); |
377 | BRS2.Initialize(FF2); |
378 | |
379 | if(yapiv ) { |
380 | TopTools_ListIteratorOfListOfShape Kt; |
381 | Standard_Boolean ok1 = Standard_False, ok2 = Standard_False; |
382 | for (Kt.Initialize(myEFMap(pivot)); Kt.More(); Kt.Next()){ |
383 | F = TopoDS::Face(Kt.Value()); |
384 | if(!ok1 && FF1.IsSame(F)){ |
385 | ok1 = Standard_True; |
386 | } |
387 | if(!ok2 && FF2.IsSame(F)){ |
388 | ok2 = Standard_True; |
389 | } |
390 | } |
391 | if(!ok1 || !ok2){ |
7fd59977 |
392 | PerformMoreThreeCorner(Index,2); |
393 | done=1; |
394 | return; |
395 | } |
396 | } |
397 | |
0797d9d3 |
398 | #ifdef OCCT_DEBUG |
7fd59977 |
399 | ChFi3d_ResultChron(ch ,t_t2cornerinit);//result perf initialisation |
400 | #endif |
401 | |
81bba717 |
402 | //bevel |
7fd59977 |
403 | //------ |
404 | ChFiDS_CommonPoint cp11,cp12,cp21,cp22; |
405 | ChFiDS_FaceInterference intf11,intf12,intf21,intf22; |
406 | |
407 | if(c1biseau){ |
0797d9d3 |
408 | #ifdef OCCT_DEBUG |
7fd59977 |
409 | ChFi3d_InitChron(ch); // init perf PerformTwoCornerbyInter |
410 | #endif |
411 | |
412 | done = PerformTwoCornerbyInter(Index); |
413 | |
0797d9d3 |
414 | #ifdef OCCT_DEBUG |
7fd59977 |
415 | ChFi3d_ResultChron(ch , t_perf2cornerbyinter); // result perf PerformTwoCornerbyInter |
416 | #endif |
417 | |
418 | if (!done){ |
419 | PerformMoreThreeCorner(Index,2); |
420 | done=1; |
421 | return; |
422 | } |
423 | } |
81bba717 |
424 | else if(c1rotule){//save. |
7fd59977 |
425 | cp11 = sd1->Vertex(isfirst1,1); |
426 | cp12 = sd1->Vertex(isfirst1,2); |
427 | cp21 = sd2->Vertex(isfirst2,1); |
428 | cp22 = sd2->Vertex(isfirst2,2); |
429 | intf11 = sd1->InterferenceOnS1(); |
430 | intf12 = sd1->InterferenceOnS2(); |
431 | intf21 = sd2->InterferenceOnS1(); |
432 | intf22 = sd2->InterferenceOnS2(); |
0797d9d3 |
433 | #ifdef OCCT_DEBUG |
7fd59977 |
434 | ChFi3d_InitChron(ch); // init perf PerformTwoCornerbyInter |
435 | #endif |
436 | |
437 | done = PerformTwoCornerbyInter(Index); |
438 | |
0797d9d3 |
439 | #ifdef OCCT_DEBUG |
7fd59977 |
440 | ChFi3d_ResultChron(ch , t_perf2cornerbyinter); // result perf PerformTwoCornerbyInter |
441 | #endif |
442 | if (!done) { |
81bba717 |
443 | // restore |
7fd59977 |
444 | sd1->ChangeVertex(isfirst1,1) = cp11; |
445 | sd1->ChangeVertex(isfirst1,2) = cp12; |
446 | sd2->ChangeVertex(isfirst2,1) = cp21; |
447 | sd2->ChangeVertex(isfirst2,2) = cp22; |
448 | sd1->ChangeInterferenceOnS1() = intf11; |
449 | sd1->ChangeInterferenceOnS2() = intf12; |
450 | sd2->ChangeInterferenceOnS1() = intf21; |
451 | sd2->ChangeInterferenceOnS2() = intf22; |
452 | done = 0; |
453 | } |
454 | } |
455 | |
456 | if(!c1biseau && !done){ |
81bba717 |
457 | //new cornerdata is created |
7fd59977 |
458 | //------------------------------- |
459 | Handle(ChFiDS_Stripe) corner = new ChFiDS_Stripe(); |
460 | Handle(ChFiDS_HData)& cornerset = corner->ChangeSetOfSurfData(); |
461 | cornerset = new ChFiDS_HData(); |
462 | Handle(ChFiDS_SurfData) coin = new ChFiDS_SurfData(); |
463 | cornerset->Append(coin); |
464 | |
465 | if (SameSide) { |
466 | if(ToricRotule(BRFaCo,BRS1,BRS2,st1,st2)){ |
81bba717 |
467 | // Direct construction. |
7fd59977 |
468 | // --------------------- |
469 | |
7fd59977 |
470 | Standard_Integer bid; |
471 | TopAbs_Orientation ori = OFaCo; |
472 | TopAbs_Orientation oriS = st1->Orientation(IFaCo1); |
473 | TopAbs_Orientation OFF1 = FF1.Orientation(); |
474 | TopAbs_Orientation oriSFF1 = st1->Orientation(IFaArc1); |
475 | bid = 1; |
476 | bid = ChFi3d::NextSide(ori,OFF1,oriS,oriSFF1,bid); |
1d47d8d0 |
477 | TopAbs_Orientation op1 = TopAbs_FORWARD,op2 = TopAbs_FORWARD; |
7fd59977 |
478 | if(yapiv) bid = ChFi3d::ConcaveSide(BRS1,BRS2,pivot,op1,op2); |
479 | op1 = TopAbs::Reverse(op1); |
480 | op2 = TopAbs::Reverse(op2); |
0797d9d3 |
481 | #ifdef OCCT_DEBUG |
7fd59977 |
482 | ChFi3d_InitChron(ch);// init perf ChFiKPart_ComputeData |
483 | #endif |
484 | Standard_Real radius = |
485 | Handle(ChFiDS_FilSpine)::DownCast(st1->Spine())->Radius(); |
486 | done = ChFiKPart_ComputeData::ComputeCorner(DStr,coin,HFaCo,HBRS1,HBRS2, |
487 | OFaCo,ori,op1,op2,radius); |
0797d9d3 |
488 | #ifdef OCCT_DEBUG |
7fd59977 |
489 | ChFi3d_ResultChron(ch , t_chfikpartcompdata);//result perf ChFiKPart_ComputeData |
490 | #endif |
491 | } |
492 | else { |
81bba717 |
493 | // Construction by filling remplissage |
7fd59977 |
494 | // ---------------------------- |
495 | Standard_Real uPCArc1, uPCArc2; |
496 | gp_Pnt2d p2da1,p2df1,p2da2,p2df2,p2dfac1,p2dfac2; |
497 | gp_Vec2d v2dfac1,v2dfac2; |
498 | Handle(GeomFill_Boundary) B1,B2,Bpiv,Bfac; |
499 | uPCArc1 = sd1->Interference(IFaArc1).Parameter(isfirst1); |
500 | p2da1 = sd1->Interference(IFaArc1).PCurveOnSurf()->Value(uPCArc1); |
501 | p2df1 = sd1->Interference(IFaCo1).PCurveOnSurf()->Value(uPCArc1); |
502 | sd1->Interference(IFaCo1).PCurveOnFace()->D1(uPCArc1,p2dfac1,v2dfac1); |
503 | uPCArc2 = sd2->Interference(IFaArc2).Parameter(isfirst2); |
504 | p2da2 = sd2->Interference(IFaArc2).PCurveOnSurf()->Value(uPCArc2); |
505 | p2df2 = sd2->Interference(IFaCo2).PCurveOnSurf()->Value(uPCArc2); |
506 | sd2->Interference(IFaCo2).PCurveOnFace()->D1(uPCArc2,p2dfac2,v2dfac2); |
0797d9d3 |
507 | #ifdef OCCT_DEBUG |
81bba717 |
508 | ChFi3d_InitChron(ch ); // init perf filling |
7fd59977 |
509 | #endif |
510 | B1 = ChFi3d_mkbound(surf1,p2df1,p2da1,tolesp,2.e-4); |
511 | B2 = ChFi3d_mkbound(surf2,p2df2,p2da2,tolesp,2.e-4); |
512 | Handle(Geom2d_Curve) PCurveOnFace; |
513 | Bfac = ChFi3d_mkbound(HFaCo,PCurveOnFace,Sens1,p2dfac1,v2dfac1, |
514 | Sens2,p2dfac2,v2dfac2,tolesp,2.e-4); |
515 | GeomFill_ConstrainedFilling fil(8,20); |
516 | if(sameparam) { |
517 | fil.Init(Bfac,B2,B1,1); |
518 | } |
519 | else { |
c22b52d6 |
520 | Handle(Adaptor3d_Curve) HPivTrim = Hpivot->Trim(Min(parCP1,parCP2),Max(parCP1,parCP2),tolesp); |
7fd59977 |
521 | Bpiv = new GeomFill_SimpleBound(HPivTrim,tolesp,2.e-4); |
522 | fil.Init(Bfac,B2,Bpiv,B1,1); |
523 | BRepAdaptor_Curve2d pcpivot; |
524 | gp_Vec dArc,dcf; |
525 | gp_Pnt bidon; |
526 | Hpivot->D1(parCP1,bidon,dArc); |
527 | Standard_Real fb1,lb1; |
528 | B1->Bounds(fb1,lb1); |
529 | B1->D1(lb1,bidon,dcf); |
530 | Standard_Boolean pivotverslebas = dArc.Dot(dcf) <= 0.; |
531 | Standard_Boolean pcfalenvers = (parCP1 > parCP2); |
532 | if((pivotverslebas && !pcfalenvers)|| |
533 | (!pivotverslebas && pcfalenvers)) { |
534 | FaPiv = FF2; |
535 | HFaPiv = HBRS2; |
536 | resetcp2 = 1; |
537 | } |
538 | else { |
539 | FaPiv = FF1; |
540 | HFaPiv = HBRS1; |
541 | resetcp1 = 1; |
542 | } |
543 | FaPiv.Orientation(TopAbs_FORWARD); |
544 | pcpivot.Initialize(pivot,FaPiv); |
545 | TopExp_Explorer Expl; |
546 | for(Expl.Init(FaPiv,TopAbs_EDGE); Expl.More(); Expl.Next()){ |
547 | if(Expl.Current().IsSame(pivot)) { |
548 | pctrans = Expl.Current().Orientation(); |
549 | break; |
550 | } |
551 | } |
552 | if(pcpivot.GetType() != GeomAbs_BSplineCurve){ |
553 | Handle(Geom2d_TrimmedCurve) |
554 | trc = new Geom2d_TrimmedCurve(pcpivot.Curve(), |
555 | Min(parCP1,parCP2), |
556 | Max(parCP1,parCP2)); |
557 | PCurveOnPiv = Geom2dConvert::CurveToBSplineCurve(trc); |
558 | } |
559 | else { |
560 | PCurveOnPiv = Geom2dConvert::SplitBSplineCurve |
561 | (Handle(Geom2d_BSplineCurve)::DownCast(pcpivot.Curve()), |
562 | Min(parCP1,parCP2),Max(parCP1,parCP2),tol2d); |
563 | } |
564 | TColStd_Array1OfReal kk(1,PCurveOnPiv->NbKnots()); |
565 | PCurveOnPiv->Knots(kk); |
566 | BSplCLib::Reparametrize(0.,1.,kk); |
567 | PCurveOnPiv->SetKnots(kk); |
568 | if(pcfalenvers) { |
569 | PCurveOnPiv->Reverse(); |
570 | pctrans = TopAbs::Reverse(pctrans); |
571 | } |
572 | } |
573 | Handle(Geom_Surface) Surfcoin = fil.Surface(); |
574 | done = CompleteData(coin,Surfcoin, |
575 | HFaCo,PCurveOnFace, |
576 | HFaPiv,PCurveOnPiv,OFaCo,1, |
577 | 0,0,0,0); |
0797d9d3 |
578 | #ifdef OCCT_DEBUG |
81bba717 |
579 | ChFi3d_ResultChron(ch , t_remplissage);// result perf filling |
7fd59977 |
580 | #endif |
581 | } |
0797d9d3 |
582 | #ifdef OCCT_DEBUG |
81bba717 |
583 | ChFi3d_InitChron(ch); // init perf update DS |
7fd59977 |
584 | #endif |
585 | if (done){ |
81bba717 |
586 | // Update 3 CornerData and the DS |
7fd59977 |
587 | // ---------------------------------------- |
588 | if(resetcp1){ |
589 | gp_Pnt pjyl = CP1.Point(); |
590 | Standard_Real tolsav = CP1.Tolerance(); |
591 | CP1.Reset(); |
592 | CP1.SetPoint(pjyl); |
593 | CP1.SetTolerance(tolsav); |
594 | } |
595 | else if(resetcp2){ |
596 | gp_Pnt pjyl = CP2.Point(); |
597 | Standard_Real tolsav = CP2.Tolerance(); |
598 | CP2.Reset(); |
599 | CP2.SetPoint(pjyl); |
600 | CP2.SetTolerance(tolsav); |
601 | } |
602 | Standard_Real P1deb,P2deb,P1fin,P2fin; |
603 | Standard_Integer If1,If2,Il1,Il2,Icf,Icl; |
604 | const ChFiDS_CommonPoint& Pf1 = coin->VertexFirstOnS1(); |
605 | ChFiDS_CommonPoint& Pf2 = coin->ChangeVertexFirstOnS2(); |
606 | const ChFiDS_CommonPoint& Pl1 = coin->VertexLastOnS1(); |
607 | ChFiDS_CommonPoint& Pl2 = coin->ChangeVertexLastOnS2(); |
608 | Pf2 = CP1; |
609 | Pl2 = CP2; |
610 | |
81bba717 |
611 | // the corner to start, |
7fd59977 |
612 | // ----------------------- |
613 | ChFiDS_Regul regdeb, regfin; |
614 | If1 = ChFi3d_IndexPointInDS(Pf1,DStr); |
615 | If2 = ChFi3d_IndexPointInDS(Pf2,DStr); |
616 | Il1 = ChFi3d_IndexPointInDS(Pl1,DStr); |
617 | if(sameparam) Il2 = If2; |
618 | else Il2 = ChFi3d_IndexPointInDS(Pl2,DStr); |
619 | |
620 | gp_Pnt2d pp1,pp2; |
621 | pp1 = coin->InterferenceOnS1().PCurveOnSurf()-> |
622 | Value(coin->InterferenceOnS1().FirstParameter()); |
623 | pp2 = coin->InterferenceOnS2().PCurveOnSurf()-> |
624 | Value(coin->InterferenceOnS2().FirstParameter()); |
625 | Handle(Geom_Curve) C3d; |
626 | Standard_Real tolreached; |
627 | ChFi3d_ComputeArete(Pf1,pp1,Pf2,pp2, |
628 | DStr.Surface(coin->Surf()).Surface(),C3d, |
629 | corner->ChangeFirstPCurve(),P1deb,P2deb, |
630 | tolesp,tol2d,tolreached,0); |
631 | Standard_Real par1 = sd1->Interference(IFaArc1).Parameter(isfirst1); |
632 | pp1 = sd1->Interference(IFaCo1).PCurveOnSurf()->Value(par1); |
633 | pp2 = sd1->Interference(IFaArc1).PCurveOnSurf()->Value(par1); |
634 | Standard_Real tolr1; |
635 | ChFi3d_ComputePCurv(C3d,pp1,pp2,st1->ChangePCurve(isfirst1), |
636 | DStr.Surface(sd1->Surf()).Surface(), |
637 | P1deb,P2deb,tolesp,tolr1); |
638 | tolreached = Max(tolreached,tolr1); |
639 | TopOpeBRepDS_Curve Tcurv1(C3d,tolreached); |
640 | Icf = DStr.AddCurve(Tcurv1); |
641 | regdeb.SetCurve(Icf); |
642 | regdeb.SetS1(coin->Surf(),0); |
643 | regdeb.SetS2(sd1->Surf(),0); |
644 | myRegul.Append(regdeb); |
645 | corner->ChangeFirstCurve(Icf); |
646 | corner->ChangeFirstParameters(P1deb,P2deb); |
647 | corner->ChangeIndexFirstPointOnS1(If1); |
648 | corner->ChangeIndexFirstPointOnS2(If2); |
649 | |
650 | pp1 = coin->InterferenceOnS1().PCurveOnSurf()-> |
651 | Value(coin->InterferenceOnS1().LastParameter()); |
652 | pp2 = coin->InterferenceOnS2().PCurveOnSurf()-> |
653 | Value(coin->InterferenceOnS2().LastParameter()); |
654 | ChFi3d_ComputeArete(Pl1,pp1,Pl2,pp2, |
655 | DStr.Surface(coin->Surf()).Surface(),C3d, |
656 | corner->ChangeLastPCurve(),P1fin,P2fin, |
657 | tolesp,tol2d,tolreached,0); |
658 | Standard_Real par2 = sd2->Interference(IFaArc2).Parameter(isfirst2); |
659 | pp1 = sd2->Interference(IFaCo2).PCurveOnSurf()->Value(par2); |
660 | pp2 = sd2->Interference(IFaArc2).PCurveOnSurf()->Value(par2); |
661 | Standard_Real tolr2; |
662 | ChFi3d_ComputePCurv(C3d,pp1,pp2,st2->ChangePCurve(isfirst2), |
663 | DStr.Surface(sd2->Surf()).Surface(), |
664 | P1deb,P2deb,tolesp,tolr2); |
665 | tolreached = Max(tolreached,tolr2); |
666 | TopOpeBRepDS_Curve Tcurv2(C3d,tolreached); |
667 | Icl = DStr.AddCurve(Tcurv2); |
668 | regfin.SetCurve(Icl); |
669 | regfin.SetS1(coin->Surf(),0); |
670 | regfin.SetS2(sd2->Surf(),0); |
671 | myRegul.Append(regfin); |
672 | corner->ChangeLastCurve(Icl); |
673 | corner->ChangeLastParameters(P1fin,P2fin); |
674 | corner->ChangeIndexLastPointOnS1(Il1); |
675 | corner->ChangeIndexLastPointOnS2(Il2); |
676 | |
677 | coin->ChangeIndexOfS1(DStr.AddShape(FaCo)); |
678 | if(sameparam) coin->ChangeIndexOfS2(0); |
679 | else { |
680 | coin->ChangeIndexOfS2(DStr.AddShape(FaPiv)); |
681 | coin->ChangeInterferenceOnS2().SetTransition(pctrans); |
682 | } |
683 | corner->SetSolidIndex(st1->SolidIndex()); |
684 | |
81bba717 |
685 | // then the starting Stripe, |
7fd59977 |
686 | // ------------------------ |
687 | st1->SetCurve(Icf,isfirst1); |
688 | st1->SetIndexPoint(If1,isfirst1,IFaCo1); |
689 | st1->SetIndexPoint(If2,isfirst1,IFaArc1); |
690 | st1->SetParameters(isfirst1,P1deb,P2deb); |
691 | sd1->ChangeVertex(isfirst1,IFaCo1) = Pf1; |
692 | sd1->ChangeVertex(isfirst1,IFaArc1) = Pf2; |
693 | sd1->ChangeInterference(IFaCo1).SetParameter(par1,isfirst1); |
694 | if (IFaCo1 == 2) st1->SetOrientation(TopAbs_REVERSED,isfirst1); |
695 | |
81bba717 |
696 | // then the end Stripe, |
7fd59977 |
697 | // ------------------------- |
698 | st2->SetCurve(Icl,isfirst2); |
699 | st2->SetIndexPoint(Il1,isfirst2,IFaCo2); |
700 | st2->SetIndexPoint(Il2,isfirst2,IFaArc2); |
701 | st2->SetParameters(isfirst2,P1fin,P2fin); |
702 | sd2->ChangeVertex(isfirst2,IFaCo2) = Pl1; |
703 | sd2->ChangeVertex(isfirst2,IFaArc2) = Pl2; |
704 | sd2->ChangeInterference(IFaCo2).SetParameter(par2,isfirst2); |
705 | if (IFaCo2 == 2) st2->SetOrientation(TopAbs_REVERSED,isfirst2); |
706 | } |
0797d9d3 |
707 | #ifdef OCCT_DEBUG |
81bba717 |
708 | ChFi3d_ResultChron(ch , t_t2cornerDS);// result perf update DS |
7fd59977 |
709 | #endif |
710 | } |
711 | else { |
81bba717 |
712 | //it is necessary to make difference with |
7fd59977 |
713 | if(!OkinterCC) { |
9775fa61 |
714 | throw Standard_Failure("TwoCorner : No intersection pc pc"); |
7fd59977 |
715 | } |
716 | Handle(ChFiDS_Stripe) stsam, stdif; |
717 | Handle(ChFiDS_SurfData) sdsam, sddif; |
7fd59977 |
718 | Standard_Real uintpcsam = 0., uintpcdif = 0.; |
719 | Standard_Integer ifacosam = 0, ifacodif = 0, ifaopsam = 0, ifaopdif = 0; |
720 | Standard_Boolean isfirstsam = Standard_False, isfirstdif = Standard_False; |
7fd59977 |
721 | if(Stat1 == ChFiDS_OnSame && Stat2 == ChFiDS_OnDiff){ |
722 | stsam = st1; sdsam = sd1; uintpcsam = UIntPC1; |
723 | ifacosam = IFaCo1; ifaopsam = IFaArc1; isfirstsam = isfirst1; |
724 | stdif = st2; sddif = sd2; uintpcdif = UIntPC2; |
725 | ifacodif = IFaCo2; ifaopdif = IFaArc2; isfirstdif = isfirst2; |
726 | } |
727 | else if(Stat1 == ChFiDS_OnDiff && Stat2 == ChFiDS_OnSame){ |
728 | stsam = st2; sdsam = sd2; uintpcsam = UIntPC2; |
729 | ifacosam = IFaCo2; ifaopsam = IFaArc2; isfirstsam = isfirst2; |
730 | stdif = st1; sddif = sd1; uintpcdif = UIntPC1; |
731 | ifacodif = IFaCo1; ifaopdif = IFaArc1; isfirstdif = isfirst1; |
732 | } |
733 | else { |
9775fa61 |
734 | throw Standard_Failure("TwoCorner : Config unknown"); |
7fd59977 |
735 | } |
81bba717 |
736 | //It is checked if surface ondiff has a point on arc from the side opposed |
737 | //to the common face and if this arc is connected to the base face |
738 | //opposed to common face of the surface onsame. |
7fd59977 |
739 | ChFiDS_CommonPoint& cpopdif = sddif->ChangeVertex(isfirstdif,ifaopdif); |
740 | if(!cpopdif.IsOnArc()) { |
9775fa61 |
741 | throw Standard_Failure("TwoCorner : No point on restriction on surface OnDiff"); |
7fd59977 |
742 | } |
743 | const TopoDS_Edge& Arcopdif = cpopdif.Arc(); |
744 | const TopoDS_Face& Fopsam = TopoDS::Face(DStr.Shape(sdsam->Index(ifaopsam))); |
745 | TopExp_Explorer ex; |
746 | for(ex.Init(Fopsam,TopAbs_EDGE); ex.More(); ex.Next()){ |
747 | if(ex.Current().IsSame(Arcopdif)) { |
748 | break; |
749 | } |
750 | else if(!ex.More()) { |
9775fa61 |
751 | throw Standard_Failure("TwoCorner : No common face to loop the contour"); |
7fd59977 |
752 | } |
753 | } |
0797d9d3 |
754 | #ifdef OCCT_DEBUG |
81bba717 |
755 | ChFi3d_InitChron(ch ); // init perf filling |
7fd59977 |
756 | #endif |
757 | Handle(GeomFill_Boundary) Bsam,Bdif,Bfac; |
758 | gp_Pnt2d ppopsam = |
759 | sdsam->Interference(ifaopsam).PCurveOnSurf()->Value(uintpcsam); |
760 | gp_Pnt2d ppcosam = |
761 | sdsam->Interference(ifacosam).PCurveOnSurf()->Value(uintpcsam); |
762 | Handle(Geom_Surface) surfsam = DStr.Surface(sdsam->Surf()).Surface(); |
c22b52d6 |
763 | Handle(GeomAdaptor_Surface) Hsurfsam = new GeomAdaptor_Surface(surfsam); |
7fd59977 |
764 | Handle(Geom2d_Curve) pcsurfsam; |
765 | Bsam = ChFi3d_mkbound(Hsurfsam,pcsurfsam,ppopsam,ppcosam,tolesp,2.e-4); |
766 | Standard_Real upcopdif = sddif->Interference(ifaopdif).Parameter(isfirstdif); |
767 | gp_Pnt2d ppopdif = |
768 | sddif->Interference(ifaopdif).PCurveOnSurf()->Value(upcopdif); |
769 | gp_Pnt2d ppcodif = |
770 | sddif->Interference(ifacodif).PCurveOnSurf()->Value(uintpcdif); |
771 | Handle(Geom_Surface) surfdif = DStr.Surface(sddif->Surf()).Surface(); |
c22b52d6 |
772 | Handle(GeomAdaptor_Surface) Hsurfdif = new GeomAdaptor_Surface(surfdif); |
7fd59977 |
773 | Handle(Geom2d_Curve) pcsurfdif; |
774 | Bdif = ChFi3d_mkbound(Hsurfdif,pcsurfdif,ppcodif,ppopdif,tolesp,2.e-4); |
775 | gp_Pnt2d ppfacsam,ppfacdif; |
776 | gp_Pnt PPfacsam,PPfacdif; |
777 | gp_Vec VVfacsam,VVfacdif; |
778 | sdsam->Interference(ifaopsam).PCurveOnFace()->D0(uintpcsam,ppfacsam); |
779 | const Handle(Geom_Curve)& curvopsam = |
780 | DStr.Curve(sdsam->Interference(ifaopsam).LineIndex()).Curve(); |
781 | curvopsam->D1(uintpcsam,PPfacsam,VVfacsam); |
782 | BRepAdaptor_Curve2d PCArcFac(Arcopdif,Fopsam); |
783 | PCArcFac.D0(cpopdif.ParameterOnArc(),ppfacdif); |
7d92212e |
784 | //jgv for OCC26173 |
785 | BRepAdaptor_Surface SurFopsam(Fopsam); |
786 | if (SurFopsam.IsUClosed()) |
787 | { |
788 | Standard_Real Uperiod = SurFopsam.LastUParameter() - SurFopsam.FirstUParameter(); |
789 | if (Abs(ppfacsam.X() - ppfacdif.X()) > Uperiod/2) |
790 | { |
791 | if (ppfacdif.X() < ppfacsam.X()) |
792 | ppfacdif.SetX(ppfacdif.X() + Uperiod); |
793 | else |
794 | ppfacdif.SetX(ppfacdif.X() - Uperiod); |
795 | } |
796 | } |
797 | ////////////////// |
7fd59977 |
798 | BRepAdaptor_Curve CArcFac(Arcopdif); |
799 | CArcFac.D1(cpopdif.ParameterOnArc(),PPfacdif,VVfacdif); |
c22b52d6 |
800 | Handle(BRepAdaptor_Surface) HBRFopsam = new BRepAdaptor_Surface(); |
801 | BRepAdaptor_Surface& BRFopsam = *HBRFopsam; |
7fd59977 |
802 | BRFopsam.Initialize(Fopsam,Standard_False); |
803 | Handle(Geom2d_Curve) pcFopsam = ChFi3d_BuildPCurve(HBRFopsam, |
804 | ppfacsam,VVfacsam, |
805 | ppfacdif,VVfacdif,1); |
806 | Bfac = ChFi3d_mkbound(HBRFopsam,pcFopsam,tolesp,2.e-4); |
807 | GeomFill_ConstrainedFilling fil(8,20); |
808 | fil.Init(Bsam,Bdif,Bfac,1); |
809 | #if 0 |
810 | for(Standard_Integer ib = 0; ib < 4; ib++){ |
811 | if(ib == 2) continue; |
812 | fil.CheckCoonsAlgPatch(ib); |
813 | fil.CheckTgteField(ib); |
814 | fil.CheckApprox(ib); |
815 | fil.CheckResult(ib); |
816 | } |
817 | #endif |
818 | Handle(Geom_Surface) Surfcoin = fil.Surface(); |
819 | TopAbs_Orientation Osurfsam = sdsam->Orientation(); |
820 | Handle(Geom2d_Curve) pcnul; |
821 | done = CompleteData(coin,Surfcoin, |
822 | Hsurfsam,pcsurfsam, |
823 | HBRFopsam,pcnul,Osurfsam,1, |
824 | 0,0,0,0); |
0797d9d3 |
825 | #ifdef OCCT_DEBUG |
81bba717 |
826 | ChFi3d_ResultChron(ch , t_remplissage);// result perf filling |
7fd59977 |
827 | #endif |
9775fa61 |
828 | if(!done) throw Standard_Failure("concavites inverted : fail"); |
0797d9d3 |
829 | #ifdef OCCT_DEBUG |
81bba717 |
830 | ChFi3d_InitChron(ch); // init perf update DS |
7fd59977 |
831 | #endif |
81bba717 |
832 | // Update 3 CornerData and the DS |
7fd59977 |
833 | // ---------------------------------------- |
81bba717 |
834 | // the corner to start, |
7fd59977 |
835 | // ----------------------- |
836 | Standard_Real P1deb,P2deb,P1fin,P2fin; |
837 | Standard_Integer If1,If2,Il1,Il2,Icf,Icl; |
838 | const ChFiDS_CommonPoint& Pf1 = coin->VertexFirstOnS1(); |
839 | ChFiDS_CommonPoint& Pf2 = coin->ChangeVertexFirstOnS2(); |
840 | const ChFiDS_CommonPoint& Pl1 = coin->VertexLastOnS1(); |
841 | ChFiDS_CommonPoint& Pl2 = coin->ChangeVertexLastOnS2(); |
842 | Pf2 = Pl2 = cpopdif; |
843 | |
844 | ChFiDS_Regul regdeb, regfin; |
845 | If1 = ChFi3d_IndexPointInDS(Pf1,DStr); |
846 | If2 = ChFi3d_IndexPointInDS(Pf2,DStr); |
847 | Il1 = ChFi3d_IndexPointInDS(Pl1,DStr); |
848 | Il2 = If2; |
849 | |
850 | gp_Pnt2d pp1,pp2; |
851 | pp1 = coin->InterferenceOnS1().PCurveOnSurf()-> |
852 | Value(coin->InterferenceOnS1().FirstParameter()); |
853 | pp2 = coin->InterferenceOnS2().PCurveOnSurf()-> |
854 | Value(coin->InterferenceOnS2().FirstParameter()); |
855 | Handle(Geom_Curve) C3d; |
856 | Standard_Real tolreached; |
857 | ChFi3d_ComputeArete(Pf1,pp1,Pf2,pp2, |
858 | DStr.Surface(coin->Surf()).Surface(),C3d, |
859 | corner->ChangeFirstPCurve(),P1deb,P2deb, |
860 | tolesp,tol2d,tolreached,0); |
861 | Standard_Real tolr1; |
c22b52d6 |
862 | Handle(GeomAdaptor_Curve) HC3d = new GeomAdaptor_Curve(C3d); |
7fd59977 |
863 | ChFi3d_SameParameter(HC3d,pcFopsam,HBRFopsam,tolesp,tolr1); |
864 | tolreached = Max(tolreached,tolr1); |
865 | TopOpeBRepDS_Curve Tcurv1(C3d,tolreached); |
866 | Icf = DStr.AddCurve(Tcurv1); |
81bba717 |
867 | // place the pcurve on face in the DS |
7fd59977 |
868 | TopAbs_Orientation OpcFopsam = sdsam->Interference(ifaopsam).Transition(); |
869 | Standard_Integer IFopsam = sdsam->Index(ifaopsam); |
870 | if(isfirstsam) OpcFopsam = TopAbs::Reverse(OpcFopsam); |
871 | Handle(TopOpeBRepDS_SurfaceCurveInterference) |
872 | interf = ChFi3d_FilCurveInDS(Icf,IFopsam,pcFopsam,OpcFopsam); |
873 | DStr.ChangeShapeInterferences(IFopsam).Append(interf); |
874 | |
875 | regdeb.SetCurve(Icf); |
876 | regdeb.SetS1(coin->Surf(),0); |
877 | regdeb.SetS2(IFopsam,1); |
878 | myRegul.Append(regdeb); |
879 | corner->ChangeFirstCurve(Icf); |
880 | corner->ChangeFirstParameters(P1deb,P2deb); |
881 | corner->ChangeIndexFirstPointOnS1(If1); |
882 | corner->ChangeIndexFirstPointOnS2(If2); |
883 | |
884 | pp1 = coin->InterferenceOnS1().PCurveOnSurf()-> |
885 | Value(coin->InterferenceOnS1().LastParameter()); |
886 | pp2 = coin->InterferenceOnS2().PCurveOnSurf()-> |
887 | Value(coin->InterferenceOnS2().LastParameter()); |
888 | ChFi3d_ComputeArete(Pl1,pp1,Pl2,pp2, |
889 | DStr.Surface(coin->Surf()).Surface(),C3d, |
890 | corner->ChangeLastPCurve(),P1fin,P2fin, |
891 | tolesp,tol2d,tolreached,0); |
892 | Standard_Real tolr2; |
c22b52d6 |
893 | HC3d->Load(C3d); |
7fd59977 |
894 | ChFi3d_SameParameter(HC3d,pcsurfdif,Hsurfdif,tolesp,tolr2); |
895 | tolreached = Max(tolreached,tolr2); |
896 | TopOpeBRepDS_Curve Tcurv2(C3d,tolreached); |
897 | Icl = DStr.AddCurve(Tcurv2); |
898 | regfin.SetCurve(Icl); |
899 | regfin.SetS1(coin->Surf(),0); |
900 | regfin.SetS2(sddif->Surf(),0); |
901 | myRegul.Append(regfin); |
902 | corner->ChangeLastCurve(Icl); |
903 | corner->ChangeLastParameters(P1fin,P2fin); |
904 | corner->ChangeIndexLastPointOnS1(Il1); |
905 | corner->ChangeIndexLastPointOnS2(Il2); |
906 | |
907 | coin->ChangeIndexOfS1(-sdsam->Surf()); |
908 | coin->ChangeIndexOfS2(0); |
909 | |
910 | corner->SetSolidIndex(stsam->SolidIndex()); |
911 | |
81bba717 |
912 | // then Stripe OnSame |
7fd59977 |
913 | // --------------------- |
914 | const ChFiDS_FaceInterference& intcoin1 = coin->InterferenceOnS1(); |
915 | stsam->SetCurve(intcoin1.LineIndex(),isfirstsam); |
81bba717 |
916 | stsam->InDS(isfirstsam); // filDS already works from the corner. |
7fd59977 |
917 | stsam->ChangePCurve(isfirstsam) = coin->InterferenceOnS1().PCurveOnFace(); |
918 | stsam->SetIndexPoint(If1,isfirstsam,ifaopsam); |
919 | stsam->SetIndexPoint(Il1,isfirstsam,ifacosam); |
920 | stsam->SetParameters(isfirstsam, |
921 | intcoin1.FirstParameter(), |
922 | intcoin1.LastParameter()); |
923 | sdsam->ChangeVertex(isfirstsam,ifaopsam) = Pf1; |
924 | sdsam->ChangeVertex(isfirstsam,ifacosam) = Pl1; |
925 | sdsam->ChangeInterferenceOnS1().SetParameter(uintpcsam,isfirstsam); |
926 | sdsam->ChangeInterferenceOnS2().SetParameter(uintpcsam,isfirstsam); |
927 | if (ifaopsam == 2) stsam->SetOrientation(TopAbs_REVERSED,isfirstsam); |
928 | |
81bba717 |
929 | // then Stripe OnDiff |
7fd59977 |
930 | // --------------------- |
931 | stdif->SetCurve(Icl,isfirstdif); |
932 | stdif->ChangePCurve(isfirstdif) = pcsurfdif; |
933 | stdif->SetIndexPoint(Il2,isfirstdif,ifaopdif); |
934 | stdif->SetIndexPoint(Il1,isfirstdif,ifacodif); |
935 | stdif->SetParameters(isfirstdif,P1fin,P2fin); |
936 | sddif->ChangeVertex(isfirstdif,ifaopdif) = Pl2; |
937 | sddif->ChangeVertex(isfirstdif,ifacodif) = Pl1; |
938 | sddif->ChangeInterference(ifacodif).SetParameter(uintpcdif,isfirstdif); |
939 | if (ifaopdif == 1) stdif->SetOrientation(TopAbs_REVERSED,isfirstdif); |
0797d9d3 |
940 | #ifdef OCCT_DEBUG |
81bba717 |
941 | ChFi3d_ResultChron(ch , t_t2cornerDS);// result perf update DS |
7fd59977 |
942 | #endif |
943 | } |
944 | if(!myEVIMap.IsBound(Vtx)){ |
945 | TColStd_ListOfInteger li; |
946 | myEVIMap.Bind(Vtx,li); |
947 | } |
948 | myEVIMap.ChangeFind(Vtx).Append(coin->Surf()); |
949 | myListStripe.Append(corner); |
950 | } |
951 | } |
952 | |