1 // Created on: 1992-03-02
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and / or modify it
9 // under the terms of the GNU Lesser General Public version 2.1 as published
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <Standard_ConstructionError.hxx>
18 #include <IntRes2d_Domain.hxx>
19 #include <IntRes2d_IntersectionPoint.hxx>
20 #include <IntRes2d_IntersectionSegment.hxx>
21 #include <IntRes2d_SequenceOfIntersectionPoint.hxx>
22 #include <IntRes2d_SequenceOfIntersectionSegment.hxx>
23 #include <IntRes2d_Transition.hxx>
24 #include <IntRes2d_Position.hxx>
26 #include <IntImpParGen.hxx>
28 #include <math_FunctionSample.hxx>
29 #include <math_FunctionAllRoots.hxx>
31 #include <TColStd_Array1OfReal.hxx>
33 #include <gp_Vec2d.hxx>
35 //======================================================================
37 #define EPSNUL TolConf
38 #define EPSX ParTool::EpsX(TheParCurve)
39 #define NB_ECHANTILLONS
44 //======================================================================
45 void IntImpParGen_Intersector::And_Domaine_Objet1_Intersections(const ImpTool& TheImpTool,
46 const ParCurve& TheParCurve,
47 const IntRes2d_Domain& TheImpCurveDomain,
48 const IntRes2d_Domain& TheParCurveDomain,
49 Standard_Integer& NbResultats,
50 TColStd_Array1OfReal& Inter2_And_Domain2,
51 TColStd_Array1OfReal& Inter1,
52 TColStd_Array1OfReal& Resultat1,
53 TColStd_Array1OfReal& Resultat2,
54 const Standard_Real EpsNul) const {
57 Standard_Integer Nb_Bornes_Intersection=NbResultats;
60 for(Standard_Integer i=1; i<=Nb_Bornes_Intersection; i+=2) {
61 Standard_Real param1=Inter1.Value(i);
62 Standard_Real param2=Inter1.Value(i+1);
64 Standard_Integer indice_1=i;
65 Standard_Integer indice_2=i+1;
68 Standard_Real t=param1; param1=param2; param2=t;
73 gp_Pnt2d Pt1=TheImpTool.Value(param1);
74 gp_Pnt2d Pt2=TheImpTool.Value(param2);
77 Standard_Boolean IsOnTheImpCurveDomain1=Standard_True;
79 Standard_Boolean IsOnTheImpCurveDomain2=Standard_True;
80 //--------------------------------------------------------------------
81 if(TheImpCurveDomain.HasFirstPoint()) {
82 if(param1<TheImpCurveDomain.FirstParameter()) {
83 if(Pt1.Distance(TheImpCurveDomain.FirstPoint())
84 > TheImpCurveDomain.FirstTolerance()) {
85 IsOnTheImpCurveDomain1=Standard_False;
89 if(IsOnTheImpCurveDomain1 && TheImpCurveDomain.HasLastPoint()) {
90 if(param1>TheImpCurveDomain.LastParameter()) {
91 if(Pt1.Distance(TheImpCurveDomain.LastPoint())
92 > TheImpCurveDomain.FirstTolerance()) {
93 IsOnTheImpCurveDomain1=Standard_False;
97 //--------------------------------------------------------------------
98 if(TheImpCurveDomain.HasFirstPoint()) {
99 if(param2<TheImpCurveDomain.FirstParameter()) {
100 if(Pt2.Distance(TheImpCurveDomain.FirstPoint())
101 > TheImpCurveDomain.FirstTolerance()) {
102 IsOnTheImpCurveDomain2=Standard_False;
106 if(IsOnTheImpCurveDomain2 && TheImpCurveDomain.HasLastPoint()) {
107 if(param2>TheImpCurveDomain.LastParameter()) {
108 if(Pt2.Distance(TheImpCurveDomain.LastPoint())
109 > TheImpCurveDomain.FirstTolerance()) {
110 IsOnTheImpCurveDomain2=Standard_False;
115 if(IsOnTheImpCurveDomain1) {
116 //------------------------------------------------------------------
117 //--- la borne 1 est sur le domaine --
119 Resultat1.SetValue(NbResultats,Inter1.Value(indice_1));
120 Resultat2.SetValue(NbResultats,Inter2_And_Domain2.Value(indice_1));
121 //--- la borne2 est aussi sur le domaine ---
122 if(IsOnTheImpCurveDomain2) {
124 Resultat1.SetValue(NbResultats,Inter1.Value(indice_2));
125 Resultat2.SetValue(NbResultats,Inter2_And_Domain2.Value(indice_2));
128 //--- Borne1 sur domaine et Borne 2 Hors Domaine ---
131 t=TheImpCurveDomain.LastParameter();
132 Resultat1.SetValue(NbResultats,t);
133 // Standard_Real popResult = FindV(t,Pt,TheImpTool,TheParCurve,
134 // TheParCurveDomain,
135 // Inter2_And_Domain2.Value(indice_1),
136 // Inter2_And_Domain2.Value(indice_2),
139 // Resultat2.SetValue(NbResultats,popResult);
140 Resultat2.SetValue(NbResultats,
141 IntImpParGen_Intersector::FindV(t,Pt,TheImpTool,TheParCurve,
143 Inter2_And_Domain2.Value(indice_1),
144 Inter2_And_Domain2.Value(indice_2),
148 else { //======= la borne1 n est pas sur le domaine ========
149 if(IsOnTheImpCurveDomain2) {
152 t=TheImpCurveDomain.FirstParameter();
154 Resultat1.SetValue(NbResultats,t);
155 Resultat2.SetValue(NbResultats,
156 IntImpParGen_Intersector::FindV(t,Pt,TheImpTool,TheParCurve,
158 Inter2_And_Domain2.Value(indice_1),
159 Inter2_And_Domain2.Value(indice_2),
163 Resultat1.SetValue(NbResultats,Inter1.Value(indice_2));
164 Resultat2.SetValue(NbResultats,Inter2_And_Domain2.Value(indice_2));
166 else { //====== la borne2 et la borne1 sont hors domaine =====
167 if(param1<TheImpCurveDomain.FirstParameter()
168 && param2>TheImpCurveDomain.LastParameter()) {
171 t=TheImpCurveDomain.FirstParameter();
172 Resultat1.SetValue(NbResultats,t);
173 Resultat2.SetValue(NbResultats,
174 IntImpParGen_Intersector::FindV(t,Pt,TheImpTool,TheParCurve,
176 Inter2_And_Domain2.Value(indice_1),
177 Inter2_And_Domain2.Value(indice_2),
183 t=TheImpCurveDomain.LastParameter();
184 Resultat1.SetValue(NbResultats,t);
185 Resultat2.SetValue(NbResultats,
186 IntImpParGen_Intersector::FindV(t,Pt,TheImpTool,TheParCurve,
188 Inter2_And_Domain2.Value(indice_1),
189 Inter2_And_Domain2.Value(indice_2),
197 //======================================================================
198 //-- C o n s t r u c t e u r s e t P e r f o r m
199 IntImpParGen_Intersector::IntImpParGen_Intersector() {
202 //----------------------------------------------------------------------
204 IntImpParGen_Intersector::IntImpParGen_Intersector(const ImpTool& TheImpTool,
205 const IntRes2d_Domain& TheImpCurveDomain,
206 const ParCurve& TheParCurve,
207 const IntRes2d_Domain& TheParCurveDomain,
208 const Standard_Real TolConf,
209 const Standard_Real Tol) {
210 Perform(TheImpTool,TheImpCurveDomain,TheParCurve,TheParCurveDomain,TolConf,Tol);
212 //----------------------------------------------------------------------
214 void IntImpParGen_Intersector::Perform(const ImpTool& TheImpTool,
215 const IntRes2d_Domain& TheImpCurveDomain,
216 const ParCurve& TheParCurve,
217 const IntRes2d_Domain& TheParCurveDomain,
218 const Standard_Real TolConf,
219 const Standard_Real Tol) {
222 Standard_Integer i,nb_segments_solution, nb_points_solution;
223 Standard_Real param1,param2,EpsX, EpsNul, EpsDist;
225 IntRes2d_Transition Trans1,Trans2;
227 gp_Vec2d Tan1,Tan2,Norm1,Norm2;
228 IntRes2d_Position Pos1,Pos2;
231 //----------------------------------------------
232 //-- On teste apres appel aux maths si les bornes
233 //-- des domaines sont des solutions
235 Standard_Boolean HeadOnImp =Standard_False;
236 Standard_Boolean HeadOnPar =Standard_False;
237 Standard_Boolean EndOnImp =Standard_False;
238 Standard_Boolean EndOnPar =Standard_False;
242 IntImpParGen_MyImpParTool TheImpParTool(TheImpTool,TheParCurve);
244 if (! (TheParCurveDomain.HasFirstPoint() &&
245 TheParCurveDomain.HasLastPoint())) {
246 Standard_ConstructionError::Raise("Domaine sur courbe incorrect");
249 Standard_Integer nb_echantillons = ParTool::NbSamples(TheParCurve,
250 TheParCurveDomain.FirstParameter(),
251 TheParCurveDomain.LastParameter());
254 if(EpsX>1.0e-10) EpsX = 1.0e-10;
255 EpsNul=(TolConf<=1.0e-10)? 1.0e-10: TolConf;
256 EpsDist=(Tol<=1.0e-10)? 1.0e-10: Tol;
258 Standard_Real Tolerance_Angulaire=EpsDist;
262 if((TheParCurveDomain.LastParameter() - TheParCurveDomain.FirstParameter()) < 100.0*EpsX) {
263 EpsX = (TheParCurveDomain.LastParameter() - TheParCurveDomain.FirstParameter())*0.01;
266 math_FunctionSample Sample2(TheParCurveDomain.FirstParameter(),
267 TheParCurveDomain.LastParameter(),
270 math_FunctionAllRoots Sol(TheImpParTool,
276 if(!Sol.IsDone()) {done = Standard_False; return; }
278 nb_segments_solution=Sol.NbIntervals();
279 nb_points_solution=Sol.NbPoints();
281 //--------------------------------------------------------------------
282 //-- 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
283 for(i=1; i<=nb_points_solution; i++) {
285 param2=Sol.GetPoint(i);
286 param1=FindU(param2,Pt,TheParCurve,TheImpTool);
288 if(TheImpCurveDomain.IsClosed()) {
289 param1 = IntImpParGen::NormalizeOnDomain( param1
293 Standard_Boolean IsOnTheImpCurveDomain=Standard_True;
294 if(TheImpCurveDomain.HasFirstPoint()) {
295 if(param1<TheImpCurveDomain.FirstParameter()) {
296 if(Pt.Distance(TheImpCurveDomain.FirstPoint())
297 > TheImpCurveDomain.FirstTolerance()) {
298 IsOnTheImpCurveDomain=Standard_False;
302 if(IsOnTheImpCurveDomain && TheImpCurveDomain.HasLastPoint()) {
303 if(param1>TheImpCurveDomain.LastParameter()) {
304 if(Pt.Distance(TheImpCurveDomain.LastPoint())
305 > TheImpCurveDomain.FirstTolerance()) {
306 IsOnTheImpCurveDomain=Standard_False;
311 if(IsOnTheImpCurveDomain) {
312 TheImpTool.D2(param1,pt1,Tan1,Norm1);
313 ParTool::D2(TheParCurve,param2,pt2,Tan2,Norm2);
315 IntImpParGen::DeterminePosition(Pos1,TheImpCurveDomain,pt1,param1);
316 IntImpParGen::DeterminePosition(Pos2,TheParCurveDomain,pt2,param2);
318 if(Pos1==IntRes2d_End) EndOnImp = Standard_True;
319 else if(Pos1==IntRes2d_Head) HeadOnImp = Standard_True;
320 if(Pos2==IntRes2d_End) EndOnPar = Standard_True;
321 else if(Pos2==IntRes2d_Head) HeadOnPar = Standard_True;
323 IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
324 Pos2,Tan2,Norm2,Trans2,
325 Tolerance_Angulaire);
327 IntRes2d_IntersectionPoint IP(pt1,param1,param2
329 ,ReversedParameters());
333 //-- F i n d u T r a i t e m e n t d e s P t s S o l.
336 //--------------------------------------------------------------------
337 //-- T r a i t e m e n t D e s S e g m e n t s ---
338 //--------------------------------------------------------------------
339 //-- On a N segments solution sur le domaine de V soit au pire :
340 //-- --> N segments solution sur le domaine de U
341 //-- -->2N segments si la courbe en U est fermee
344 TColStd_Array1OfReal Inter2_and_Domaine2(1,2+8*nb_segments_solution);
345 TColStd_Array1OfReal Inter1(1,2+8*nb_segments_solution);
347 Standard_Integer nb_segments_crees=0;
349 for (Standard_Integer j2=1,j=1;j<=nb_segments_solution;j++,j2+=2) {
350 Standard_Real param2_inf,param2_sup;
351 Standard_Real param1_inf,param1_sup;
354 Sol.GetInterval(j,param2_inf,param2_sup);
355 param1_inf=FindU(param2_inf,Ptemp,TheParCurve,TheImpTool);
356 param1_sup=FindU(param2_sup,Ptemp,TheParCurve,TheImpTool);
358 //----------------------------------------------------------------------
359 //-- C o u r b e I m p l i c i t e F e r m e e
361 if(TheImpCurveDomain.IsClosed()) {
364 gp_Vec2d T1,T2,N1,N2;
365 Standard_Real param1_origine,param1_fin;
367 TheImpCurveDomain.EquivalentParameters(param1_origine,param1_fin);
368 Standard_Real Periode=param1_fin-param1_origine;
370 while(param1_inf<param1_origine) { param1_inf+=Periode; }
371 while(param1_sup<param1_origine) { param1_sup+=Periode; }
373 ParTool::D2(TheParCurve,param2_inf,Ptemp,T2,N2);
374 TheImpTool.D2(param1_inf,Ptemp,T1,N1);
375 if(T1.Magnitude()<=gp::Resolution()) T1=N1;
376 if(T2.Magnitude()<=gp::Resolution()) T2=N2;
378 if(T1.Dot(T2) >=0.0) {
379 //--- param1_inf designe un point entrant (et T1 est vers la matiere)
380 if(param1_inf>=param1_sup) { param1_sup+=Periode; }
382 else { //--- param1_inf : point sortant (et T1 est Hors matiere)
383 if(param1_inf<=param1_sup) { param1_inf+=Periode; }
385 //--- On cree un nouveau segment decale de Periode
386 //-- Exemple de Pb : Domaine PI/4 PI/2 et intervalle 0,PI
387 //-- Domaine 1.5PI 2.5PI et intervalle 0,PI
389 //-- ------|--------------------|-----------------|-----------
390 //-- [----------------------------] Domaine
391 //-- [~~~~~~~~~~~~~~~~~] Inters.
393 //-- On cree un nouvel intervalle
395 //-- [a~~~~~~~~~~~~b] [a~~~~~~~~~~~~~~~b] et [a~~~]
399 if(TheImpCurveDomain.LastParameter()
400 > ((param1_inf>param1_sup)? (param1_sup+Periode):
401 (param1_inf+Periode))) {
402 Inter2_and_Domaine2.SetValue(j2,param2_inf);
403 Inter1.SetValue(j2,param1_inf+Periode);
405 Inter2_and_Domaine2.SetValue(j2+1,param2_sup);
406 Inter1.SetValue(j2+1,param1_sup+Periode);
411 if(TheImpCurveDomain.FirstParameter()
412 <((param1_inf<param1_sup)? (param1_sup-Periode): (param1_inf-Periode))) {
413 Inter2_and_Domaine2.SetValue(j2,param2_inf);
414 Inter1.SetValue(j2,param1_inf-Periode);
416 Inter2_and_Domaine2.SetValue(j2+1,param2_sup);
417 Inter1.SetValue(j2+1,param1_sup-Periode);
422 //-- F i n C o u r b e I m p l i c i t e F e r m e e
423 //----------------------------------------------------------------------
426 Inter2_and_Domaine2.SetValue(j2,param2_inf);
427 Inter1.SetValue(j2,param1_inf);
429 Inter2_and_Domaine2.SetValue(j2+1,param2_sup);
430 Inter1.SetValue(j2+1,param1_sup);
433 //------------------------------------------------------------------
434 //-- INTER2_DOMAINE2 : Intersection AND CurveDomain : Function of PARAM2
435 //-- INTER1 : Intersection AND CurveDomain : Function of PARAM1
436 //------------------------------------------------------------------
438 TColStd_Array1OfReal Resultat1(1,2+(1+nb_segments_solution)*2);
439 TColStd_Array1OfReal Resultat2(1,2+(1+nb_segments_solution)*2);
440 nb_segments_solution+=nb_segments_crees;
441 Standard_Integer NbResultats=nb_segments_solution*2;
443 And_Domaine_Objet1_Intersections(TheImpTool,
448 Inter2_and_Domaine2,Inter1,
449 Resultat1,Resultat2,EpsNul);
451 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
452 //Calcule_Toutes_Transitions(NbResultats,
453 // Resultat1,Resultat2,
455 // TheImpCurveDomain,
457 // TheParCurveDomain);
458 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
459 //~~~ Fonction Calcule_Toutes_Transitions Repportee ici pour cause ~~~~~
460 //~~~~~ D acces aux methodes Protected APPEND
461 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
463 IntRes2d_Position Pos1,Pos2;
464 IntRes2d_Transition Trans1,Trans2;
465 gp_Vec2d Tan1,Tan2,Norm1,Norm2;
466 gp_Pnt2d Pt1_on1,Pt2_on1,Pt1_on2,Pt2_on2;
467 Standard_Real Param1_on1,Param2_on1,Param1_on2,Param2_on2;
469 Standard_Real Dist_Mini_ImpCurve=EPSNUL;
470 Standard_Real Tolerance_Angulaire=Dist_Mini_ImpCurve;
473 for(Standard_Integer i=1; i<=NbResultats ; i+=2) {
474 Standard_Integer ip1=i+1;
475 Standard_Boolean OnlyOnePoint=Standard_False;
477 Param1_on1=Resultat1.Value(i);
478 Param1_on2=Resultat2.Value(i);
479 Param2_on1=Resultat1.Value(ip1);
480 Param2_on2=Resultat2.Value(ip1);
482 Pt1_on1=TheImpTool.Value(Param1_on1);
483 Pt2_on1=TheImpTool.Value(Param2_on1);
484 Pt1_on2=ParTool::Value(TheParCurve,Param1_on2);
485 Pt2_on2=ParTool::Value(TheParCurve,Param2_on2);
487 if(!TheImpCurveDomain.IsClosed()) {
488 if( Pt1_on1.Distance(Pt2_on1) <= Dist_Mini_ImpCurve ) {
489 if( Pt1_on2.Distance(Pt2_on2) <= Dist_Mini_ImpCurve ) {
490 OnlyOnePoint=Standard_True;
495 Param1_on1=IntImpParGen::NormalizeOnDomain(Param1_on1,TheImpCurveDomain);
496 Param1_on2=IntImpParGen::NormalizeOnDomain(Param1_on2,TheParCurveDomain);
498 TheImpTool.D2(Param1_on1,Pt1_on1,Tan1,Norm1);
499 ParTool::D2(TheParCurve,Param1_on2,Pt1_on2,Tan2,Norm2);
501 IntImpParGen::DeterminePosition(Pos1,TheImpCurveDomain,Pt1_on1,Param1_on1);
502 IntImpParGen::DeterminePosition(Pos2,TheParCurveDomain,Pt1_on2,Param1_on2);
504 if(Pos1==IntRes2d_End) EndOnImp = Standard_True;
505 else if(Pos1==IntRes2d_Head) HeadOnImp = Standard_True;
506 if(Pos2==IntRes2d_End) EndOnPar = Standard_True;
507 else if(Pos2==IntRes2d_Head) HeadOnPar = Standard_True;
510 IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
511 Pos2,Tan2,Norm2,Trans2,
512 Tolerance_Angulaire);
514 //============== Detection du cas : L intersection est en bout
515 //============== sur les 2 domaines
517 if(Pos1!=IntRes2d_Middle && Pos2!=IntRes2d_Middle) {
518 Standard_Real m=0.5*(Pt1_on1.X() + Pt1_on2.X());
520 m=0.5*(Pt1_on1.Y() + Pt1_on2.Y());
524 IntRes2d_IntersectionPoint new_p1(Pt1_on1
525 ,Param1_on1,Param1_on2
527 ,ReversedParameters());
529 IntRes2d_IntersectionPoint new_p2;
531 Param2_on1=IntImpParGen::NormalizeOnDomain(Param2_on1,TheImpCurveDomain);
532 Param2_on2=IntImpParGen::NormalizeOnDomain(Param2_on2,TheParCurveDomain);
534 TheImpTool.D2(Param2_on1,Pt2_on1,Tan1,Norm1);
535 ParTool::D2(TheParCurve,Param2_on2,Pt2_on2,Tan2,Norm2);
537 IntImpParGen::DeterminePosition(Pos1,TheImpCurveDomain,Pt2_on1,Param2_on1);
538 IntImpParGen::DeterminePosition(Pos2,TheParCurveDomain,Pt2_on2,Param2_on2);
540 if(Pos1==IntRes2d_End) EndOnImp = Standard_True;
541 else if(Pos1==IntRes2d_Head) HeadOnImp = Standard_True;
542 if(Pos2==IntRes2d_End) EndOnPar = Standard_True;
543 else if(Pos2==IntRes2d_Head) HeadOnPar = Standard_True;
545 IntImpParGen::DetermineTransition(Pos1,Tan1,Norm1,Trans1,
546 Pos2,Tan2,Norm2,Trans2,
547 Tolerance_Angulaire);
550 //============== Detection du cas : L intersection est en bout
551 //============== sur les 2 domaines
553 if(Pos1!=IntRes2d_Middle && Pos2!=IntRes2d_Middle) {
554 Standard_Real m=0.5*(Pt2_on1.X() + Pt2_on2.X() );
556 m=0.5*(Pt2_on1.Y() + Pt2_on2.Y());
560 new_p2.SetValues(Pt2_on1,Param2_on1,Param2_on2
562 ,ReversedParameters());
564 Standard_Boolean segopposite=((Tan1.Dot(Tan2) < 0.0)?
565 Standard_True : Standard_False);
567 IntRes2d_IntersectionSegment new_seg(new_p1,new_p2
569 ,ReversedParameters());
576 } //~~~~~~~~~~~~ Fin du corps de la fonction Calc...Transitions~~~~~~~~~~
578 //-------------------------------------------
579 //-- On teste les points en bouts solutions
581 if(!HeadOnImp && TheImpCurveDomain.HasFirstPoint()) {
583 if(TheImpCurveDomain.FirstPoint().Distance(TheParCurveDomain.FirstPoint())
584 <= Max(TheImpCurveDomain.FirstTolerance(),TheParCurveDomain.FirstTolerance())) {
585 param1 = TheImpCurveDomain.FirstParameter();
586 param2 = TheParCurveDomain.FirstParameter();
587 TheImpTool.D2(param1,pt1,Tan1,Norm1);
588 ParTool::D2(TheParCurve,param2,pt2,Tan2,Norm2);
589 IntImpParGen::DetermineTransition(IntRes2d_Head,Tan1,Norm1,Trans1,
590 IntRes2d_Head,Tan2,Norm2,Trans2,
591 Tolerance_Angulaire);
592 IntRes2d_IntersectionPoint IP(TheImpCurveDomain.FirstPoint(),
595 ReversedParameters());
600 if(TheImpCurveDomain.FirstPoint().Distance(TheParCurveDomain.LastPoint())
601 <= Max(TheImpCurveDomain.FirstTolerance(),TheParCurveDomain.LastTolerance())) {
602 param1 = TheImpCurveDomain.FirstParameter();
603 param2 = TheParCurveDomain.LastParameter();
604 TheImpTool.D2(param1,pt1,Tan1,Norm1);
605 ParTool::D2(TheParCurve,param2,pt2,Tan2,Norm2);
606 IntImpParGen::DetermineTransition(IntRes2d_Head,Tan1,Norm1,Trans1,
607 IntRes2d_End ,Tan2,Norm2,Trans2,
608 Tolerance_Angulaire);
609 IntRes2d_IntersectionPoint IP(TheImpCurveDomain.FirstPoint(),
612 ReversedParameters());
618 if(!EndOnImp && TheImpCurveDomain.HasLastPoint()) {
620 if(TheImpCurveDomain.LastPoint().Distance(TheParCurveDomain.FirstPoint())
621 <= Max(TheImpCurveDomain.LastTolerance(),TheParCurveDomain.FirstTolerance())) {
622 param1 = TheImpCurveDomain.LastParameter();
623 param2 = TheParCurveDomain.FirstParameter();
624 TheImpTool.D2(param1,pt1,Tan1,Norm1);
625 ParTool::D2(TheParCurve,param2,pt2,Tan2,Norm2);
626 IntImpParGen::DetermineTransition(IntRes2d_End,Tan1,Norm1,Trans1,
627 IntRes2d_Head,Tan2,Norm2,Trans2,
628 Tolerance_Angulaire);
629 IntRes2d_IntersectionPoint IP(TheImpCurveDomain.LastPoint(),
632 ReversedParameters());
637 if(TheImpCurveDomain.LastPoint().Distance(TheParCurveDomain.LastPoint())
638 <= Max(TheImpCurveDomain.LastTolerance(),TheParCurveDomain.LastTolerance())) {
639 param1 = TheImpCurveDomain.LastParameter();
640 param2 = TheParCurveDomain.LastParameter();
641 TheImpTool.D2(param1,pt1,Tan1,Norm1);
642 ParTool::D2(TheParCurve,param2,pt2,Tan2,Norm2);
643 IntImpParGen::DetermineTransition(IntRes2d_End,Tan1,Norm1,Trans1,
644 IntRes2d_End,Tan2,Norm2,Trans2,
645 Tolerance_Angulaire);
646 IntRes2d_IntersectionPoint IP(TheImpCurveDomain.LastPoint(),
649 ReversedParameters());
662 Standard_Real IntImpParGen_Intersector::FindU(const Standard_Real parameter
664 ,const ParCurve& TheParCurve
665 ,const ImpTool& TheImpTool) const
667 point=ParTool::Value(TheParCurve,parameter);
668 return(TheImpTool.FindParameter(point));
671 Standard_Real IntImpParGen_Intersector::FindV(const Standard_Real parameter
673 ,const ImpTool& TheImpTool
674 ,const ParCurve& TheParCurve
675 ,const IntRes2d_Domain& TheParCurveDomain
676 ,const Standard_Real V0
677 ,const Standard_Real V1
678 ,const Standard_Real Tolerance) const
680 point=TheImpTool.Value(parameter);
681 if(TheParCurveDomain.IsClosed()) {
682 Standard_Real V = ProjectOnPCurveTool::FindParameter(TheParCurve,
685 return(IntImpParGen::NormalizeOnDomain(V,TheParCurveDomain));
688 Standard_Real VV0 = V0;
689 Standard_Real VV1 = V1;
690 if(V1<V0) { VV0 = V1; VV1 = V0; }
691 //-- ??????????????????????????????????????????????????????????????????????
692 //-- Modif le 15 Septembre 1992 : On Teste le parametre retourne
693 //--??????????????????????????????????????????????????????????????????????
694 Standard_Real X = ProjectOnPCurveTool::FindParameter(TheParCurve,
697 if(X>VV1) X=VV1; else if(X<VV0) X=VV0;