Back to home page

EIC code displayed by LXR

 
 

    


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

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_SequenceOfRanges.hxx>
0029 #include <Standard_Boolean.hxx>
0030 #include <Standard_Integer.hxx>
0031 #include <IntTools_ListOfCurveRangeSample.hxx>
0032 #include <IntTools_ListOfSurfaceRangeSample.hxx>
0033 class Geom_Surface;
0034 class IntTools_Context;
0035 class TopoDS_Edge;
0036 class TopoDS_Face;
0037 class IntTools_CurveRangeSample;
0038 class Bnd_Box;
0039 class IntTools_SurfaceRangeSample;
0040 class IntTools_CurveRangeLocalizeData;
0041 class IntTools_SurfaceRangeLocalizeData;
0042 
0043 
0044 //! The class BeanFaceIntersector computes ranges of parameters on
0045 //! the curve of a bean(part of edge) that bound the parts of bean which
0046 //! are on the surface of a face according to edge and face tolerances.
0047 //! Warning: The real boundaries of the face are not taken into account,
0048 //! Most of the result parts of the bean lays only inside the region of the surface,
0049 //! which includes the inside of the face. And the parts which are out of this region can be
0050 //! excluded from the result.
0051 class IntTools_BeanFaceIntersector 
0052 {
0053 public:
0054 
0055   DEFINE_STANDARD_ALLOC
0056 
0057   
0058   Standard_EXPORT IntTools_BeanFaceIntersector();
0059   
0060 
0061   //! Initializes the algorithm
0062   //!
0063   //! Warning:
0064   //! The parts of the edge which are on
0065   //! the surface of the face and belong to
0066   //! the whole in the face (if there is)
0067   //! is considered as result
0068   Standard_EXPORT IntTools_BeanFaceIntersector(const TopoDS_Edge& theEdge, const TopoDS_Face& theFace);
0069   
0070 
0071   //! Initializes the algorithm
0072   Standard_EXPORT IntTools_BeanFaceIntersector(const BRepAdaptor_Curve& theCurve, const BRepAdaptor_Surface& theSurface, const Standard_Real theBeanTolerance, const Standard_Real theFaceTolerance);
0073   
0074 
0075   //! Initializes the algorithm
0076   //! theUMinParameter, ... are used for
0077   //! optimization purposes
0078   Standard_EXPORT IntTools_BeanFaceIntersector(const BRepAdaptor_Curve& theCurve, const BRepAdaptor_Surface& theSurface, const Standard_Real theFirstParOnCurve, const Standard_Real theLastParOnCurve, const Standard_Real theUMinParameter, const Standard_Real theUMaxParameter, const Standard_Real theVMinParameter, const Standard_Real theVMaxParameter, const Standard_Real theBeanTolerance, const Standard_Real theFaceTolerance);
0079   
0080 
0081   //! Initializes the algorithm
0082   //!
0083   //! Warning:
0084   //! The parts of the edge which are on
0085   //! the surface of the face and belong to
0086   //! the whole in the face (if there is)
0087   //! is considered as result
0088   Standard_EXPORT void Init (const TopoDS_Edge& theEdge, const TopoDS_Face& theFace);
0089   
0090 
0091   //! Initializes the algorithm
0092   Standard_EXPORT void Init (const BRepAdaptor_Curve& theCurve, const BRepAdaptor_Surface& theSurface, const Standard_Real theBeanTolerance, const Standard_Real theFaceTolerance);
0093   
0094 
0095   //! Initializes the algorithm
0096   //! theUMinParameter, ... are used for
0097   //! optimization purposes
0098   Standard_EXPORT void Init (const BRepAdaptor_Curve& theCurve, const BRepAdaptor_Surface& theSurface, const Standard_Real theFirstParOnCurve, const Standard_Real theLastParOnCurve, const Standard_Real theUMinParameter, const Standard_Real theUMaxParameter, const Standard_Real theVMinParameter, const Standard_Real theVMaxParameter, const Standard_Real theBeanTolerance, const Standard_Real theFaceTolerance);
0099   
0100 
0101   //! Sets the intersection context
0102   Standard_EXPORT void SetContext (const Handle(IntTools_Context)& theContext);
0103   
0104 
0105   //! Gets the intersection context
0106   Standard_EXPORT const Handle(IntTools_Context)& Context() const;
0107   
0108 
0109   //! Set restrictions for curve
0110   Standard_EXPORT void SetBeanParameters (const Standard_Real theFirstParOnCurve, const Standard_Real theLastParOnCurve);
0111   
0112 
0113   //! Set restrictions for surface
0114   Standard_EXPORT void SetSurfaceParameters (const Standard_Real theUMinParameter, const Standard_Real theUMaxParameter, const Standard_Real theVMinParameter, const Standard_Real theVMaxParameter);
0115   
0116 
0117   //! Launches the algorithm
0118   Standard_EXPORT void Perform();
0119   
0120   //! Returns Done/NotDone state of the algorithm.
0121   Standard_Boolean IsDone() const
0122   {
0123     return myIsDone;
0124   }
0125   
0126   Standard_EXPORT const IntTools_SequenceOfRanges& Result() const;
0127   
0128   Standard_EXPORT void Result (IntTools_SequenceOfRanges& theResults) const;
0129 
0130   //! Returns the minimal distance found between edge and face
0131   Standard_Real MinimalSquareDistance() const
0132   {
0133     return myMinSqDistance;
0134   }
0135 
0136 
0137 private:
0138   
0139   Standard_EXPORT void ComputeAroundExactIntersection();
0140   
0141   Standard_EXPORT void ComputeLinePlane();
0142   
0143   //! Fast check on coincidence of the edge with face for the cases when both shapes are
0144   //! based on analytic geometries. The method also computes if the intersection
0145   //! between shapes is possible.
0146   //! The method returns TRUE if the computation was successful and further computation is unnecessary.
0147   //! Otherwise it returns FALSE and computation continues.
0148   Standard_EXPORT Standard_Boolean FastComputeAnalytic();
0149   
0150   Standard_EXPORT void ComputeUsingExtremum();
0151   
0152   Standard_EXPORT void ComputeNearRangeBoundaries();
0153   
0154   Standard_EXPORT Standard_Boolean ComputeLocalized();
0155   
0156   Standard_EXPORT void ComputeRangeFromStartPoint (const Standard_Boolean ToIncreaseParameter, const Standard_Real theParameter, const Standard_Real theUParameter, const Standard_Real theVParameter);
0157   
0158   Standard_EXPORT void ComputeRangeFromStartPoint (const Standard_Boolean ToIncreaseParameter, const Standard_Real theParameter, const Standard_Real theUParameter, const Standard_Real theVParameter, const Standard_Integer theIndex);
0159   
0160   Standard_EXPORT Standard_Real Distance (const Standard_Real theArg, Standard_Real& theUParameter, Standard_Real& theVParameter);
0161   
0162   Standard_EXPORT Standard_Real Distance (const Standard_Real theArg);
0163   
0164   Standard_EXPORT Standard_Boolean LocalizeSolutions (const IntTools_CurveRangeSample& theCurveRange, const Bnd_Box& theBoxCurve, const IntTools_SurfaceRangeSample& theSurfaceRange, const Bnd_Box& theBoxSurface, IntTools_CurveRangeLocalizeData& theCurveData, IntTools_SurfaceRangeLocalizeData& theSurfaceData, IntTools_ListOfCurveRangeSample& theListCurveRange, IntTools_ListOfSurfaceRangeSample& theListSurfaceRange);
0165   
0166   Standard_EXPORT Standard_Boolean TestComputeCoinside();
0167 
0168 
0169   BRepAdaptor_Curve myCurve;
0170   BRepAdaptor_Surface mySurface;
0171   Handle(Geom_Surface) myTrsfSurface;
0172   Standard_Real myFirstParameter;
0173   Standard_Real myLastParameter;
0174   Standard_Real myUMinParameter;
0175   Standard_Real myUMaxParameter;
0176   Standard_Real myVMinParameter;
0177   Standard_Real myVMaxParameter;
0178   Standard_Real myBeanTolerance;
0179   Standard_Real myFaceTolerance;
0180   Standard_Real myCurveResolution;
0181   Standard_Real myCriteria;
0182   GeomAPI_ProjectPointOnSurf myProjector;
0183   IntTools_MarkedRangeSet myRangeManager;
0184   Handle(IntTools_Context) myContext;
0185   IntTools_SequenceOfRanges myResults;
0186   Standard_Boolean myIsDone;
0187   Standard_Real myMinSqDistance;
0188 
0189 };
0190 
0191 #endif // _IntTools_BeanFaceIntersector_HeaderFile