Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:19:52

0001 // Created on: 2016-04-19
0002 // Copyright (c) 2016 OPEN CASCADE SAS
0003 // Created by: Oleg AGASHIN
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 _BRepMesh_Deflection_HeaderFile
0017 #define _BRepMesh_Deflection_HeaderFile
0018 
0019 #include <Standard_Handle.hxx>
0020 #include <Standard_Transient.hxx>
0021 #include <IMeshData_Types.hxx>
0022 
0023 struct IMeshTools_Parameters;
0024 
0025 //! Auxiliary tool encompassing methods to compute deflection of shapes.
0026 class BRepMesh_Deflection : public Standard_Transient
0027 {
0028 public:
0029   //! Returns absolute deflection for theShape with respect to the
0030   //! relative deflection and theMaxShapeSize.
0031   //! @param theShape shape for that the deflection should be computed.
0032   //! @param theRelativeDeflection relative deflection.
0033   //! @param theMaxShapeSize maximum size of the whole shape.
0034   //! @return absolute deflection for the shape.
0035   Standard_EXPORT static double ComputeAbsoluteDeflection(const TopoDS_Shape& theShape,
0036                                                           const double        theRelativeDeflection,
0037                                                           const double        theMaxShapeSize);
0038 
0039   //! Computes and updates deflection of the given discrete edge.
0040   Standard_EXPORT static void ComputeDeflection(const IMeshData::IEdgeHandle& theDEdge,
0041                                                 const double                  theMaxShapeSize,
0042                                                 const IMeshTools_Parameters&  theParameters);
0043 
0044   //! Computes and updates deflection of the given discrete wire.
0045   Standard_EXPORT static void ComputeDeflection(const IMeshData::IWireHandle& theDWire,
0046                                                 const IMeshTools_Parameters&  theParameters);
0047 
0048   //! Computes and updates deflection of the given discrete face.
0049   Standard_EXPORT static void ComputeDeflection(const IMeshData::IFaceHandle& theDFace,
0050                                                 const IMeshTools_Parameters&  theParameters);
0051 
0052   //! Checks if the deflection of current polygonal representation
0053   //! is consistent with the required deflection.
0054   //! @param[in] theCurrent  Current deflection.
0055   //! @param[in] theRequired  Required deflection.
0056   //! @param[in] theAllowDecrease  Flag controlling the check. If decrease is allowed,
0057   //! to be consistent the current and required deflections should be approximately the same.
0058   //! If not allowed, the current deflection should be less than required.
0059   //! @param[in] theRatio  The ratio for comparison of the deflections (value from 0 to 1).
0060   Standard_EXPORT static bool IsConsistent(const double theCurrent,
0061                                            const double theRequired,
0062                                            const bool   theAllowDecrease,
0063                                            const double theRatio = 0.1);
0064 
0065   DEFINE_STANDARD_RTTIEXT(BRepMesh_Deflection, Standard_Transient)
0066 };
0067 
0068 #endif