Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/opencascade/IntPatch_ImpImpIntersection_6.gxx is written in an unsupported language. File is not indexed.

0001 // Created on: 1992-05-07
0002 // Created by: Jacques GOUSSARD
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2012 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 
0018 static 
0019   Standard_Boolean TreatResultTorus(const IntSurf_Quadric& theQuad1,
0020                                     const IntSurf_Quadric& theQuad2,
0021                                     const IntAna_QuadQuadGeo& anInt,
0022                                     Standard_Boolean& bEmpty,
0023                                     IntPatch_SequenceOfLine& theSeqLin);
0024 
0025 //=======================================================================
0026 //function : IntCyTo
0027 //purpose  : 
0028 //=======================================================================
0029 Standard_Boolean IntCyTo(const IntSurf_Quadric& theQuad1,
0030                          const IntSurf_Quadric& theQuad2,
0031                          const Standard_Real theTolTang,
0032                          const Standard_Boolean bReversed,
0033                          Standard_Boolean& bEmpty,
0034                          IntPatch_SequenceOfLine& theSeqLin)
0035 {
0036   const gp_Cylinder aCyl = bReversed ? theQuad2.Cylinder() : theQuad1.Cylinder();
0037   const gp_Torus aTorus = bReversed ? theQuad1.Torus() : theQuad2.Torus();
0038   //
0039   IntAna_QuadQuadGeo anInt(aCyl, aTorus, theTolTang);
0040   Standard_Boolean bRet = 
0041     TreatResultTorus(theQuad1, theQuad2, anInt, bEmpty, theSeqLin);
0042   //
0043   return bRet;
0044 }
0045 
0046 //=======================================================================
0047 //function : IntCoTo
0048 //purpose  : 
0049 //=======================================================================
0050 Standard_Boolean IntCoTo(const IntSurf_Quadric& theQuad1,
0051                          const IntSurf_Quadric& theQuad2,
0052                          const Standard_Real theTolTang,
0053                          const Standard_Boolean bReversed,
0054                          Standard_Boolean& bEmpty,
0055                          IntPatch_SequenceOfLine& theSeqLin)
0056 {
0057   const gp_Cone aCone = bReversed ? theQuad2.Cone() : theQuad1.Cone();
0058   const gp_Torus aTorus = bReversed ? theQuad1.Torus() : theQuad2.Torus();
0059   //
0060   IntAna_QuadQuadGeo anInt(aCone, aTorus, theTolTang);
0061   Standard_Boolean bRet = 
0062     TreatResultTorus(theQuad1, theQuad2, anInt, bEmpty, theSeqLin);
0063   //
0064   return bRet;
0065 }
0066 
0067 //=======================================================================
0068 //function : IntSpTo
0069 //purpose  : 
0070 //=======================================================================
0071 Standard_Boolean IntSpTo(const IntSurf_Quadric& theQuad1,
0072                          const IntSurf_Quadric& theQuad2,
0073                          const Standard_Real theTolTang,
0074                          const Standard_Boolean bReversed,
0075                          Standard_Boolean& bEmpty,
0076                          IntPatch_SequenceOfLine& theSeqLin)
0077 {
0078   const gp_Sphere aSphere = bReversed ? theQuad2.Sphere() : theQuad1.Sphere();
0079   const gp_Torus aTorus = bReversed ? theQuad1.Torus() : theQuad2.Torus();
0080   //
0081   IntAna_QuadQuadGeo anInt(aSphere, aTorus, theTolTang);
0082   Standard_Boolean bRet = 
0083     TreatResultTorus(theQuad1, theQuad2, anInt, bEmpty, theSeqLin);
0084   //
0085   return bRet;
0086 }
0087 
0088 //=======================================================================
0089 //function : IntToTo
0090 //purpose  : 
0091 //=======================================================================
0092 Standard_Boolean IntToTo(const IntSurf_Quadric& theQuad1,
0093                          const IntSurf_Quadric& theQuad2,
0094                          const Standard_Real theTolTang,
0095                          Standard_Boolean& bSameSurf,
0096                          Standard_Boolean& bEmpty,
0097                          IntPatch_SequenceOfLine& theSeqLin)
0098 {
0099   const gp_Torus aTorus1 = theQuad1.Torus();
0100   const gp_Torus aTorus2 = theQuad2.Torus();
0101   //
0102   IntAna_QuadQuadGeo anInt(aTorus1, aTorus2, theTolTang);
0103   Standard_Boolean bRet = anInt.IsDone();
0104   if (bRet) {
0105     if (anInt.TypeInter() == IntAna_Same) {
0106       bEmpty = Standard_False;
0107       bSameSurf = Standard_True;
0108     } else {
0109       bRet = TreatResultTorus(theQuad1, theQuad2, anInt, bEmpty, theSeqLin);
0110     }
0111   }
0112   //
0113   return bRet;
0114 }
0115 
0116 //=======================================================================
0117 //function : TreatResultTorus
0118 //purpose  : 
0119 //=======================================================================
0120 static Standard_Boolean TreatResultTorus(const IntSurf_Quadric& theQuad1,
0121                                          const IntSurf_Quadric& theQuad2,
0122                                          const IntAna_QuadQuadGeo& anInt,
0123                                          Standard_Boolean& bEmpty,
0124                                          IntPatch_SequenceOfLine& theSeqLin)
0125 {
0126   Standard_Boolean bRet = anInt.IsDone();
0127   //
0128   if (!bRet) {
0129     return bRet;
0130   }
0131   //
0132   IntAna_ResultType typint = anInt.TypeInter();
0133   Standard_Integer NbSol = anInt.NbSolutions();
0134   bEmpty = Standard_False;
0135   //
0136   switch (typint) {
0137   case IntAna_Empty :
0138     bEmpty = Standard_True;
0139     break;
0140   //
0141   case IntAna_Circle : {
0142     Standard_Integer i;
0143     IntSurf_TypeTrans trans1, trans2;
0144     gp_Vec Tgt;
0145     gp_Pnt ptref;
0146     //
0147     for (i = 1; i <= NbSol; ++i) {
0148       gp_Circ aC = anInt.Circle(i);
0149       if (theQuad1.TypeQuadric() == theQuad2.TypeQuadric()) {
0150         AdjustToSeam(theQuad1.Torus(), aC);
0151       }
0152       ElCLib::D1(0., aC, ptref, Tgt);
0153       Standard_Real qwe = Tgt.DotCross(theQuad2.Normale(ptref),
0154                                        theQuad1.Normale(ptref));
0155       if(qwe> 0.00000001) {
0156         trans1 = IntSurf_Out;
0157         trans2 = IntSurf_In;
0158       }
0159       else if(qwe< -0.00000001) {
0160         trans1 = IntSurf_In;
0161         trans2 = IntSurf_Out;
0162       }
0163       else { 
0164         trans1=trans2=IntSurf_Undecided; 
0165       }
0166       //
0167       Handle(IntPatch_GLine) glig = 
0168         new IntPatch_GLine(aC, Standard_False, trans1, trans2);
0169       theSeqLin.Append(glig);
0170     }
0171   }
0172     break;
0173   //
0174   case IntAna_NoGeometricSolution:
0175   default:
0176     bRet = Standard_False;
0177     break;
0178   }
0179   //
0180   return bRet;
0181 }