Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:13

0001 // Copyright (c) 2021 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 
0015 #ifndef _BRepLib_ValidateEdge_HeaderFile
0016 #define _BRepLib_ValidateEdge_HeaderFile
0017 
0018 #include<Standard_TypeDef.hxx>
0019 #include<Standard_Handle.hxx>
0020 
0021 class Adaptor3d_Curve;
0022 class Adaptor3d_CurveOnSurface;
0023 
0024 //! Computes the max distance between 3D-curve and curve on surface.
0025 //! This class uses 2 methods: approximate using finite
0026 //! number of points (default) and exact 
0027 class BRepLib_ValidateEdge
0028 {
0029 public:
0030   //! Initialization constructor
0031   Standard_EXPORT BRepLib_ValidateEdge(const Handle(Adaptor3d_Curve) theReferenceCurve,
0032                                        const Handle(Adaptor3d_CurveOnSurface) theOtherCurve,
0033                                        Standard_Boolean theSameParameter);
0034 
0035   //! Sets method to calculate distance: Calculating in finite number of points (if theIsExact
0036   //! is false, faster, but possible not correct result) or exact calculating by using 
0037   //! BRepLib_CheckCurveOnSurface class (if theIsExact is true, slowly, but more correctly).
0038   //! Exact method is used only when edge is SameParameter.
0039   //! Default method is calculating in finite number of points
0040   void SetExactMethod(Standard_Boolean theIsExact)
0041   {
0042     myIsExactMethod = theIsExact;
0043   }
0044 
0045   //! Returns true if exact method selected
0046   Standard_Boolean IsExactMethod()
0047   {
0048     return myIsExactMethod;
0049   }
0050 
0051   //! Sets parallel flag
0052   void SetParallel(Standard_Boolean theIsMultiThread)
0053   {
0054     myIsMultiThread = theIsMultiThread;
0055   }
0056 
0057   //! Returns true if parallel flag is set
0058   Standard_Boolean IsParallel()
0059   {
0060     return myIsMultiThread;
0061   }
0062 
0063   //! Set control points number (if you need a value other than 22)
0064   void SetControlPointsNumber(Standard_Integer theControlPointsNumber)
0065   {
0066     myControlPointsNumber = theControlPointsNumber;
0067   }
0068 
0069   //! Sets limit to compute a distance in the Process() function. If the distance greater than 
0070   //! theToleranceForChecking the Process() function stopped. Use this in case checking of 
0071   //! tolerance for best performcnce. Has no effect in case using exact method.
0072   void SetExitIfToleranceExceeded(Standard_Real theToleranceForChecking);
0073 
0074   //! Computes the max distance for the 3d curve <myReferenceCurve>
0075   //! and curve on surface <myOtherCurve>. If the SetExitIfToleranceExceeded()
0076   //!  function was called before <myCalculatedDistance> contains first 
0077   //! greater than SetExitIfToleranceExceeded() parameter value. In case 
0078   //! using exact method always computes real max distance.
0079   Standard_EXPORT void Process();
0080 
0081   //! Returns true if the distance has been found for all points
0082   Standard_Boolean IsDone() const
0083   {
0084     return myIsDone;
0085   }
0086 
0087   //! Returns true if computed distance is less than <theToleranceToCheck>
0088   Standard_EXPORT Standard_Boolean CheckTolerance(Standard_Real theToleranceToCheck);
0089 
0090   //! Returns max distance
0091   Standard_EXPORT Standard_Real GetMaxDistance();
0092 
0093   //! Increase <theToleranceToUpdate> if max distance is greater than <theToleranceToUpdate>
0094   Standard_EXPORT void UpdateTolerance(Standard_Real& theToleranceToUpdate);
0095 
0096 private:
0097   //! Adds some margin for distance checking
0098   Standard_Real correctTolerance(Standard_Real theTolerance);
0099 
0100   //! Calculating in finite number of points
0101   void processApprox();
0102 
0103   //! Calculating by using BRepLib_CheckCurveOnSurface class
0104   void processExact();
0105 
0106 private:
0107   Handle(Adaptor3d_Curve) myReferenceCurve;
0108   Handle(Adaptor3d_CurveOnSurface) myOtherCurve;
0109   Standard_Boolean mySameParameter;
0110   Standard_Integer myControlPointsNumber; 
0111   Standard_Real myToleranceForChecking;
0112   Standard_Real myCalculatedDistance;
0113   Standard_Boolean myExitIfToleranceExceeded;
0114   Standard_Boolean myIsDone;
0115   Standard_Boolean myIsExactMethod;
0116   Standard_Boolean myIsMultiThread;
0117 };
0118 
0119 #endif // _BRepLib_ValidateEdge_HeaderFile