Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-13 08:29:46

0001 // Created by: Peter KURNEV
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef BOPDS_Interf_HeaderFile
0016 #define BOPDS_Interf_HeaderFile
0017 
0018 #include <IntTools_CommonPrt.hxx>
0019 #include <NCollection_BaseAllocator.hxx>
0020 #include <BOPDS_VectorOfCurve.hxx>
0021 #include <BOPDS_VectorOfPoint.hxx>
0022 
0023 /**
0024  * The class BOPDS_Interf stores the information about
0025  * the interference between two shapes.
0026  * The class BOPDS_Interf is root class
0027  *
0028  */
0029 //=======================================================================
0030 // function : BOPDS_Interf
0031 // purpose  :
0032 //=======================================================================
0033 class BOPDS_Interf
0034 {
0035 public:
0036   //
0037   /**
0038    * Sets the indices of interferred shapes
0039    * @param theIndex1
0040    *   index of the first shape
0041    * @param theIndex2
0042    *   index of the second shape
0043    */
0044   void SetIndices(const Standard_Integer theIndex1, const Standard_Integer theIndex2)
0045   {
0046     myIndex1 = theIndex1;
0047     myIndex2 = theIndex2;
0048   }
0049 
0050   //
0051   /**
0052    * Returns the indices of interferred shapes
0053    * @param theIndex1
0054    *   index of the first shape
0055    * @param theIndex2
0056    *   index of the second shape
0057    */
0058   void Indices(Standard_Integer& theIndex1, Standard_Integer& theIndex2) const
0059   {
0060     theIndex1 = myIndex1;
0061     theIndex2 = myIndex2;
0062   }
0063 
0064   //
0065   /**
0066    * Sets the index of the first interferred shape
0067    * @param theIndex
0068    *   index of the first shape
0069    */
0070   void SetIndex1(const Standard_Integer theIndex) { myIndex1 = theIndex; }
0071 
0072   //
0073   /**
0074    * Sets the index of the second interferred shape
0075    * @param theIndex
0076    *   index of the second shape
0077    */
0078   void SetIndex2(const Standard_Integer theIndex) { myIndex2 = theIndex; }
0079 
0080   //
0081   /**
0082    * Returns the index of the first interferred shape
0083    * @return
0084    *   index of the first shape
0085    */
0086   Standard_Integer Index1() const { return myIndex1; }
0087 
0088   //
0089   /**
0090    * Returns the index of the second interferred shape
0091    * @return
0092    *   index of the second shape
0093    */
0094   Standard_Integer Index2() const { return myIndex2; }
0095 
0096   //
0097   /**
0098    * Returns the index of that are opposite to the given index
0099    * @param theI
0100    *   the index
0101    * @return
0102    *   index of opposite shape
0103    */
0104   Standard_Integer OppositeIndex(const Standard_Integer theI) const
0105   {
0106     if (theI == myIndex1)
0107     {
0108       return myIndex2;
0109     }
0110     else if (theI == myIndex2)
0111     {
0112       return myIndex1;
0113     }
0114     else
0115     {
0116       return -1;
0117     }
0118   }
0119 
0120   //
0121   /**
0122    * Returns true if the interference contains given index
0123    * @param theIndex
0124    *   the index
0125    * @return
0126    *   true if the interference contains given index
0127    */
0128   Standard_Boolean Contains(const Standard_Integer theIndex) const
0129   {
0130     return (myIndex1 == theIndex || myIndex2 == theIndex);
0131   }
0132 
0133   //
0134   /**
0135    * Sets the index of new shape
0136    * @param theIndex
0137    *   the index
0138    */
0139   void SetIndexNew(const Standard_Integer theIndex) { myIndexNew = theIndex; }
0140 
0141   //
0142   //
0143   /**
0144    * Returns the index of new shape
0145    * @return theIndex
0146    *   the index of new shape
0147    */
0148   Standard_Integer IndexNew() const { return myIndexNew; }
0149 
0150   //
0151   /**
0152    * Returns true if the interference has index of new shape
0153    * that is equal to the given index
0154    * @param theIndex
0155    *   the index
0156    * @return true if the interference has index of new shape
0157    * that is equal to the given index
0158    */
0159   Standard_Boolean HasIndexNew(Standard_Integer& theIndex) const
0160   {
0161     theIndex = myIndexNew;
0162     return (myIndexNew >= 0);
0163   }
0164 
0165   //
0166   /**
0167    * Returns true if the interference has index of new shape
0168    *   the index
0169    * @return true if the interference has index of new shape
0170    */
0171   Standard_Boolean HasIndexNew() const { return (myIndexNew + 1) != 0; }
0172 
0173   //
0174 protected:
0175   BOPDS_Interf()
0176       : myIndex1(-1),
0177         myIndex2(-1),
0178         myIndexNew(-1),
0179         myAllocator(NCollection_BaseAllocator::CommonBaseAllocator())
0180   {
0181   }
0182 
0183   //
0184   BOPDS_Interf(const Handle(NCollection_BaseAllocator)& theAllocator)
0185       : myIndex1(-1),
0186         myIndex2(-1),
0187         myIndexNew(-1),
0188         myAllocator(theAllocator)
0189   {
0190   }
0191 
0192   //
0193   virtual ~BOPDS_Interf() {}
0194 
0195 protected:
0196   Standard_Integer                  myIndex1;
0197   Standard_Integer                  myIndex2;
0198   Standard_Integer                  myIndexNew;
0199   Handle(NCollection_BaseAllocator) myAllocator;
0200 };
0201 
0202 /**
0203  * The class BOPDS_InterfVV stores the information about
0204  * the interference of the type vertex/vertex.
0205  */
0206 //=======================================================================
0207 // function : BOPDS_InterfVV
0208 // purpose  :
0209 //=======================================================================
0210 class BOPDS_InterfVV : public BOPDS_Interf
0211 {
0212 public:
0213   //
0214   /**
0215    *  Constructor
0216    */
0217   BOPDS_InterfVV()
0218       : BOPDS_Interf()
0219   {
0220   }
0221 
0222   //
0223   /**
0224    *  Constructor
0225    * @param theAllocator
0226    *   allocator to manage the memory
0227    */
0228   BOPDS_InterfVV(const Handle(NCollection_BaseAllocator)& theAllocator)
0229       : BOPDS_Interf(theAllocator)
0230   {
0231   }
0232 
0233   //
0234   /**
0235    *  Destructor
0236    */
0237   virtual ~BOPDS_InterfVV() {}
0238 
0239   //
0240 };
0241 
0242 /**
0243  * The class BOPDS_InterfVE stores the information about
0244  * the interference of the type vertex/edge.
0245  */
0246 //=======================================================================
0247 // function : BOPDS_InterfVE
0248 // purpose  :
0249 //=======================================================================
0250 class BOPDS_InterfVE : public BOPDS_Interf
0251 {
0252 public:
0253   //
0254   /**
0255    *  Constructor
0256    */
0257   BOPDS_InterfVE()
0258       : BOPDS_Interf(),
0259         myParameter(0.)
0260   {
0261   }
0262 
0263   //
0264   /**
0265    *  Constructor
0266    * @param theAllocator
0267    *   allocator to manage the memory
0268    */
0269   BOPDS_InterfVE(const Handle(NCollection_BaseAllocator)& theAllocator)
0270       : BOPDS_Interf(theAllocator),
0271         myParameter(0.)
0272   {
0273   }
0274 
0275   //
0276   /**
0277    *  Destructor
0278    */
0279   virtual ~BOPDS_InterfVE() {}
0280 
0281   //
0282   /**
0283    *  Modifier
0284    * Sets the value of parameter
0285    * of the point of the vertex
0286    * on the curve of the edge
0287    * @param theT
0288    *   value of parameter
0289    */
0290   void SetParameter(const Standard_Real theT) { myParameter = theT; }
0291 
0292   //
0293   /**
0294    *  Selector
0295    * Returrns the value of parameter
0296    * of the point of the vertex
0297    * on the curve of the edge
0298    * @return
0299    *   value of parameter
0300    */
0301   Standard_Real Parameter() const { return myParameter; }
0302 
0303 protected:
0304   Standard_Real myParameter;
0305 };
0306 
0307 /**
0308  * The class BOPDS_InterfVF stores the information about
0309  * the interference of the type vertex/face
0310  */
0311 //=======================================================================
0312 // function : BOPDS_InterfVF
0313 // purpose  :
0314 //=======================================================================
0315 class BOPDS_InterfVF : public BOPDS_Interf
0316 {
0317 public:
0318   //
0319   /**
0320    *  Constructor
0321    */
0322   BOPDS_InterfVF()
0323       : BOPDS_Interf(),
0324         myU(0.),
0325         myV(0.)
0326   {
0327   }
0328 
0329   //
0330   /**
0331    *  Constructor
0332    * @param theAllocator
0333    *   allocator to manage the memory
0334    */
0335   BOPDS_InterfVF(const Handle(NCollection_BaseAllocator)& theAllocator)
0336       : BOPDS_Interf(theAllocator),
0337         myU(0.),
0338         myV(0.)
0339   {
0340   }
0341 
0342   //
0343   /**
0344    *  Destructor
0345    */
0346   virtual ~BOPDS_InterfVF() {}
0347 
0348   //
0349   /**
0350    * Modifier
0351    * Sets the value of parameters
0352    * of the point of the vertex
0353    * on the surface of of the face
0354    * @param theU
0355    *   value of U parameter
0356    * @param theV
0357    *   value of U parameter
0358    */
0359   void SetUV(const Standard_Real theU, const Standard_Real theV)
0360   {
0361     myU = theU;
0362     myV = theV;
0363   }
0364 
0365   //
0366   /**
0367    * Selector
0368    * Returns the value of parameters
0369    * of the point of the vertex
0370    * on the surface of of the face
0371    * @param theU
0372    *   value of U parameter
0373    * @param theV
0374    *   value of U parameter
0375    */
0376   void UV(Standard_Real& theU, Standard_Real& theV) const
0377   {
0378     theU = myU;
0379     theV = myV;
0380   }
0381 
0382 protected:
0383   Standard_Real myU;
0384   Standard_Real myV;
0385 };
0386 
0387 /**
0388  * The class BOPDS_InterfEE stores the information about
0389  * the interference of the type edge/edge.
0390  */
0391 //=======================================================================
0392 // function : BOPDS_InterfEE
0393 // purpose  :
0394 //=======================================================================
0395 class BOPDS_InterfEE : public BOPDS_Interf
0396 {
0397 public:
0398   //
0399   /**
0400    *  Constructor
0401    */
0402   BOPDS_InterfEE()
0403       : BOPDS_Interf()
0404   {
0405   }
0406 
0407   //
0408   /**
0409    *  Constructor
0410    * @param theAllocator
0411    *   allocator to manage the memory
0412    */
0413   BOPDS_InterfEE(const Handle(NCollection_BaseAllocator)& theAllocator)
0414       : BOPDS_Interf(theAllocator)
0415   {
0416   }
0417 
0418   //
0419   /**
0420    *  Destructor
0421    */
0422   virtual ~BOPDS_InterfEE() {}
0423 
0424   //
0425   /**
0426    *  Modifier
0427    * Sets the info of common part
0428    * @param theCP
0429    *   common part
0430    */
0431   void SetCommonPart(const IntTools_CommonPrt& theCP) { myCommonPart = theCP; }
0432 
0433   //
0434   /**
0435    *  Selector
0436    * Returns the info of common part
0437    * @return
0438    *   common part
0439    */
0440   const IntTools_CommonPrt& CommonPart() const { return myCommonPart; }
0441 
0442 protected:
0443   IntTools_CommonPrt myCommonPart;
0444 };
0445 
0446 /**
0447  * The class BOPDS_InterfEF stores the information about
0448  * the interference of the type edge/face.
0449  */
0450 //=======================================================================
0451 // function : BOPDS_InterfEF
0452 // purpose  :
0453 //=======================================================================
0454 class BOPDS_InterfEF : public BOPDS_Interf
0455 {
0456 public:
0457   //
0458   /**
0459    *  Constructor
0460    */
0461   BOPDS_InterfEF()
0462       : BOPDS_Interf()
0463   {
0464   }
0465 
0466   //
0467   /**
0468    *  Constructor
0469    * @param theAllocator
0470    *   allocator to manage the memory
0471    */
0472   /**
0473    *  Constructor
0474    * @param theAllocator
0475    *   allocator to manage the memory
0476    */
0477   BOPDS_InterfEF(const Handle(NCollection_BaseAllocator)& theAllocator)
0478       : BOPDS_Interf(theAllocator)
0479   {
0480   }
0481 
0482   //
0483   /**
0484    *  Destructor
0485    */
0486   virtual ~BOPDS_InterfEF() {}
0487 
0488   //
0489   /**
0490    * Modifier
0491    * Sets the info of common part
0492    * @param theCP
0493    *   common part
0494    */
0495   void SetCommonPart(const IntTools_CommonPrt& theCP) { myCommonPart = theCP; }
0496 
0497   //
0498   /**
0499    *  Selector
0500    * Returns the info of common part
0501    * @return
0502    *   common part
0503    */
0504   const IntTools_CommonPrt& CommonPart() const { return myCommonPart; }
0505 
0506   //
0507 protected:
0508   IntTools_CommonPrt myCommonPart;
0509 }
0510 /**
0511  * The class BOPDS_InterfFF stores the information about
0512  * the interference of the type face/face.
0513  */
0514 ;
0515 
0516 //=======================================================================
0517 // function : BOPDS_InterfFF
0518 // purpose  :
0519 //=======================================================================
0520 class BOPDS_InterfFF : public BOPDS_Interf
0521 {
0522 public:
0523   //
0524   /**
0525    *  Constructor
0526    */
0527   BOPDS_InterfFF()
0528       : BOPDS_Interf(),
0529         myTangentFaces(Standard_False),
0530         myCurves(0, myAllocator),
0531         myPoints(0, myAllocator)
0532   {
0533   }
0534 
0535   //
0536   /**
0537    *  Destructor
0538    */
0539   virtual ~BOPDS_InterfFF() {}
0540 
0541   //
0542   /**
0543    * Initializer
0544    * @param theNbCurves
0545    *   number of intersection curves
0546    * @param theNbPoints
0547    *   number of intersection points
0548    */
0549 
0550   void Init(const Standard_Integer theNbCurves, const Standard_Integer theNbPoints)
0551   {
0552     if (theNbCurves > 0)
0553     {
0554       myCurves.SetIncrement(theNbCurves);
0555     }
0556     if (theNbPoints > 0)
0557     {
0558       myPoints.SetIncrement(theNbPoints);
0559     }
0560   }
0561 
0562   /**
0563    * Modifier
0564    * Sets the flag of whether the faces are tangent
0565    * @param theFlag
0566    *   the flag
0567    */
0568   void SetTangentFaces(const Standard_Boolean theFlag) { myTangentFaces = theFlag; }
0569 
0570   /**
0571    * Selector
0572    * Returns the flag whether the faces are tangent
0573    * @return
0574    *   the flag
0575    */
0576   Standard_Boolean TangentFaces() const { return myTangentFaces; }
0577 
0578   //
0579   /**
0580    * Selector
0581    * Returns the intersection curves
0582    * @return
0583    *   intersection curves
0584    */
0585   const BOPDS_VectorOfCurve& Curves() const { return myCurves; }
0586 
0587   //
0588   /**
0589    * Selector/Modifier
0590    * Returns the intersection curves
0591    * @return
0592    *   intersection curves
0593    */
0594   BOPDS_VectorOfCurve& ChangeCurves() { return myCurves; }
0595 
0596   //
0597   /**
0598    * Selector
0599    * Returns the intersection points
0600    * @return
0601    *   intersection points
0602    */
0603   const BOPDS_VectorOfPoint& Points() const { return myPoints; }
0604 
0605   //
0606   /**
0607    * Selector/Modifier
0608    * Returns the intersection points
0609    * @return
0610    *   intersection points
0611    */
0612   BOPDS_VectorOfPoint& ChangePoints() { return myPoints; }
0613 
0614   //
0615 protected:
0616   Standard_Boolean    myTangentFaces;
0617   BOPDS_VectorOfCurve myCurves;
0618   BOPDS_VectorOfPoint myPoints;
0619 };
0620 
0621 /**
0622  * The class BOPDS_InterfVZ stores the information about
0623  * the interference of the type vertex/solid.
0624  */
0625 //=======================================================================
0626 // function : BOPDS_InterfVZ
0627 // purpose  :
0628 //=======================================================================
0629 class BOPDS_InterfVZ : public BOPDS_Interf
0630 {
0631 public:
0632   //
0633   /**
0634    *  Constructor
0635    */
0636   BOPDS_InterfVZ()
0637       : BOPDS_Interf() {};
0638   //
0639   /**
0640    *  Constructor
0641    * @param theAllocator
0642    *   allocator to manage the memory
0643    */
0644   BOPDS_InterfVZ(const Handle(NCollection_BaseAllocator)& theAllocator)
0645       : BOPDS_Interf(theAllocator) {};
0646   //
0647   /**
0648    *  Destructor
0649    */
0650   virtual ~BOPDS_InterfVZ() {};
0651   //
0652 };
0653 
0654 /**
0655  * The class BOPDS_InterfEZ stores the information about
0656  * the interference of the type edge/solid.
0657  */
0658 //=======================================================================
0659 // function : BOPDS_InterfEZ
0660 // purpose  :
0661 //=======================================================================
0662 class BOPDS_InterfEZ : public BOPDS_Interf
0663 {
0664 public:
0665   //
0666   /**
0667    *  Constructor
0668    */
0669   BOPDS_InterfEZ()
0670       : BOPDS_Interf() {};
0671   //
0672   /**
0673    *  Constructor
0674    * @param theAllocator
0675    *   allocator to manage the memory
0676    */
0677   BOPDS_InterfEZ(const Handle(NCollection_BaseAllocator)& theAllocator)
0678       : BOPDS_Interf(theAllocator) {};
0679   //
0680   /**
0681    *  Destructor
0682    */
0683   virtual ~BOPDS_InterfEZ() {};
0684   //
0685 };
0686 
0687 /**
0688  * The class BOPDS_InterfFZ stores the information about
0689  * the interference of the type face/solid.
0690  */
0691 //=======================================================================
0692 // function : BOPDS_InterfFZ
0693 // purpose  :
0694 //=======================================================================
0695 class BOPDS_InterfFZ : public BOPDS_Interf
0696 {
0697 public:
0698   //
0699   /**
0700    *  Constructor
0701    */
0702   BOPDS_InterfFZ()
0703       : BOPDS_Interf() {};
0704   //
0705   /**
0706    *  Constructor
0707    * @param theAllocator
0708    *   allocator to manage the memory
0709    */
0710   BOPDS_InterfFZ(const Handle(NCollection_BaseAllocator)& theAllocator)
0711       : BOPDS_Interf(theAllocator) {};
0712   //
0713   /**
0714    *  Destructor
0715    */
0716   virtual ~BOPDS_InterfFZ() {};
0717   //
0718 };
0719 
0720 /**
0721  * The class BOPDS_InterfZZ stores the information about
0722  * the interference of the type solid/solid.
0723  */
0724 //=======================================================================
0725 // function : BOPDS_InterfZZ
0726 // purpose  :
0727 //=======================================================================
0728 class BOPDS_InterfZZ : public BOPDS_Interf
0729 {
0730 public:
0731   //
0732   /**
0733    *  Constructor
0734    */
0735   BOPDS_InterfZZ()
0736       : BOPDS_Interf() {};
0737   //
0738   /**
0739    *  Constructor
0740    * @param theAllocator
0741    *   allocator to manage the memory
0742    */
0743   BOPDS_InterfZZ(const Handle(NCollection_BaseAllocator)& theAllocator)
0744       : BOPDS_Interf(theAllocator) {};
0745   //
0746   /**
0747    *  Destructor
0748    */
0749   virtual ~BOPDS_InterfZZ() {};
0750   //
0751 };
0752 
0753 #endif