Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:11

0001 // Created by: Eugeny MALTCHIKOV
0002 // Copyright (c) 2013-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 _IntTools_EdgeEdge_HeaderFile
0016 #define _IntTools_EdgeEdge_HeaderFile
0017 
0018 #include <Standard.hxx>
0019 #include <Standard_DefineAlloc.hxx>
0020 #include <Standard_Handle.hxx>
0021 
0022 #include <BRepAdaptor_Curve.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <IntTools_SequenceOfCommonPrts.hxx>
0025 #include <IntTools_SequenceOfRanges.hxx>
0026 #include <TopAbs_ShapeEnum.hxx>
0027 class Geom_Curve;
0028 class Bnd_Box;
0029 
0030 
0031 
0032 //! The class provides Edge/Edge intersection algorithm
0033 //! based on the intersection between edges bounding boxes.
0034 class IntTools_EdgeEdge 
0035 {
0036 public:
0037 
0038   DEFINE_STANDARD_ALLOC
0039 
0040   
0041 
0042   //! Empty constructor
0043   IntTools_EdgeEdge();
0044 
0045   //! Destructor
0046   ~IntTools_EdgeEdge();
0047 
0048   //! Constructor
0049   IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2);
0050   
0051 
0052   //! Constructor
0053   IntTools_EdgeEdge(const TopoDS_Edge& theEdge1, const Standard_Real aT11,
0054       const Standard_Real aT12, const TopoDS_Edge& theEdge2, 
0055       const Standard_Real aT21, const Standard_Real aT22);
0056   
0057 
0058   //! Sets the first edge
0059   void SetEdge1(const TopoDS_Edge& theEdge);
0060   
0061 
0062   //! Sets the first edge and its range
0063   void SetEdge1(const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
0064   
0065 
0066   //! Sets the range for the first edge
0067   void SetRange1(const IntTools_Range& theRange1);
0068   
0069 
0070   //! Sets the range for the first edge
0071   void SetRange1(const Standard_Real aT1, const Standard_Real aT2);
0072   
0073 
0074   //! Sets the second edge
0075   void SetEdge2(const TopoDS_Edge& theEdge);
0076   
0077 
0078   //! Sets the first edge and its range
0079   void SetEdge2(const TopoDS_Edge& theEdge, const Standard_Real aT1, const Standard_Real aT2);
0080   
0081 
0082   //! Sets the range for the second edge
0083   void SetRange2(const IntTools_Range& theRange);
0084   
0085 
0086   //! Sets the range for the second edge
0087   void SetRange2(const Standard_Real aT1, const Standard_Real aT2);
0088   
0089 
0090   //! Sets the Fuzzy value
0091   void SetFuzzyValue (const Standard_Real theFuzz);
0092   
0093   
0094   //! Performs the intersection between edges
0095   Standard_EXPORT void Perform();
0096   
0097 
0098   //! Returns TRUE if common part(s) is(are) found
0099   Standard_Boolean IsDone() const;
0100   
0101 
0102   //! Returns Fuzzy value
0103   Standard_Real FuzzyValue() const;
0104   
0105   
0106   //! Returns common parts
0107   const IntTools_SequenceOfCommonPrts& CommonParts() const;
0108 
0109 
0110   //! Sets the flag myQuickCoincidenceCheck
0111   void UseQuickCoincidenceCheck (const Standard_Boolean bFlag) {
0112     myQuickCoincidenceCheck=bFlag;
0113   }
0114 
0115   //! Returns the flag myQuickCoincidenceCheck
0116   Standard_Boolean IsCoincidenceCheckedQuickly () {
0117     return myQuickCoincidenceCheck;
0118   }
0119 
0120 protected:
0121 
0122   
0123 
0124   //! Checks the data
0125   void CheckData();
0126   
0127 
0128   //! Prepares the data
0129   Standard_EXPORT void Prepare();
0130   
0131 
0132   //! Computes Line/Line intersection.
0133   Standard_EXPORT void ComputeLineLine();
0134   
0135 
0136   //! Intermediate function
0137   Standard_EXPORT void FindSolutions (IntTools_SequenceOfRanges& theRanges1, 
0138     IntTools_SequenceOfRanges& theRanges2, Standard_Boolean& bSplit2);
0139   
0140 
0141   //! Looking for the exact intersection ranges
0142   Standard_EXPORT void FindSolutions (
0143     const IntTools_Range& theR1, const Bnd_Box& theBox1,
0144     const IntTools_Range& theR2, const Bnd_Box& theBox2,
0145     IntTools_SequenceOfRanges& theRanges1, IntTools_SequenceOfRanges& theRanges2);
0146   
0147 
0148   //! Merges found solutions
0149   Standard_EXPORT void MergeSolutions (const IntTools_SequenceOfRanges& theRanges1, 
0150     const IntTools_SequenceOfRanges& theRanges2, const Standard_Boolean bSplit2);
0151   
0152 
0153   //! Looking for the range of the edge which is in the box
0154   Standard_EXPORT static Standard_Boolean FindParameters(const BRepAdaptor_Curve& theBAC,
0155     const Standard_Real aT1, const Standard_Real aT2, const Standard_Real theTol,
0156     const Standard_Real theRes, const Standard_Real thePTol,
0157     const Standard_Real theResCoeff, const Bnd_Box& theCBox,
0158     Standard_Real& aTB1, Standard_Real& aTB2);
0159   
0160 
0161   //! Checks if edges coincide on the ranges
0162   Standard_EXPORT Standard_Integer CheckCoincidence (const Standard_Real aT11,
0163     const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22,
0164     const Standard_Real theCriteria, const Standard_Real theCurveRes1);
0165   
0166 
0167   //! Adds common part of the given type to myCommonParts
0168   Standard_EXPORT void AddSolution (const Standard_Real aT11, const Standard_Real aT12,
0169     const Standard_Real aT21, const Standard_Real aT22, const TopAbs_ShapeEnum theType);
0170   
0171 
0172   //! Looking for the minimal distance between edges on the ranges
0173   Standard_EXPORT void FindBestSolution (const Standard_Real aT11, const Standard_Real aT12,
0174     const Standard_Real aT21, const Standard_Real aT22,
0175     Standard_Real& aT1, Standard_Real& aT2);
0176   
0177 
0178   //! Checks is there an intersection between edges on the given ranges
0179   //! (for nearly conicident edges)
0180   Standard_EXPORT Standard_Boolean IsIntersection (const Standard_Real aT11,
0181     const Standard_Real aT12, const Standard_Real aT21, const Standard_Real aT22);
0182 
0183   //! Checks if the edges are coincident really.
0184   Standard_EXPORT Standard_Boolean IsCoincident();
0185 
0186   TopoDS_Edge myEdge1;
0187   TopoDS_Edge myEdge2;
0188   Handle(Geom_Curve) myGeom1;
0189   Handle(Geom_Curve) myGeom2;
0190   BRepAdaptor_Curve myCurve1;
0191   BRepAdaptor_Curve myCurve2;
0192   Standard_Real myTol1;
0193   Standard_Real myTol2;
0194   Standard_Real myTol;
0195   Standard_Real myFuzzyValue;
0196   Standard_Real myRes1;
0197   Standard_Real myRes2;
0198   Standard_Real myResCoeff1;
0199   Standard_Real myResCoeff2;
0200   Standard_Real myPTol1;
0201   Standard_Real myPTol2;
0202   IntTools_Range myRange1;
0203   IntTools_Range myRange2;
0204   Standard_Boolean mySwap;
0205   Standard_Integer myErrorStatus;
0206   IntTools_SequenceOfCommonPrts myCommonParts;
0207 
0208   //! Allows avoiding use Edge-Edge intersection
0209   //! algorithm (i.e. speeding up the Boolean algorithm)
0210   //! if the edges are coincided really.
0211   //! If it is not evidently set of this flag should
0212   //! be avoided (otherwise, the performance of
0213   //! Boolean algorithm will be slower).
0214   Standard_Boolean myQuickCoincidenceCheck;
0215 
0216 private:
0217 
0218 };
0219 
0220 #include <IntTools_EdgeEdge.lxx>
0221 
0222 #endif // _IntTools_EdgeEdge_HeaderFile