1 // File : IntImpParGen_Intersector.gxx
2 // Created : Mon Mar 2 14:00:00 1992
3 // Author : Laurent BUCHARD
5 // Copyright: Matra Datavision 1992
8 #include <Standard_ConstructionError.hxx>
9 #include <IntRes2d_Domain.hxx>
10 #include <IntRes2d_IntersectionPoint.hxx>
11 #include <IntRes2d_IntersectionSegment.hxx>
12 #include <IntRes2d_SequenceOfIntersectionPoint.hxx>
13 #include <IntRes2d_SequenceOfIntersectionSegment.hxx>
14 #include <IntRes2d_Transition.hxx>
15 #include <IntRes2d_Position.hxx>
17 #include <IntImpParGen.hxx>
19 #include <math_FunctionSample.hxx>
20 #include <math_FunctionAllRoots.hxx>
22 #include <TColStd_Array1OfReal.hxx>
24 #include <gp_Vec2d.hxx>
26 //======================================================================
28 #define EPSNUL TolConf
29 #define EPSX ParTool::EpsX(TheParCurve)
30 #define NB_ECHANTILLONS
32 static Standard_Real PIpPI = M_PI + M_PI;
36 //======================================================================
37 void IntImpParGen_Intersector::And_Domaine_Objet1_Intersections(const ImpTool& TheImpTool,
38 const ParCurve& TheParCurve,
39 const IntRes2d_Domain& TheImpCurveDomain,
40 const IntRes2d_Domain& TheParCurveDomain,
41 Standard_Integer& NbResultats,
42 TColStd_Array1OfReal& Inter2_And_Domain2,
43 TColStd_Array1OfReal& Inter1,
44 TColStd_Array1OfReal& Resultat1,
45 TColStd_Array1OfReal& Resultat2,
46 const Standard_Real EpsNul) const {
49 Standard_Integer Nb_Bornes_Intersection=NbResultats;
52 for(Standard_Integer i=1; i<=Nb_Bornes_Intersection; i+=2) {
53 Standard_Boolean reverse=Standard_False;
55 Standard_Real param1=Inter1.Value(i);
56 Standard_Real param2=Inter1.Value(i+1);
58 Standard_Integer indice_1=i;
59 Standard_Integer indice_2=i+1;
62 Standard_Real t=param1; param1=param2; param2=t;
65 reverse=Standard_True;
68 gp_Pnt2d Pt1=TheImpTool.Value(param1);
69 gp_Pnt2d Pt2=TheImpTool.Value(param2);
72 Standard_Boolean IsOnTheImpCurveDomain1=Standard_True;
73 Standard_Boolean IsOnABoundary1=Standard_False;
75 Standard_Boolean IsOnTheImpCurveDomain2=Standard_True;
76 Standard_Boolean IsOnABoundary2=Standard_False;
77 //--------------------------------------------------------------------
78 if(TheImpCurveDomain.HasFirstPoint()) {
79 if(param1<TheImpCurveDomain.FirstParameter()) {
80 if(Pt1.Distance(TheImpCurveDomain.FirstPoint())
81 > TheImpCurveDomain.FirstTolerance()) {
82 IsOnTheImpCurveDomain1=Standard_False;
84 else { IsOnABoundary1=Standard_True; }
87 if(IsOnTheImpCurveDomain1 && TheImpCurveDomain.HasLastPoint()) {
88 if(param1>TheImpCurveDomain.LastParameter()) {
89 if(Pt1.Distance(TheImpCurveDomain.LastPoint())
90 > TheImpCurveDomain.FirstTolerance()) {
91 IsOnTheImpCurveDomain1=Standard_False;
93 else { IsOnABoundary1=Standard_True; }
96 //--------------------------------------------------------------------
97 if(TheImpCurveDomain.HasFirstPoint()) {
98 if(param2<TheImpCurveDomain.FirstParameter()) {
99 if(Pt2.Distance(TheImpCurveDomain.FirstPoint())
100 > TheImpCurveDomain.FirstTolerance()) {
101 IsOnTheImpCurveDomain2=Standard_False;
103 else { IsOnABoundary2=Standard_True; }
106 if(IsOnTheImpCurveDomain2 && TheImpCurveDomain.HasLastPoint()) {
107 if(param2>TheImpCurveDomain.LastParameter()) {
108 if(Pt2.Distance(TheImpCurveDomain.LastPoint())
109 > TheImpCurveDomain.FirstTolerance()) {
110 IsOnTheImpCurveDomain2=Standard_False;
112 else { IsOnABoundary2=Standard_True; }
116 if(IsOnTheImpCurveDomain1) {
117 //------------------------------------------------------------------
118 //--- la borne 1 est sur le domaine --
120 Resultat1.SetValue(NbResultats,Inter1.Value(indice_1));
121 Resultat2.SetValue(NbResultats,Inter2_And_Domain2.Value(indice_1));
122 //--- la borne2 est aussi sur le domaine ---
123 if(IsOnTheImpCurveDomain2) {
125 Resultat1.SetValue(NbResultats,Inter1.Value(indice_2));
126 Resultat2.SetValue(NbResultats,Inter2_And_Domain2.Value(indice_2));
129 //--- Borne1 sur domaine et Borne 2 Hors Domaine ---
132 t=TheImpCurveDomain.LastParameter();
133 Resultat1.SetValue(NbResultats,t);
134 // Standard_Real popResult = FindV(t,Pt,TheImpTool,TheParCurve,
135 // TheParCurveDomain,
136 // Inter2_And_Domain2.Value(indice_1),
137 // Inter2_And_Domain2.Value(indice_2),
140 // Resultat2.SetValue(NbResultats,popResult);
141 Resultat2.SetValue(NbResultats,
142 IntImpParGen_Intersector::FindV(t,Pt,TheImpTool,TheParCurve,
144 Inter2_And_Domain2.Value(indice_1),
145 Inter2_And_Domain2.Value(indice_2),
149 else { //======= la borne1 n est pas sur le domaine ========
150 if(IsOnTheImpCurveDomain2) {
153 t=TheImpCurveDomain.FirstParameter();
155 Resultat1.SetValue(NbResultats,t);
156 Resultat2.SetValue(NbResultats,
157 IntImpParGen_Intersector::FindV(t,Pt,TheImpTool,TheParCurve,
159 Inter2_And_Domain2.Value(indice_1),
160 Inter2_And_Domain2.Value(indice_2),
164 Resultat1.SetValue(NbResultats,Inter1.Value(indice_2));
165 Resultat2.SetValue(NbResultats,Inter2_And_Domain2.Value(indice_2));
167 else { //====== la borne2 et la borne1 sont hors domaine =====
168 if(param1<TheImpCurveDomain.FirstParameter()
169 && param2>TheImpCurveDomain.LastParameter()) {
172 t=TheImpCurveDomain.FirstParameter();
173 Resultat1.SetValue(NbResultats,t);
174 Resultat2.SetValue(NbResultats,
175 IntImpParGen_Intersector::FindV(t,Pt,TheImpTool,TheParCurve,
177 Inter2_And_Domain2.Value(indice_1),
178 Inter2_And_Domain2.Value(indice_2),
184 t=TheImpCurveDomain.LastParameter();
185 Resultat1.SetValue(NbResultats,t);
186 Resultat2.SetValue(NbResultats,
187 IntImpParGen_Intersector::FindV(t,Pt,TheImpTool,TheParCurve,
189 Inter2_And_Domain2.Value(indice_1),
190 Inter2_And_Domain2.Value(indice_2),
198 //======================================================================
199 //-- C o n s t r u c t e u r s e t P e r f o r m
200 IntImpParGen_Intersector::IntImpParGen_Intersector() {
203 //----------------------------------------------------------------------
205 IntImpParGen_Intersector::IntImpParGen_Intersector(const ImpTool& TheImpTool,
206 const IntRes2d_Domain& TheImpCurveDomain,
207 const ParCurve& TheParCurve,
208 const IntRes2d_Domain& TheParCurveDomain,
209 const Standard_Real TolConf,
210 const Standard_Real Tol) {
211 Perform(TheImpTool,TheImpCurveDomain,TheParCurve,TheParCurveDomain,TolConf,Tol);
213 //----------------------------------------------------------------------
215 void IntImpParGen_Intersector::Perform(const ImpTool& TheImpTool,
216 const IntRes2d_Domain& TheImpCurveDomain,
217 const ParCurve& TheParCurve,
218 const IntRes2d_Domain& TheParCurveDomain,
219 const Standard_Real TolConf,
220 const Standard_Real Tol) {
223 Standard_Integer i,nb_segments_solution, nb_points_solution;
224 Standard_Real param1,param2,EpsX, EpsNul, EpsDist;
226 IntRes2d_Transition Trans1,Trans2;
228 gp_Vec2d Tan1,Tan2,Norm1,Norm2;
229 IntRes2d_Position Pos1,Pos2;
232 //----------------------------------------------
233 //-- On teste apres appel aux maths si les bornes
234 //-- des domaines sont des solutions
236 Standard_Boolean HeadOnImp =Standard_False;
237 Standard_Boolean HeadOnPar =Standard_False;
238 Standard_Boolean EndOnImp =Standard_False;
239 Standard_Boolean EndOnPar =Standard_False;
243 IntImpParGen_MyImpParTool TheImpParTool(TheImpTool,TheParCurve);
245 if (! (TheParCurveDomain.HasFirstPoint() &&
246 TheParCurveDomain.HasLastPoint())) {
247 Standard_ConstructionError::Raise("Domaine sur courbe incorrect");
250 Standard_Integer nb_echantillons = ParTool::NbSamples(TheParCurve,
251 TheParCurveDomain.FirstParameter(),
252 TheParCurveDomain.LastParameter());
255 if(EpsX>1.0e-10) EpsX = 1.0e-10;
256 EpsNul=(TolConf<=1.0e-10)? 1.0e-10: TolConf;
257 EpsDist=(Tol<=1.0e-10)? 1.0e-10: Tol;
259 Standard_Real Tolerance_Angulaire=EpsDist;
263 if((TheParCurveDomain.LastParameter() - TheParCurveDomain.FirstParameter()) < 100.0*EpsX) {
264 EpsX = (TheParCurveDomain.LastParameter() - TheParCurveDomain.FirstParameter())*0.01;
267 math_FunctionSample Sample2(TheParCurveDomain.FirstParameter(),
268 TheParCurveDomain.LastParameter(),
271 math_FunctionAllRoots Sol(TheImpParTool,
277 if(!Sol.IsDone()) {done = Standard_False; return; }
279 nb_segments_solution=Sol.NbIntervals();
280 nb_points_solution=Sol.NbPoints();
282 //--------------------------------------------------------------------
283 //-- T r a i t e m e n t d e s P o i n t s S o l u t i o n s
284 for(i=1; i<=nb_points_solution; i++) {
286 param2=Sol.GetPoint(i);
287 param1=FindU(param2,Pt,TheParCurve,TheImpTool);
289 if(TheImpCurveDomain.IsClosed()) {
290 param1 = IntImpParGen::NormalizeOnDomain( param1
294 Standard_Boolean IsOnTheImpCurveDomain=Standard_True;
295 if(TheImpCurveDomain.HasFirstPoint()) {
296 if(param1<TheImpCurveDomain.FirstParameter()) {
297 if(Pt.Distance(TheImpCurveDomain.FirstPoint())
298 > TheImpCurveDomain.FirstTolerance()) {
299 IsOnTheImpCurveDomain=Standard_False;
303 if(IsOnTheImpCurveDomain && TheImpCurveDomain.HasLastPoint()) {
304 if(param1>TheImpCurveDomain.LastParameter()) {
305 if(Pt.Distance(TheImpCurveDomain.LastPoint())
306 > TheImpCurveDomain.FirstTolerance()) {
307 IsOnTheImpCurveDomain=Standard_False;
312 if(IsOnTheImpCurveDomain) {
313 TheImpTool.D2(param1,pt1,Tan1,Norm1);
314 ParTool::D2(TheParCurve,param2,pt2,Tan2,Norm2);
316 IntImpParGen::DeterminePosition(Pos1,TheImpCurveDomain,pt1,param1);
317 IntImpParGen::DeterminePosition(Pos2,TheParCurveDomain,pt2,param2);
319 if(Pos1==IntRes2d_End) EndOnImp = Standard_True;
320 else if(Pos1==IntRes2d_Head) HeadOnImp = Standard_True;
321 if(Pos2==IntRes2d_End) EndOnPar = Standard_True;
322 else if(Pos2==IntRes2d_Head) HeadOnPar = Standard_True;
324 IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
325 Pos2,Tan2,Norm2,Trans2,
326 Tolerance_Angulaire);
328 IntRes2d_IntersectionPoint IP(pt1,param1,param2
330 ,ReversedParameters());
334 //-- F i n d u T r a i t e m e n t d e s P t s S o l.
337 //--------------------------------------------------------------------
338 //-- T r a i t e m e n t D e s S e g m e n t s ---
339 //--------------------------------------------------------------------
340 //-- On a N segments solution sur le domaine de V soit au pire :
341 //-- --> N segments solution sur le domaine de U
342 //-- -->2N segments si la courbe en U est fermee
345 TColStd_Array1OfReal Inter2_and_Domaine2(1,2+8*nb_segments_solution);
346 TColStd_Array1OfReal Inter1(1,2+8*nb_segments_solution);
348 Standard_Integer nb_segments_crees=0;
350 for (Standard_Integer j2=1,j=1;j<=nb_segments_solution;j++,j2+=2) {
351 Standard_Real param2_inf,param2_sup;
352 Standard_Real param1_inf,param1_sup;
355 Sol.GetInterval(j,param2_inf,param2_sup);
356 param1_inf=FindU(param2_inf,Ptemp,TheParCurve,TheImpTool);
357 param1_sup=FindU(param2_sup,Ptemp,TheParCurve,TheImpTool);
359 //----------------------------------------------------------------------
360 //-- C o u r b e I m p l i c i t e F e r m e e
362 if(TheImpCurveDomain.IsClosed()) {
365 gp_Vec2d T1,T2,N1,N2;
366 Standard_Real param1_origine,param1_fin;
368 TheImpCurveDomain.EquivalentParameters(param1_origine,param1_fin);
369 Standard_Real Periode=param1_fin-param1_origine;
371 while(param1_inf<param1_origine) { param1_inf+=Periode; }
372 while(param1_sup<param1_origine) { param1_sup+=Periode; }
374 ParTool::D2(TheParCurve,param2_inf,Ptemp,T2,N2);
375 TheImpTool.D2(param1_inf,Ptemp,T1,N1);
376 if(T1.Magnitude()<=gp::Resolution()) T1=N1;
377 if(T2.Magnitude()<=gp::Resolution()) T2=N2;
379 if(T1.Dot(T2) >=0.0) {
380 //--- param1_inf designe un point entrant (et T1 est vers la matiere)
381 if(param1_inf>=param1_sup) { param1_sup+=Periode; }
383 else { //--- param1_inf : point sortant (et T1 est Hors matiere)
384 if(param1_inf<=param1_sup) { param1_inf+=Periode; }
386 //--- On cree un nouveau segment decale de Periode
387 //-- Exemple de Pb : Domaine PI/4 PI/2 et intervalle 0,PI
388 //-- Domaine 1.5PI 2.5PI et intervalle 0,PI
390 //-- ------|--------------------|-----------------|-----------
391 //-- [----------------------------] Domaine
392 //-- [~~~~~~~~~~~~~~~~~] Inters.
394 //-- On cree un nouvel intervalle
396 //-- [a~~~~~~~~~~~~b] [a~~~~~~~~~~~~~~~b] et [a~~~]
400 if(TheImpCurveDomain.LastParameter()
401 > ((param1_inf>param1_sup)? (param1_sup+Periode):
402 (param1_inf+Periode))) {
403 Inter2_and_Domaine2.SetValue(j2,param2_inf);
404 Inter1.SetValue(j2,param1_inf+Periode);
406 Inter2_and_Domaine2.SetValue(j2+1,param2_sup);
407 Inter1.SetValue(j2+1,param1_sup+Periode);
412 if(TheImpCurveDomain.FirstParameter()
413 <((param1_inf<param1_sup)? (param1_sup-Periode): (param1_inf-Periode))) {
414 Inter2_and_Domaine2.SetValue(j2,param2_inf);
415 Inter1.SetValue(j2,param1_inf-Periode);
417 Inter2_and_Domaine2.SetValue(j2+1,param2_sup);
418 Inter1.SetValue(j2+1,param1_sup-Periode);
423 //-- F i n C o u r b e I m p l i c i t e F e r m e e
424 //----------------------------------------------------------------------
427 Inter2_and_Domaine2.SetValue(j2,param2_inf);
428 Inter1.SetValue(j2,param1_inf);
430 Inter2_and_Domaine2.SetValue(j2+1,param2_sup);
431 Inter1.SetValue(j2+1,param1_sup);
434 //------------------------------------------------------------------
435 //-- INTER2_DOMAINE2 : Intersection AND CurveDomain : Function of PARAM2
436 //-- INTER1 : Intersection AND CurveDomain : Function of PARAM1
437 //------------------------------------------------------------------
439 TColStd_Array1OfReal Resultat1(1,2+(1+nb_segments_solution)*2);
440 TColStd_Array1OfReal Resultat2(1,2+(1+nb_segments_solution)*2);
441 nb_segments_solution+=nb_segments_crees;
442 Standard_Integer NbResultats=nb_segments_solution*2;
444 And_Domaine_Objet1_Intersections(TheImpTool,
449 Inter2_and_Domaine2,Inter1,
450 Resultat1,Resultat2,EpsNul);
452 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
453 //Calcule_Toutes_Transitions(NbResultats,
454 // Resultat1,Resultat2,
456 // TheImpCurveDomain,
458 // TheParCurveDomain);
459 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
460 //~~~ Fonction Calcule_Toutes_Transitions Repportee ici pour cause ~~~~~
461 //~~~~~ D acces aux methodes Protected APPEND
462 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
464 IntRes2d_Position Pos1,Pos2;
465 IntRes2d_Transition Trans1,Trans2;
466 gp_Vec2d Tan1,Tan2,Norm1,Norm2;
467 gp_Pnt2d Pt1_on1,Pt2_on1,Pt1_on2,Pt2_on2;
468 Standard_Real Param1_on1,Param2_on1,Param1_on2,Param2_on2;
470 Standard_Real Dist_Mini_ImpCurve=EPSNUL;
471 Standard_Real Tolerance_Angulaire=Dist_Mini_ImpCurve;
474 for(Standard_Integer i=1; i<=NbResultats ; i+=2) {
475 Standard_Integer ip1=i+1;
476 Standard_Boolean OnlyOnePoint=Standard_False;
478 Param1_on1=Resultat1.Value(i);
479 Param1_on2=Resultat2.Value(i);
480 Param2_on1=Resultat1.Value(ip1);
481 Param2_on2=Resultat2.Value(ip1);
483 Pt1_on1=TheImpTool.Value(Param1_on1);
484 Pt2_on1=TheImpTool.Value(Param2_on1);
485 Pt1_on2=ParTool::Value(TheParCurve,Param1_on2);
486 Pt2_on2=ParTool::Value(TheParCurve,Param2_on2);
488 if(!TheImpCurveDomain.IsClosed()) {
489 if( Pt1_on1.Distance(Pt2_on1) <= Dist_Mini_ImpCurve ) {
490 if( Pt1_on2.Distance(Pt2_on2) <= Dist_Mini_ImpCurve ) {
491 OnlyOnePoint=Standard_True;
496 Param1_on1=IntImpParGen::NormalizeOnDomain(Param1_on1,TheImpCurveDomain);
497 Param1_on2=IntImpParGen::NormalizeOnDomain(Param1_on2,TheParCurveDomain);
499 TheImpTool.D2(Param1_on1,Pt1_on1,Tan1,Norm1);
500 ParTool::D2(TheParCurve,Param1_on2,Pt1_on2,Tan2,Norm2);
502 IntImpParGen::DeterminePosition(Pos1,TheImpCurveDomain,Pt1_on1,Param1_on1);
503 IntImpParGen::DeterminePosition(Pos2,TheParCurveDomain,Pt1_on2,Param1_on2);
505 if(Pos1==IntRes2d_End) EndOnImp = Standard_True;
506 else if(Pos1==IntRes2d_Head) HeadOnImp = Standard_True;
507 if(Pos2==IntRes2d_End) EndOnPar = Standard_True;
508 else if(Pos2==IntRes2d_Head) HeadOnPar = Standard_True;
511 IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
512 Pos2,Tan2,Norm2,Trans2,
513 Tolerance_Angulaire);
515 //============== Detection du cas : L intersection est en bout
516 //============== sur les 2 domaines
518 if(Pos1!=IntRes2d_Middle && Pos2!=IntRes2d_Middle) {
519 Standard_Real m=0.5*(Pt1_on1.X() + Pt1_on2.X());
521 m=0.5*(Pt1_on1.Y() + Pt1_on2.Y());
525 IntRes2d_IntersectionPoint new_p1(Pt1_on1
526 ,Param1_on1,Param1_on2
528 ,ReversedParameters());
530 IntRes2d_IntersectionPoint new_p2;
532 Param2_on1=IntImpParGen::NormalizeOnDomain(Param2_on1,TheImpCurveDomain);
533 Param2_on2=IntImpParGen::NormalizeOnDomain(Param2_on2,TheParCurveDomain);
535 TheImpTool.D2(Param2_on1,Pt2_on1,Tan1,Norm1);
536 ParTool::D2(TheParCurve,Param2_on2,Pt2_on2,Tan2,Norm2);
538 IntImpParGen::DeterminePosition(Pos1,TheImpCurveDomain,Pt2_on1,Param2_on1);
539 IntImpParGen::DeterminePosition(Pos2,TheParCurveDomain,Pt2_on2,Param2_on2);
541 if(Pos1==IntRes2d_End) EndOnImp = Standard_True;
542 else if(Pos1==IntRes2d_Head) HeadOnImp = Standard_True;
543 if(Pos2==IntRes2d_End) EndOnPar = Standard_True;
544 else if(Pos2==IntRes2d_Head) HeadOnPar = Standard_True;
546 IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
547 Pos2,Tan2,Norm2,Trans2,
548 Tolerance_Angulaire);
551 //============== Detection du cas : L intersection est en bout
552 //============== sur les 2 domaines
554 if(Pos1!=IntRes2d_Middle && Pos2!=IntRes2d_Middle) {
555 Standard_Real m=0.5*(Pt2_on1.X() + Pt2_on2.X() );
557 m=0.5*(Pt2_on1.Y() + Pt2_on2.Y());
561 new_p2.SetValues(Pt2_on1,Param2_on1,Param2_on2
563 ,ReversedParameters());
565 Standard_Boolean segopposite=((Tan1.Dot(Tan2) < 0.0)?
566 Standard_True : Standard_False);
568 IntRes2d_IntersectionSegment new_seg(new_p1,new_p2
570 ,ReversedParameters());
577 } //~~~~~~~~~~~~ Fin du corps de la fonction Calc...Transitions~~~~~~~~~~
579 //-------------------------------------------
580 //-- On teste les points en bouts solutions
582 if(!HeadOnImp && TheImpCurveDomain.HasFirstPoint()) {
584 if(TheImpCurveDomain.FirstPoint().Distance(TheParCurveDomain.FirstPoint())
585 <= Max(TheImpCurveDomain.FirstTolerance(),TheParCurveDomain.FirstTolerance())) {
586 param1 = TheImpCurveDomain.FirstParameter();
587 param2 = TheParCurveDomain.FirstParameter();
588 TheImpTool.D2(param1,pt1,Tan1,Norm1);
589 ParTool::D2(TheParCurve,param2,pt2,Tan2,Norm2);
590 IntImpParGen::DetermineTransition(IntRes2d_Head,Tan1,Norm1,Trans1,
591 IntRes2d_Head,Tan2,Norm2,Trans2,
592 Tolerance_Angulaire);
593 IntRes2d_IntersectionPoint IP(TheImpCurveDomain.FirstPoint(),
596 ReversedParameters());
601 if(TheImpCurveDomain.FirstPoint().Distance(TheParCurveDomain.LastPoint())
602 <= Max(TheImpCurveDomain.FirstTolerance(),TheParCurveDomain.LastTolerance())) {
603 param1 = TheImpCurveDomain.FirstParameter();
604 param2 = TheParCurveDomain.LastParameter();
605 TheImpTool.D2(param1,pt1,Tan1,Norm1);
606 ParTool::D2(TheParCurve,param2,pt2,Tan2,Norm2);
607 IntImpParGen::DetermineTransition(IntRes2d_Head,Tan1,Norm1,Trans1,
608 IntRes2d_End ,Tan2,Norm2,Trans2,
609 Tolerance_Angulaire);
610 IntRes2d_IntersectionPoint IP(TheImpCurveDomain.FirstPoint(),
613 ReversedParameters());
619 if(!EndOnImp && TheImpCurveDomain.HasLastPoint()) {
621 if(TheImpCurveDomain.LastPoint().Distance(TheParCurveDomain.FirstPoint())
622 <= Max(TheImpCurveDomain.LastTolerance(),TheParCurveDomain.FirstTolerance())) {
623 param1 = TheImpCurveDomain.LastParameter();
624 param2 = TheParCurveDomain.FirstParameter();
625 TheImpTool.D2(param1,pt1,Tan1,Norm1);
626 ParTool::D2(TheParCurve,param2,pt2,Tan2,Norm2);
627 IntImpParGen::DetermineTransition(IntRes2d_End,Tan1,Norm1,Trans1,
628 IntRes2d_Head,Tan2,Norm2,Trans2,
629 Tolerance_Angulaire);
630 IntRes2d_IntersectionPoint IP(TheImpCurveDomain.LastPoint(),
633 ReversedParameters());
638 if(TheImpCurveDomain.LastPoint().Distance(TheParCurveDomain.LastPoint())
639 <= Max(TheImpCurveDomain.LastTolerance(),TheParCurveDomain.LastTolerance())) {
640 param1 = TheImpCurveDomain.LastParameter();
641 param2 = TheParCurveDomain.LastParameter();
642 TheImpTool.D2(param1,pt1,Tan1,Norm1);
643 ParTool::D2(TheParCurve,param2,pt2,Tan2,Norm2);
644 IntImpParGen::DetermineTransition(IntRes2d_End,Tan1,Norm1,Trans1,
645 IntRes2d_End,Tan2,Norm2,Trans2,
646 Tolerance_Angulaire);
647 IntRes2d_IntersectionPoint IP(TheImpCurveDomain.LastPoint(),
650 ReversedParameters());
663 Standard_Real IntImpParGen_Intersector::FindU(const Standard_Real parameter
665 ,const ParCurve& TheParCurve
666 ,const ImpTool& TheImpTool) const
668 point=ParTool::Value(TheParCurve,parameter);
669 return(TheImpTool.FindParameter(point));
672 Standard_Real IntImpParGen_Intersector::FindV(const Standard_Real parameter
674 ,const ImpTool& TheImpTool
675 ,const ParCurve& TheParCurve
676 ,const IntRes2d_Domain& TheParCurveDomain
677 ,const Standard_Real V0
678 ,const Standard_Real V1
679 ,const Standard_Real Tolerance) const
681 point=TheImpTool.Value(parameter);
682 if(TheParCurveDomain.IsClosed()) {
683 Standard_Real V = ProjectOnPCurveTool::FindParameter(TheParCurve,
686 return(IntImpParGen::NormalizeOnDomain(V,TheParCurveDomain));
689 Standard_Real VV0 = V0;
690 Standard_Real VV1 = V1;
691 if(V1<V0) { VV0 = V1; VV1 = V0; }
692 //-- ??????????????????????????????????????????????????????????????????????
693 //-- Modif le 15 Septembre 1992 : On Teste le parametre retourne
694 //--??????????????????????????????????????????????????????????????????????
695 Standard_Real X = ProjectOnPCurveTool::FindParameter(TheParCurve,
698 if(X>VV1) X=VV1; else if(X<VV0) X=VV0;