Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/IntTools_BeanFaceIntersector.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 2001-06-29
0002 // Created by: Michael KLOKOV
0003 // Copyright (c) 2001-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _IntTools_BeanFaceIntersector_HeaderFile
0017 #define _IntTools_BeanFaceIntersector_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 
0022 #include <BRepAdaptor_Curve.hxx>
0023 #include <BRepAdaptor_Surface.hxx>
0024 #include <Standard_Real.hxx>
0025 #include <Extrema_ExtCS.hxx>
0026 #include <GeomAPI_ProjectPointOnSurf.hxx>
0027 #include <IntTools_MarkedRangeSet.hxx>
0028 #include <IntTools_Range.hxx>
0029 #include <NCollection_Sequence.hxx>
0030 #include <Standard_Boolean.hxx>
0031 #include <Standard_Integer.hxx>
0032 #include <IntTools_CurveRangeSample.hxx>
0033 #include <NCollection_List.hxx>
0034 #include <IntTools_SurfaceRangeSample.hxx>
0035 class Geom_Surface;
0036 class IntTools_Context;
0037 class TopoDS_Edge;
0038 class TopoDS_Face;
0039 class IntTools_CurveRangeSample;
0040 class Bnd_Box;
0041 class IntTools_SurfaceRangeSample;
0042 class IntTools_CurveRangeLocalizeData;
0043 class IntTools_SurfaceRangeLocalizeData;
0044 
0045 //! The class BeanFaceIntersector computes ranges of parameters on
0046 //! the curve of a bean(part of edge) that bound the parts of bean which
0047 //! are on the surface of a face according to edge and face tolerances.
0048 //! Warning: The real boundaries of the face are not taken into account,
0049 //! Most of the result parts of the bean lays only inside the region of the surface,
0050 //! which includes the inside of the face. And the parts which are out of this region can be
0051 //! excluded from the result.
0052 class IntTools_BeanFaceIntersector
0053 {
0054 public:
0055   DEFINE_STANDARD_ALLOC
0056 
0057   Standard_EXPORT IntTools_BeanFaceIntersector();
0058 
0059   //! Initializes the algorithm
0060   //!
0061   //! Warning:
0062   //! The parts of the edge which are on
0063   //! the surface of the face and belong to
0064   //! the whole in the face (if there is)
0065   //! is considered as result
0066   Standard_EXPORT IntTools_BeanFaceIntersector(const TopoDS_Edge& theEdge,
0067                                                const TopoDS_Face& theFace);
0068 
0069   //! Initializes the algorithm
0070   Standard_EXPORT IntTools_BeanFaceIntersector(const BRepAdaptor_Curve&   theCurve,
0071                                                const BRepAdaptor_Surface& theSurface,
0072                                                const double               theBeanTolerance,
0073                                                const double               theFaceTolerance);
0074 
0075   //! Initializes the algorithm
0076   //! theUMinParameter, ... are used for
0077   //! optimization purposes
0078   Standard_EXPORT IntTools_BeanFaceIntersector(const BRepAdaptor_Curve&   theCurve,
0079                                                const BRepAdaptor_Surface& theSurface,
0080                                                const double               theFirstParOnCurve,
0081                                                const double               theLastParOnCurve,
0082                                                const double               theUMinParameter,
0083                                                const double               theUMaxParameter,
0084                                                const double               theVMinParameter,
0085                                                const double               theVMaxParameter,
0086                                                const double               theBeanTolerance,
0087                                                const double               theFaceTolerance);
0088 
0089   //! Initializes the algorithm
0090   //!
0091   //! Warning:
0092   //! The parts of the edge which are on
0093   //! the surface of the face and belong to
0094   //! the whole in the face (if there is)
0095   //! is considered as result
0096   Standard_EXPORT void Init(const TopoDS_Edge& theEdge, const TopoDS_Face& theFace);
0097 
0098   //! Initializes the algorithm
0099   Standard_EXPORT void Init(const BRepAdaptor_Curve&   theCurve,
0100                             const BRepAdaptor_Surface& theSurface,
0101                             const double               theBeanTolerance,
0102                             const double               theFaceTolerance);
0103 
0104   //! Initializes the algorithm
0105   //! theUMinParameter, ... are used for
0106   //! optimization purposes
0107   Standard_EXPORT void Init(const BRepAdaptor_Curve&   theCurve,
0108                             const BRepAdaptor_Surface& theSurface,
0109                             const double               theFirstParOnCurve,
0110                             const double               theLastParOnCurve,
0111                             const double               theUMinParameter,
0112                             const double               theUMaxParameter,
0113                             const double               theVMinParameter,
0114                             const double               theVMaxParameter,
0115                             const double               theBeanTolerance,
0116                             const double               theFaceTolerance);
0117 
0118   //! Sets the intersection context
0119   Standard_EXPORT void SetContext(const occ::handle<IntTools_Context>& theContext);
0120 
0121   //! Gets the intersection context
0122   Standard_EXPORT const occ::handle<IntTools_Context>& Context() const;
0123 
0124   //! Set restrictions for curve
0125   Standard_EXPORT void SetBeanParameters(const double theFirstParOnCurve,
0126                                          const double theLastParOnCurve);
0127 
0128   //! Set restrictions for surface
0129   Standard_EXPORT void SetSurfaceParameters(const double theUMinParameter,
0130                                             const double theUMaxParameter,
0131                                             const double theVMinParameter,
0132                                             const double theVMaxParameter);
0133 
0134   //! Launches the algorithm
0135   Standard_EXPORT void Perform();
0136 
0137   //! Returns Done/NotDone state of the algorithm.
0138   bool IsDone() const { return myIsDone; }
0139 
0140   Standard_EXPORT const NCollection_Sequence<IntTools_Range>& Result() const;
0141 
0142   Standard_EXPORT void Result(NCollection_Sequence<IntTools_Range>& theResults) const;
0143 
0144   //! Returns the minimal distance found between edge and face
0145   double MinimalSquareDistance() const { return myMinSqDistance; }
0146 
0147 private:
0148   Standard_EXPORT void ComputeAroundExactIntersection();
0149 
0150   Standard_EXPORT void ComputeLinePlane();
0151 
0152   //! Fast check on coincidence of the edge with face for the cases when both shapes are
0153   //! based on analytic geometries. The method also computes if the intersection
0154   //! between shapes is possible.
0155   //! The method returns TRUE if the computation was successful and further computation is
0156   //! unnecessary. Otherwise it returns FALSE and computation continues.
0157   Standard_EXPORT bool FastComputeAnalytic();
0158 
0159   Standard_EXPORT void ComputeUsingExtremum();
0160 
0161   Standard_EXPORT void ComputeNearRangeBoundaries();
0162 
0163   Standard_EXPORT bool ComputeLocalized();
0164 
0165   Standard_EXPORT void ComputeRangeFromStartPoint(const bool   ToIncreaseParameter,
0166                                                   const double theParameter,
0167                                                   const double theUParameter,
0168                                                   const double theVParameter);
0169 
0170   Standard_EXPORT void ComputeRangeFromStartPoint(const bool   ToIncreaseParameter,
0171                                                   const double theParameter,
0172                                                   const double theUParameter,
0173                                                   const double theVParameter,
0174                                                   const int    theIndex);
0175 
0176   Standard_EXPORT double Distance(const double theArg,
0177                                   double&      theUParameter,
0178                                   double&      theVParameter);
0179 
0180   Standard_EXPORT double Distance(const double theArg);
0181 
0182   Standard_EXPORT bool LocalizeSolutions(
0183     const IntTools_CurveRangeSample&               theCurveRange,
0184     const Bnd_Box&                                 theBoxCurve,
0185     const IntTools_SurfaceRangeSample&             theSurfaceRange,
0186     const Bnd_Box&                                 theBoxSurface,
0187     IntTools_CurveRangeLocalizeData&               theCurveData,
0188     IntTools_SurfaceRangeLocalizeData&             theSurfaceData,
0189     NCollection_List<IntTools_CurveRangeSample>&   theListCurveRange,
0190     NCollection_List<IntTools_SurfaceRangeSample>& theListSurfaceRange);
0191 
0192   Standard_EXPORT bool TestComputeCoinside();
0193 
0194   BRepAdaptor_Curve                    myCurve;
0195   BRepAdaptor_Surface                  mySurface;
0196   occ::handle<Geom_Surface>            myTrsfSurface;
0197   double                               myFirstParameter;
0198   double                               myLastParameter;
0199   double                               myUMinParameter;
0200   double                               myUMaxParameter;
0201   double                               myVMinParameter;
0202   double                               myVMaxParameter;
0203   double                               myBeanTolerance;
0204   double                               myFaceTolerance;
0205   double                               myCurveResolution;
0206   double                               myCriteria;
0207   GeomAPI_ProjectPointOnSurf           myProjector;
0208   IntTools_MarkedRangeSet              myRangeManager;
0209   occ::handle<IntTools_Context>        myContext;
0210   NCollection_Sequence<IntTools_Range> myResults;
0211   bool                                 myIsDone;
0212   double                               myMinSqDistance;
0213 };
0214 
0215 #endif // _IntTools_BeanFaceIntersector_HeaderFile