0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / BRepMesh / BRepMesh_Deflection.hxx
CommitLineData
7bd071ed 1// Created on: 2016-04-19
2// Copyright (c) 2016 OPEN CASCADE SAS
3// Created by: Oleg AGASHIN
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _BRepMesh_Deflection_HeaderFile
17#define _BRepMesh_Deflection_HeaderFile
18
19#include <Standard_Type.hxx>
20#include <Standard_Handle.hxx>
21#include <Standard_Transient.hxx>
22#include <IMeshData_Types.hxx>
23
24class Bnd_Box;
25class TopoDS_Face;
26class TopoDS_Edge;
27struct IMeshTools_Parameters;
28
29//! Auxiliary tool encompassing methods to compute deflection of shapes.
30class BRepMesh_Deflection : public Standard_Transient
31{
32public:
33
46478ffe 34 //! Returns absolute deflection for theShape with respect to the
35 //! relative deflection and theMaxShapeSize.
36 //! @param theShape shape for that the deflection should be computed.
37 //! @param theRelativeDeflection relative deflection.
38 //! @param theMaxShapeSize maximum size of the whole shape.
46478ffe 39 //! @return absolute deflection for the shape.
40 Standard_EXPORT static Standard_Real ComputeAbsoluteDeflection (
41 const TopoDS_Shape& theShape,
42 const Standard_Real theRelativeDeflection,
6933df8f 43 const Standard_Real theMaxShapeSize);
7bd071ed 44
45 //! Computes and updates deflection of the given discrete edge.
46 Standard_EXPORT static void ComputeDeflection (
47 const IMeshData::IEdgeHandle& theDEdge,
48 const Standard_Real theMaxShapeSize,
49 const IMeshTools_Parameters& theParameters);
50
51 //! Computes and updates deflection of the given discrete wire.
52 Standard_EXPORT static void ComputeDeflection (
53 const IMeshData::IWireHandle& theDWire,
54 const IMeshTools_Parameters& theParameters);
55
56 //! Computes and updates deflection of the given discrete face.
57 Standard_EXPORT static void ComputeDeflection (
58 const IMeshData::IFaceHandle& theDFace,
59 const IMeshTools_Parameters& theParameters);
60
128654b6 61 //! Checks if the deflection of current polygonal representation
62 //! is consistent with the required deflection.
63 //! @param theCurrent [in] Current deflection.
64 //! @param theRequired [in] Required deflection.
65 //! @param theAllowDecrease [in] Flag controlling the check. If decrease is allowed,
66 //! to be consistent the current and required deflections should be approximately the same.
67 //! If not allowed, the current deflection should be less than required.
68 //! @param theRatio [in] The ratio for comparison of the deflections (value from 0 to 1).
69 Standard_EXPORT static Standard_Boolean IsConsistent (
70 const Standard_Real theCurrent,
71 const Standard_Real theRequired,
72 const Standard_Boolean theAllowDecrease,
73 const Standard_Real theRatio = 0.1);
74
7bd071ed 75 DEFINE_STANDARD_RTTI_INLINE(BRepMesh_Deflection, Standard_Transient)
76};
77
78#endif