Warning, /include/opencascade/IntCurve_IntCurveCurveGen.gxx is written in an unsupported language. File is not indexed.
0001 // Created on: 1992-10-12
0002 // Created by: Laurent BUCHARD
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016
0017 #include <GeomAbs_CurveType.hxx>
0018
0019
0020 #include <IntCurve_IntConicConic.hxx>
0021 #include <gp_Lin2d.hxx>
0022 #include <gp_Circ2d.hxx>
0023 #include <gp_Elips2d.hxx>
0024 #include <gp_Parab2d.hxx>
0025 #include <gp_Hypr2d.hxx>
0026 #include <Precision.hxx>
0027
0028 #include <TColStd_Array1OfReal.hxx>
0029
0030
0031 void IntCurve_IntCurveCurveGen::Perform(const TheCurve& C,
0032 const Standard_Real TolConf,
0033 const Standard_Real Tol) {
0034 IntRes2d_Domain D1;
0035 Standard_Real TolDomain = Tol;
0036 if(Tol<TolConf) TolDomain = TolConf;
0037 GeomAbs_CurveType typ = TheCurveTool::GetType(C);
0038 switch(typ) {
0039 case GeomAbs_Ellipse:
0040 case GeomAbs_Circle:
0041 case GeomAbs_Parabola:
0042 case GeomAbs_Hyperbola:
0043 case GeomAbs_Line:
0044 ResetFields();
0045 done = Standard_True;
0046 return;
0047
0048 default:
0049 {
0050 Standard_Real paraminf = TheCurveTool::FirstParameter(C);
0051 Standard_Real paramsup = TheCurveTool::LastParameter(C);
0052 if (Precision::IsInfinite(paraminf) && Precision::IsInfinite(paramsup)) {
0053 done = Standard_False;
0054 return;
0055 }
0056 //
0057 if(paraminf>-Precision::Infinite()) {
0058 if(paramsup<Precision::Infinite()) {
0059 //-- paraminf-----------paramsup
0060 D1.SetValues(TheCurveTool::Value(C,paraminf),
0061 paraminf,
0062 TolDomain,
0063 TheCurveTool::Value(C,paramsup),
0064 paramsup,
0065 TolDomain);
0066 }
0067 else {
0068 //-- paraminf------------...
0069 D1.SetValues(TheCurveTool::Value(C,paraminf),
0070 paraminf,
0071 TolDomain,
0072 Standard_True);
0073 }
0074 }
0075 else {
0076 if(paramsup<Precision::Infinite()) {
0077 //-- ...-----------------paramsup
0078 D1.SetValues(TheCurveTool::Value(C,paramsup),
0079 paramsup,
0080 TolDomain,
0081 Standard_False);
0082 }
0083 }
0084 this->ResetFields();
0085 intcurvcurv.SetReversedParameters(Standard_False);
0086 intcurvcurv.Perform(C,D1,TolConf,Tol);
0087 this->SetValues(intcurvcurv);
0088 done = Standard_True;
0089 }
0090 }
0091 }
0092
0093
0094 void IntCurve_IntCurveCurveGen::Perform(const TheCurve& C,
0095 const IntRes2d_Domain& D,
0096 const Standard_Real TolConf,
0097 const Standard_Real Tol) {
0098 GeomAbs_CurveType typ = TheCurveTool::GetType(C);
0099 switch(typ) {
0100 case GeomAbs_Ellipse:
0101 case GeomAbs_Circle:
0102 case GeomAbs_Parabola:
0103 case GeomAbs_Hyperbola:
0104 case GeomAbs_Line:
0105 ResetFields();
0106 done = Standard_True;
0107 return;
0108
0109 default:
0110 {
0111 this->ResetFields();
0112 intcurvcurv.SetReversedParameters(Standard_False);
0113 intcurvcurv.Perform(C,D,TolConf,Tol);
0114 this->SetValues(intcurvcurv);
0115 done = Standard_True;
0116 }
0117 }
0118 }
0119
0120
0121
0122
0123 //----------------------------------------------------------------------
0124 IntRes2d_Domain IntCurve_IntCurveCurveGen::ComputeDomain(const TheCurve& C1,
0125 const Standard_Real TolDomain) const {
0126 IntRes2d_Domain D1;
0127
0128 GeomAbs_CurveType typ = TheCurveTool::GetType(C1);
0129 switch(typ) {
0130
0131 case GeomAbs_Ellipse:
0132 case GeomAbs_Circle: {
0133 //---------------------------------------------------------------
0134 //-- if the curve is a trimmed curve, first and last parameters
0135 //-- will be the parameters used to build the domain
0136 //--
0137 Standard_Real firstparameter = TheCurveTool::FirstParameter(C1);
0138 Standard_Real lastparameter = TheCurveTool::LastParameter(C1);
0139
0140 gp_Pnt2d P1(TheCurveTool::Value(C1,firstparameter));
0141 gp_Pnt2d P2(TheCurveTool::Value(C1,lastparameter));
0142 D1.SetValues(P1,firstparameter ,TolDomain,
0143 P2,lastparameter ,TolDomain);
0144 D1.SetEquivalentParameters(firstparameter,firstparameter+M_PI+M_PI);
0145 break;
0146 }
0147 default: {
0148 Standard_Real paraminf = TheCurveTool::FirstParameter(C1);
0149 Standard_Real paramsup = TheCurveTool::LastParameter(C1);
0150 if(paraminf>-Precision::Infinite()) {
0151 if(paramsup<Precision::Infinite()) {
0152 //-- paraminf-----------paramsup
0153 D1.SetValues(TheCurveTool::Value(C1,paraminf),
0154 paraminf,
0155 TolDomain,
0156 TheCurveTool::Value(C1,paramsup),
0157 paramsup,
0158 TolDomain);
0159 }
0160 else {
0161 //-- paraminf------------...
0162 D1.SetValues(TheCurveTool::Value(C1,paraminf),
0163 paraminf,
0164 TolDomain,
0165 Standard_True);
0166 }
0167 }
0168 else {
0169 if(paramsup<Precision::Infinite()) {
0170 //-- ...-----------------paramsup
0171 D1.SetValues(TheCurveTool::Value(C1,paramsup),
0172 paramsup,
0173 TolDomain,
0174 Standard_False);
0175 }
0176 }
0177 break;
0178 }
0179 }
0180 return(D1);
0181 }
0182 //----------------------------------------------------------------------
0183 //-- Perform : Si Une des courbes est Composite Alors decompose les appels
0184 //----------------------------------------------------------------------
0185 void IntCurve_IntCurveCurveGen::Perform (const TheCurve& C1,
0186 const IntRes2d_Domain& D1,
0187 const TheCurve& C2,
0188 const IntRes2d_Domain& D2,
0189 const Standard_Real TolConf,
0190 const Standard_Real Tol) {
0191 this->ResetFields();
0192 Standard_Integer nbi1 = TheCurveTool::NbIntervals(C1);
0193 if(nbi1 > 1) {
0194 param1inf = TheCurveTool::FirstParameter(C1);
0195 param1sup = TheCurveTool::LastParameter(C1);
0196 }
0197 else {
0198 param1inf = (D1.HasFirstPoint())? (D1.FirstParameter()) : -Precision::Infinite();
0199 param1sup = (D1.HasLastPoint()) ? (D1.LastParameter()) : Precision::Infinite();
0200 }
0201 Standard_Integer nbi2 = TheCurveTool::NbIntervals(C2);
0202 if(nbi2 > 1) {
0203 param2inf = TheCurveTool::FirstParameter(C2);
0204 param2sup = TheCurveTool::LastParameter(C2);
0205 }
0206 else {
0207 param2inf = (D2.HasFirstPoint())? (D2.FirstParameter()) : -Precision::Infinite();
0208 param2sup = (D2.HasLastPoint()) ? (D2.LastParameter()) : Precision::Infinite();
0209 }
0210 if(nbi1>1 || nbi2>1) {
0211 TColStd_Array1OfReal Tab1(1,nbi1+1);
0212 TColStd_Array1OfReal Tab2(1,nbi2+1);
0213 TheCurveTool::Intervals(C1,Tab1);
0214 TheCurveTool::Intervals(C2,Tab2);
0215 InternalCompositePerform(C1,D1,1,nbi1,Tab1,
0216 C2,D2,1,nbi2,Tab2,
0217 TolConf,Tol,Standard_True);
0218 return;
0219 }
0220 else {
0221 InternalPerform(C1,D1,C2,D2,TolConf,Tol,Standard_False);
0222 }
0223 }
0224
0225 //----------------------------------------------------------------------
0226 //-- InternalPerform
0227 //-- Suppose des Courbes Lin...Other
0228 //-- Si Composite == True
0229 //-- Les Resultats sont Ajoutes
0230 //-- Sinon
0231 //-- Les Resultats sont Copies
0232 //----------------------------------------------------------------------
0233 void IntCurve_IntCurveCurveGen::InternalPerform (const TheCurve& C1,
0234 const IntRes2d_Domain& D1,
0235 const TheCurve& C2,
0236 const IntRes2d_Domain& D2,
0237 const Standard_Real TolConf,
0238 const Standard_Real Tol,
0239 const Standard_Boolean Composite)
0240 {
0241
0242 GeomAbs_CurveType typ1 = TheCurveTool::GetType(C1);
0243 GeomAbs_CurveType typ2 = TheCurveTool::GetType(C2);
0244
0245
0246 switch (typ1)
0247 {
0248 case GeomAbs_Line:
0249 switch (typ2)
0250 {
0251 case GeomAbs_Line:
0252 {
0253 intconiconi.SetReversedParameters(Standard_False);
0254 intconiconi.Perform(TheCurveTool::Line(C1),D1,
0255 TheCurveTool::Line(C2),D2,TolConf,Tol);
0256 if(Composite)
0257 {
0258 this->Append(intconiconi,
0259 param1inf,
0260 param1sup,
0261 param2inf,
0262 param2sup);
0263 }
0264 else
0265 {
0266 this->SetValues(intconiconi);
0267 }
0268 }
0269 break;
0270
0271 case GeomAbs_Circle:
0272 {
0273 intconiconi.SetReversedParameters(Standard_False);
0274 intconiconi.Perform(TheCurveTool::Line(C1),D1,
0275 TheCurveTool::Circle(C2),D2,TolConf,Tol);
0276 if(Composite)
0277 {
0278 this->Append(intconiconi,
0279 param1inf,
0280 param1sup,
0281 param2inf,
0282 param2sup);
0283 }
0284 else
0285 {
0286 this->SetValues(intconiconi);
0287 }
0288 }
0289 break;
0290
0291 case GeomAbs_Ellipse:
0292 {
0293 intconiconi.SetReversedParameters(Standard_False);
0294 intconiconi.Perform(TheCurveTool::Line(C1),D1,
0295 TheCurveTool::Ellipse(C2),D2,TolConf,Tol);
0296 if(Composite)
0297 {
0298 this->Append(intconiconi,
0299 param1inf,
0300 param1sup,
0301 param2inf,
0302 param2sup);
0303 }
0304 else
0305 {
0306 this->SetValues(intconiconi);
0307 }
0308 }
0309 break;
0310
0311 case GeomAbs_Parabola:
0312 {
0313 intconiconi.SetReversedParameters(Standard_False);
0314 intconiconi.Perform(TheCurveTool::Line(C1),D1,
0315 TheCurveTool::Parabola(C2),D2,TolConf,Tol);
0316 if(Composite)
0317 {
0318 this->Append(intconiconi,
0319 param1inf,
0320 param1sup,
0321 param2inf,
0322 param2sup);
0323 }
0324 else
0325 {
0326 this->SetValues(intconiconi);
0327 }
0328 }
0329 break;
0330
0331 case GeomAbs_Hyperbola:
0332 {
0333 intconiconi.SetReversedParameters(Standard_False);
0334 intconiconi.Perform(TheCurveTool::Line(C1),D1,
0335 TheCurveTool::Hyperbola(C2),D2,TolConf,Tol);
0336 if(Composite)
0337 {
0338 this->Append(intconiconi,
0339 param1inf,
0340 param1sup,
0341 param2inf,
0342 param2sup);
0343 }
0344 else
0345 {
0346 this->SetValues(intconiconi);
0347 }
0348 }
0349
0350 break;
0351
0352 default:
0353 {
0354 intconicurv.SetReversedParameters(Standard_False);
0355 intconicurv.Perform(TheCurveTool::Line(C1),D1,
0356 C2,D2,TolConf,Tol);
0357 if(Composite)
0358 {
0359 this->Append(intconicurv,
0360 param1inf,
0361 param1sup,
0362 param2inf,
0363 param2sup);
0364 }
0365 else
0366 {
0367 this->SetValues(intconicurv);
0368 }
0369 }
0370 break;
0371 }
0372 break;
0373
0374 case GeomAbs_Circle:
0375 switch (typ2)
0376 {
0377 case GeomAbs_Line:
0378 {
0379 intconiconi.SetReversedParameters(Standard_True);
0380 intconiconi.Perform(TheCurveTool::Line(C2),D2,
0381 TheCurveTool::Circle(C1),D1,TolConf,Tol);
0382 if(Composite)
0383 {
0384 this->Append(intconiconi,
0385 param1inf,
0386 param1sup,
0387 param2inf,
0388 param2sup);
0389 }
0390 else
0391 {
0392 this->SetValues(intconiconi);
0393 }
0394 }
0395 break;
0396
0397 case GeomAbs_Circle:
0398 {
0399 intconiconi.SetReversedParameters(Standard_False);
0400 intconiconi.Perform(TheCurveTool::Circle(C1),D1,
0401 TheCurveTool::Circle(C2),D2,TolConf,Tol);
0402 if(Composite)
0403 {
0404 this->Append(intconiconi,
0405 param1inf,
0406 param1sup,
0407 param2inf,
0408 param2sup);
0409 }
0410 else
0411 {
0412 this->SetValues(intconiconi);
0413 }
0414 }
0415 break;
0416
0417 case GeomAbs_Ellipse:
0418 {
0419 intconiconi.SetReversedParameters(Standard_False);
0420 intconiconi.Perform(TheCurveTool::Circle(C1),D1,
0421 TheCurveTool::Ellipse(C2),D2,TolConf,Tol);
0422 if(Composite)
0423 {
0424 this->Append(intconiconi,
0425 param1inf,
0426 param1sup,
0427 param2inf,
0428 param2sup);
0429 }
0430 else
0431 {
0432 this->SetValues(intconiconi);
0433 }
0434 }
0435 break;
0436
0437 case GeomAbs_Parabola:
0438 {
0439 intconiconi.SetReversedParameters(Standard_False);
0440 intconiconi.Perform(TheCurveTool::Circle(C1),D1,
0441 TheCurveTool::Parabola(C2),D2,TolConf,Tol);
0442 if(Composite)
0443 {
0444 this->Append(intconiconi,
0445 param1inf,
0446 param1sup,
0447 param2inf,
0448 param2sup);
0449 }
0450 else
0451 {
0452 this->SetValues(intconiconi);
0453 }
0454 }
0455 break;
0456
0457 case GeomAbs_Hyperbola:
0458 {
0459 intconiconi.SetReversedParameters(Standard_False);
0460 intconiconi.Perform(TheCurveTool::Circle(C1),D1,
0461 TheCurveTool::Hyperbola(C2),D2,TolConf,Tol);
0462 if(Composite)
0463 {
0464 this->Append(intconiconi,
0465 param1inf,
0466 param1sup,
0467 param2inf,
0468 param2sup);
0469 }
0470 else
0471 {
0472 this->SetValues(intconiconi);
0473 }
0474 }
0475 break;
0476
0477 default:
0478 {
0479 intconicurv.SetReversedParameters(Standard_False);
0480 intconicurv.Perform(TheCurveTool::Circle(C1),D1,
0481 C2,D2,TolConf,Tol);
0482 if(Composite)
0483 {
0484 this->Append(intconicurv,
0485 param1inf,
0486 param1sup,
0487 param2inf,
0488 param2sup); }
0489 else
0490 {
0491 this->SetValues(intconicurv);
0492 }
0493 }
0494
0495 break;
0496 }
0497 break;
0498
0499 case GeomAbs_Ellipse:
0500 switch (typ2)
0501 {
0502 case GeomAbs_Line:
0503 {
0504 intconiconi.SetReversedParameters(Standard_True);
0505 intconiconi.Perform(TheCurveTool::Line(C2),D2,
0506 TheCurveTool::Ellipse(C1),D1,
0507 TolConf,Tol);
0508
0509 if(Composite)
0510 {
0511 this->Append(intconiconi,
0512 param1inf,
0513 param1sup,
0514 param2inf,
0515 param2sup);
0516 }
0517 else
0518 {
0519 this->SetValues(intconiconi);
0520 }
0521 }
0522 break;
0523
0524 case GeomAbs_Circle:
0525 {
0526 intconiconi.SetReversedParameters(Standard_True);
0527
0528 intconiconi.Perform(TheCurveTool::Circle(C2),D2,
0529 TheCurveTool::Ellipse(C1),D1,TolConf,Tol);
0530 if(Composite)
0531 {
0532 this->Append(intconiconi,
0533 param1inf,
0534 param1sup,
0535 param2inf,
0536 param2sup);
0537 }
0538 else
0539 {
0540 this->SetValues(intconiconi);
0541 }
0542 }
0543 break;
0544
0545 case GeomAbs_Ellipse:
0546 {
0547 intconiconi.SetReversedParameters(Standard_False);
0548 intconiconi.Perform(TheCurveTool::Ellipse(C1),D1,
0549 TheCurveTool::Ellipse(C2),D2,TolConf,Tol);
0550 if(Composite)
0551 {
0552 this->Append(intconiconi,
0553 param1inf,
0554 param1sup,
0555 param2inf,
0556 param2sup);
0557 }
0558 else
0559 {
0560 this->SetValues(intconiconi);
0561 }
0562 }
0563 break;
0564
0565 case GeomAbs_Parabola:
0566 {
0567 intconiconi.SetReversedParameters(Standard_False);
0568 intconiconi.Perform(TheCurveTool::Ellipse(C1),D1,
0569 TheCurveTool::Parabola(C2),D2,TolConf,Tol);
0570 if(Composite)
0571 {
0572 this->Append(intconiconi,
0573 param1inf,
0574 param1sup,
0575 param2inf,
0576 param2sup);
0577 }
0578 else
0579 {
0580 this->SetValues(intconiconi);
0581 }
0582 }
0583 break;
0584
0585 case GeomAbs_Hyperbola:
0586 {
0587 intconiconi.SetReversedParameters(Standard_False);
0588 intconiconi.Perform(TheCurveTool::Ellipse(C1),D1,
0589 TheCurveTool::Hyperbola(C2),D2,
0590 TolConf,Tol);
0591 if(Composite)
0592 {
0593 this->Append(intconiconi,
0594 param1inf,
0595 param1sup,
0596 param2inf,
0597 param2sup);
0598 }
0599 else
0600 {
0601 this->SetValues(intconiconi);
0602 }
0603 }
0604 break;
0605
0606 default:
0607 {
0608 intconicurv.SetReversedParameters(Standard_False);
0609 intconicurv.Perform(TheCurveTool::Ellipse(C1),D1,
0610 C2,D2,TolConf,Tol);
0611 if(Composite)
0612 {
0613 this->Append(intconicurv,
0614 param1inf,
0615 param1sup,
0616 param2inf,
0617 param2sup);
0618 }
0619 else
0620 {
0621 this->SetValues(intconicurv);
0622 }
0623 }
0624 break;
0625 }
0626 break;
0627
0628 case GeomAbs_Parabola:
0629 switch (typ2)
0630 {
0631 case GeomAbs_Line:
0632 {
0633 intconiconi.SetReversedParameters(Standard_True);
0634 intconiconi.Perform(TheCurveTool::Line(C2),D2,
0635 TheCurveTool::Parabola(C1),D1,TolConf,Tol);
0636 if(Composite)
0637 {
0638 this->Append(intconiconi,
0639 param1inf,
0640 param1sup,
0641 param2inf,
0642 param2sup);
0643 }
0644 else
0645 {
0646 this->SetValues(intconiconi);
0647 }
0648 }
0649 break;
0650
0651 case GeomAbs_Circle:
0652 {
0653 intconiconi.SetReversedParameters(Standard_True);
0654 intconiconi.Perform(TheCurveTool::Circle(C2),D2,
0655 TheCurveTool::Parabola(C1),D1,TolConf,Tol);
0656 if(Composite)
0657 { this->Append(intconiconi,
0658 param1inf,
0659 param1sup,
0660 param2inf,
0661 param2sup);
0662 }
0663 else
0664 {
0665 this->SetValues(intconiconi);
0666 }
0667 }
0668 break;
0669
0670 case GeomAbs_Ellipse:
0671 {
0672 intconiconi.SetReversedParameters(Standard_True);
0673 intconiconi.Perform(TheCurveTool::Ellipse(C2),D2,
0674 TheCurveTool::Parabola(C1),D1,TolConf,Tol);
0675 if(Composite)
0676 {
0677 this->Append(intconiconi,
0678 param1inf,
0679 param1sup,
0680 param2inf,
0681 param2sup);
0682 }
0683 else
0684 {
0685 this->SetValues(intconiconi);
0686 }
0687 }
0688 break;
0689
0690 case GeomAbs_Parabola:
0691 {
0692 intconiconi.SetReversedParameters(Standard_False);
0693 intconiconi.Perform(TheCurveTool::Parabola(C1),D1,
0694 TheCurveTool::Parabola(C2),D2,TolConf,Tol);
0695 if(Composite)
0696 {
0697 this->Append(intconiconi,
0698 param1inf,
0699 param1sup,
0700 param2inf,
0701 param2sup);
0702 }
0703 else
0704 {
0705 this->SetValues(intconiconi);
0706 }
0707 }
0708 break;
0709
0710 case GeomAbs_Hyperbola:
0711 {
0712 intconiconi.SetReversedParameters(Standard_False);
0713 intconiconi.Perform(TheCurveTool::Parabola(C1),D1,
0714 TheCurveTool::Hyperbola(C2),D2,
0715 TolConf,Tol);
0716 if(Composite)
0717 {
0718 this->Append(intconiconi,
0719 param1inf,
0720 param1sup,
0721 param2inf,
0722 param2sup);
0723 }
0724 else
0725 {
0726 this->SetValues(intconiconi);
0727 }
0728 }
0729 break;
0730
0731 default:
0732 {
0733 intconicurv.SetReversedParameters(Standard_False);
0734 intconicurv.Perform(TheCurveTool::Parabola(C1),D1,
0735 C2,D2,TolConf,Tol);
0736 if(Composite)
0737 {
0738 this->Append(intconicurv,
0739 param1inf,
0740 param1sup,
0741 param2inf,
0742 param2sup);
0743 }
0744 else
0745 {
0746 this->SetValues(intconicurv);
0747 }
0748 }
0749 break;
0750 }
0751 break;
0752
0753 case GeomAbs_Hyperbola:
0754 switch (typ2)
0755 {
0756 case GeomAbs_Line:
0757 {
0758 intconiconi.SetReversedParameters(Standard_True);
0759 intconiconi.Perform(TheCurveTool::Line(C2),D2,
0760 TheCurveTool::Hyperbola(C1),D1,TolConf,Tol);
0761 if(Composite)
0762 {
0763 this->Append(intconiconi,
0764 param1inf,
0765 param1sup,
0766 param2inf,
0767 param2sup);
0768 }
0769 else
0770 {
0771 this->SetValues(intconiconi);
0772 }
0773 }
0774 break;
0775
0776 case GeomAbs_Circle:
0777 {
0778 intconiconi.SetReversedParameters(Standard_True);
0779 intconiconi.Perform(TheCurveTool::Circle(C2),D2,
0780 TheCurveTool::Hyperbola(C1),D1,TolConf,Tol);
0781 if(Composite) { this->Append(intconiconi,
0782 param1inf,
0783 param1sup,
0784 param2inf,
0785 param2sup); }
0786 else { this->SetValues(intconiconi); }
0787 }
0788 break;
0789
0790 case GeomAbs_Ellipse:
0791 {
0792 intconiconi.SetReversedParameters(Standard_True);
0793 intconiconi.Perform(TheCurveTool::Ellipse(C2),D2,
0794 TheCurveTool::Hyperbola(C1),D1,TolConf,Tol);
0795 if(Composite) { this->Append(intconiconi,
0796 param1inf,
0797 param1sup,
0798 param2inf,
0799 param2sup); }
0800 else { this->SetValues(intconiconi); }
0801 }
0802 break;
0803
0804 case GeomAbs_Parabola:
0805 {
0806 intconiconi.SetReversedParameters(Standard_True);
0807 intconiconi.Perform(TheCurveTool::Parabola(C2),D2,
0808 TheCurveTool::Hyperbola(C1),D1,TolConf,Tol);
0809 if(Composite) { this->Append(intconiconi,
0810 param1inf,
0811 param1sup,
0812 param2inf,
0813 param2sup); }
0814 else { this->SetValues(intconiconi); }
0815 }
0816 break;
0817
0818 case GeomAbs_Hyperbola:
0819 {
0820 intconiconi.SetReversedParameters(Standard_False);
0821 intconiconi.Perform(TheCurveTool::Hyperbola(C1),D1,
0822 TheCurveTool::Hyperbola(C2),D2,
0823 TolConf,Tol);
0824 if(Composite) { this->Append(intconiconi,
0825 param1inf,
0826 param1sup,
0827 param2inf,
0828 param2sup); }
0829 else { this->SetValues(intconiconi); }
0830 }
0831 break;
0832
0833 default:
0834 {
0835 intconicurv.SetReversedParameters(Standard_False);
0836 intconicurv.Perform(TheCurveTool::Hyperbola(C1),D1,
0837 C2,D2,TolConf,Tol);
0838 if(Composite) { this->Append(intconicurv,
0839 param1inf,
0840 param1sup,
0841 param2inf,
0842 param2sup); }
0843 else { this->SetValues(intconicurv); }
0844 }
0845 break;
0846 }
0847 break;
0848
0849 default:
0850 switch (typ2)
0851 {
0852 case GeomAbs_Line:
0853 {
0854 intconicurv.SetReversedParameters(Standard_True);
0855 intconicurv.Perform(TheCurveTool::Line(C2),D2, C1,D1,TolConf,Tol);
0856 if(Composite)
0857 {
0858 this->Append(intconicurv,
0859 param1inf,
0860 param1sup,
0861 param2inf,
0862 param2sup);
0863 }
0864 else
0865 {
0866 this->SetValues(intconicurv);
0867 }
0868 }
0869 break;
0870
0871 case GeomAbs_Circle:
0872 {
0873 intconicurv.SetReversedParameters(Standard_True);
0874 intconicurv.Perform(TheCurveTool::Circle(C2),D2, C1,D1,TolConf,Tol);
0875 if(Composite)
0876 {
0877 this->Append(intconicurv,
0878 param1inf,
0879 param1sup,
0880 param2inf,
0881 param2sup);
0882 }
0883 else
0884 {
0885 this->SetValues(intconicurv);
0886 }
0887 }
0888 break;
0889
0890 case GeomAbs_Ellipse:
0891 {
0892 intconicurv.SetReversedParameters(Standard_True);
0893 intconicurv.Perform(TheCurveTool::Ellipse(C2),D2, C1,D1,TolConf,Tol);
0894 if(Composite)
0895 {
0896 this->Append(intconicurv,
0897 param1inf,
0898 param1sup,
0899 param2inf,
0900 param2sup);
0901 }
0902 else
0903 {
0904 this->SetValues(intconicurv);
0905 }
0906 }
0907 break;
0908
0909 case GeomAbs_Parabola:
0910 {
0911 intconicurv.SetReversedParameters(Standard_True);
0912 intconicurv.Perform(TheCurveTool::Parabola(C2),D2,C1,D1,TolConf,Tol);
0913 if(Composite)
0914 {
0915 this->Append(intconicurv,
0916 param1inf,
0917 param1sup,
0918 param2inf,
0919 param2sup);
0920 }
0921 else
0922 {
0923 this->SetValues(intconicurv);
0924 }
0925 }
0926 break;
0927
0928 case GeomAbs_Hyperbola:
0929 {
0930 intconicurv.SetReversedParameters(Standard_True);
0931 intconicurv.Perform(TheCurveTool::Hyperbola(C2),D2,C1,D1,
0932 TolConf,Tol);
0933 if(Composite)
0934 {
0935 this->Append(intconicurv,
0936 param1inf,
0937 param1sup,
0938 param2inf,
0939 param2sup);
0940 }
0941 else
0942 {
0943 this->SetValues(intconicurv);
0944 }
0945 }
0946 break;
0947
0948 default:
0949 {
0950 intcurvcurv.SetReversedParameters(Standard_False);
0951 intcurvcurv.Perform(C1,D1, C2,D2,TolConf,Tol);
0952 if(Composite)
0953 {
0954 this->Append(intcurvcurv,
0955 param1inf,
0956 param1sup,
0957 param2inf,
0958 param2sup); }
0959 else
0960 {
0961 this->SetValues(intcurvcurv);
0962 }
0963 done = Standard_True;
0964 }
0965 break;
0966 }
0967 break;
0968 }
0969 }
0970
0971 void IntCurve_IntCurveCurveGen::InternalCompositePerform_noRecurs(
0972 const Standard_Integer NbInterC1,
0973 const TheCurve& C1,
0974 const Standard_Integer NumInterC1,
0975 const TColStd_Array1OfReal& Tab1,
0976 const IntRes2d_Domain& D1,
0977 const Standard_Integer NbInterC2,
0978 const TheCurve& C2,
0979 const Standard_Integer NumInterC2,
0980 const TColStd_Array1OfReal& Tab2,
0981 const IntRes2d_Domain& D2,
0982 const Standard_Real TolConf,
0983 const Standard_Real Tol)
0984 {
0985
0986
0987 if(NumInterC2>NbInterC2)
0988 return;
0989
0990
0991 IntRes2d_Domain DomainC1NumInter;
0992 IntRes2d_Domain DomainC2NumInter;
0993
0994 //----------------------------------------------------------------------
0995 //-- Creation du domaine associe a la portion de C1
0996 //----------------------------------------------------------------------
0997 Standard_Boolean DomainIsOK = Standard_True;
0998 Standard_Real ParamInf,ParamSup;
0999
1000 if(NbInterC1>1) {
1001 TheCurveTool::GetInterval(C1,NumInterC1,Tab1,ParamInf,ParamSup);
1002 //--------------------------------------------------------------
1003 //-- Verification : Domaine Inclu dans Intervalle de Definition
1004 //--------------------------------------------------------------
1005
1006 Standard_Real u;
1007
1008 u = D1.FirstParameter();
1009 if(ParamInf < u) { ParamInf = u; }
1010
1011 u = D1.LastParameter();
1012 if(ParamSup > u) { ParamSup = u; }
1013
1014 if((ParamSup - ParamInf) > 1e-10) {
1015 DomainC1NumInter.SetValues(TheCurveTool::Value(C1,ParamInf),
1016 ParamInf,
1017 D1.FirstTolerance(),
1018 TheCurveTool::Value(C1,ParamSup),
1019 ParamSup,
1020 D1.LastTolerance());
1021 } else {
1022 DomainIsOK = Standard_False;
1023 }
1024 } else {
1025 DomainC1NumInter = D1;
1026 }
1027
1028 //----------------------------------------------------------------------
1029 //-- Creation du domaine associe a la portion de C2
1030 //----------------------------------------------------------------------
1031 if(NbInterC2 > 1) {
1032 TheCurveTool::GetInterval(C2,NumInterC2,Tab2,ParamInf,ParamSup);
1033 //--------------------------------------------------------------
1034 //-- Verification : Domaine Inclu dans Intervalle de Definition
1035 //--------------------------------------------------------------
1036
1037 Standard_Real u;
1038
1039 u = D2.FirstParameter();
1040 if(ParamInf < u) { ParamInf = u; }
1041 u = D2.LastParameter();
1042
1043 if(ParamSup > u) { ParamSup = u; }
1044
1045 if((ParamSup - ParamInf) > 1e-10) {
1046 DomainC2NumInter.SetValues(TheCurveTool::Value(C2,ParamInf),
1047 ParamInf,
1048 D2.FirstTolerance(),
1049 TheCurveTool::Value(C2,ParamSup),
1050 ParamSup,
1051 D2.LastTolerance());
1052 } else {
1053 DomainIsOK = Standard_False;
1054 }
1055 } else {
1056 DomainC2NumInter = D2;
1057 }
1058
1059 if(DomainIsOK) {
1060 InternalPerform(C2,DomainC2NumInter,
1061 C1,DomainC1NumInter,
1062 TolConf,Tol,
1063 Standard_True);
1064 }
1065 }
1066
1067
1068
1069
1070 //-- C1 ou C2 sont des courbes composites
1071 //--
1072
1073 void
1074 IntCurve_IntCurveCurveGen::InternalCompositePerform(const TheCurve& C1,
1075 const IntRes2d_Domain& D1,
1076 const Standard_Integer XXXNumInterC1,
1077 const Standard_Integer NbInterC1,
1078 const TColStd_Array1OfReal& Tab1,
1079 const TheCurve& C2,
1080 const IntRes2d_Domain& D2,
1081 const Standard_Integer XXXNumInterC2,
1082 const Standard_Integer NbInterC2,
1083 const TColStd_Array1OfReal& Tab2,
1084 const Standard_Real TolConf,
1085 const Standard_Real Tol,
1086 const Standard_Boolean RecursOnC2) {
1087
1088 Standard_Integer NumInterC2=XXXNumInterC2;
1089 Standard_Integer NumInterC1=XXXNumInterC1;
1090
1091
1092 // Standard_Boolean Arret=Standard_False;
1093
1094 if(NumInterC2>NbInterC2)
1095 return;
1096
1097 if(!RecursOnC2){
1098 InternalCompositePerform_noRecurs(NbInterC1, C1, NumInterC1, Tab1, D1, NbInterC2, C2, NumInterC2, Tab2, D2, TolConf, Tol);
1099 return;
1100 }
1101
1102 for(Standard_Integer i=NumInterC1 ; i<=NbInterC1; i++) {
1103 NumInterC1=i;
1104 /*
1105 InternalCompositePerform(C2,D2,NumInterC2,NbInterC2,Tab2,
1106 C1,D1,NumInterC1,NbInterC1,Tab1,
1107 TolConf,Tol,Standard_False);
1108 */
1109
1110 InternalCompositePerform_noRecurs(NbInterC2,C2,NumInterC2,Tab2,D2,NbInterC1,C1,NumInterC1,Tab1,D1,TolConf,Tol);
1111 }
1112
1113 if(NumInterC2<NbInterC2) {
1114 NumInterC2++;
1115 NumInterC1=1;
1116
1117 InternalCompositePerform(C1,D1,NumInterC1,NbInterC1,Tab1,
1118 C2,D2,NumInterC2,NbInterC2,Tab2,
1119 TolConf,Tol,
1120 Standard_True);
1121 }
1122 }
1123
1124 //=======================================================================
1125 //function : SetMinNbSamples
1126 //purpose :
1127 //=======================================================================
1128 void IntCurve_IntCurveCurveGen::SetMinNbSamples(const Standard_Integer theMinNbSamples)
1129 {
1130 intcurvcurv.SetMinNbSamples(theMinNbSamples);
1131 }
1132
1133 //=======================================================================
1134 //function : GetMinNbSamples
1135 //purpose :
1136 //=======================================================================
1137 Standard_Integer IntCurve_IntCurveCurveGen::GetMinNbSamples() const
1138 {
1139 return intcurvcurv.GetMinNbSamples();
1140 }