0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / BRepMesh / BRepMesh_ShapeTool.hxx
1 // Copyright (c) 2013 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #ifndef _BRepMesh_ShapeTool_HeaderFile
16 #define _BRepMesh_ShapeTool_HeaderFile
17
18 #include <Standard.hxx>
19 #include <Standard_DefineAlloc.hxx>
20 #include <Standard_Macro.hxx>
21 #include <BRepAdaptor_HSurface.hxx>
22 #include <BRepMesh_FaceAttribute.hxx>
23 #include <BRepMesh.hxx>
24
25 class Poly_Triangulation;
26 class TopoDS_Face;
27 class TopoDS_Edge;
28 class Bnd_Box;
29 class TopoDS_Vertex;
30 class gp_XY;
31 class gp_Pnt2d;
32
33 class BRepMesh_ShapeTool
34 {
35 public:
36
37   DEFINE_STANDARD_ALLOC
38   
39   //! Returns maximum tolerance of the given face.
40   //! Considers tolerances of edges and vertices contained in the given face.
41   Standard_EXPORT static Standard_Real MaxFaceTolerance(
42     const TopoDS_Face& theFace);
43
44   //! Gets the maximum dimension of the given bounding box.
45   //! If the given bounding box is void leaves the resulting value unchanged.
46   //! @param theBox bounding box to be processed.
47   //! @param theMaxDimension maximum dimension of the given box.
48   Standard_EXPORT static void BoxMaxDimension(const Bnd_Box& theBox,
49                                               Standard_Real& theMaxDimension);
50
51   //! Returns relative deflection for edge with respect to shape size.
52   //! @param theEdge edge for which relative deflection should be computed.
53   //! @param theDeflection absolute deflection.
54   //! @param theMaxShapeSize maximum size of a shape.
55   //! @param theAdjustmentCoefficient coefficient of adjustment between maximum 
56   //! size of shape and calculated relative deflection.
57   //! @return relative deflection for the edge.
58   Standard_EXPORT static Standard_Real RelativeEdgeDeflection(
59     const TopoDS_Edge&  theEdge,
60     const Standard_Real theDeflection,
61     const Standard_Real theMaxShapeSize,
62     Standard_Real&      theAdjustmentCoefficient);
63
64   //! Checks 2d representations of 3d point with the 
65   //! given index for equality to avoid duplications.
66   //! @param theIndexOfPnt3d index of 3d point with which 2d 
67   //! representation should be associated.
68   //! @param thePnt2d 2d representation of the point with the 
69   //! given index.
70   //! @param theMinDistance minimum distance between vertices 
71   //! regarding which they could be treated as distinct ones.
72   //! @param theFaceAttribute attributes contining data calculated
73   //! according to face geomtry and define limits of face in parametric 
74   //! space. If defined, will be used instead of surface parameter.
75   //! @param theLocation2dMap map of 2d representations of 3d points.
76   //! @return given 2d point in case if 3d poind does not alredy have 
77   //! the similar representation, otherwice 2d point corresponding to 
78   //! existing representation will be returned.
79   Standard_EXPORT static gp_XY FindUV(
80     const Standard_Integer                theIndexOfPnt3d,
81     const gp_Pnt2d&                       thePnt2d,
82     const Standard_Real                   theMinDistance,
83     const Handle(BRepMesh_FaceAttribute)& theFaceAttribute);
84
85   //! Stores the given triangulation into the given face.
86   //! @param theFace face to be updated by triangulation.
87   //! @param theTriangulation triangulation to be stored into the face.
88   Standard_EXPORT static void AddInFace(
89     const TopoDS_Face&          theFace,
90     Handle(Poly_Triangulation)& theTriangulation);
91
92   //! Nullifies triangulation stored in the face.
93   //! @param theFace face to be updated by null triangulation.
94   Standard_EXPORT static void NullifyFace(const TopoDS_Face& theFace);
95
96   //! Nullifies polygon on triangulation stored in the edge.
97   //! @param theEdge edge to be updated by null polygon.
98   //! @param theTriangulation triangulation the given edge is associated to.
99   //! @param theLocation face location.
100   Standard_EXPORT static void NullifyEdge(
101     const TopoDS_Edge&                theEdge,
102     const Handle(Poly_Triangulation)& theTriangulation,
103     const TopLoc_Location&            theLocation);
104
105   //! Updates the given edge by the given tessellated representation.
106   //! @param theEdge edge to be updated.
107   //! @param thePolygon tessellated representation of the edge to be stored.
108   //! @param theTriangulation triangulation the given edge is associated to.
109   //! @param theLocation face location.
110   Standard_EXPORT static void UpdateEdge(
111     const TopoDS_Edge&                         theEdge,
112     const Handle(Poly_PolygonOnTriangulation)& thePolygon,
113     const Handle(Poly_Triangulation)&          theTriangulation,
114     const TopLoc_Location&                     theLocation);
115
116   //! Updates the given seam edge by the given tessellated representations.
117   //! @param theEdge edge to be updated.
118   //! @param thePolygon1 tessellated representation corresponding to
119   //! forward direction of the seam edge.
120   //! @param thePolygon2 tessellated representation corresponding to
121   //! reversed direction of the seam edge.
122   //! @param theTriangulation triangulation the given edge is associated to.
123   //! @param theLocation face location.
124   Standard_EXPORT static void UpdateEdge(
125     const TopoDS_Edge&                         theEdge,
126     const Handle(Poly_PolygonOnTriangulation)& thePolygon1,
127     const Handle(Poly_PolygonOnTriangulation)& thePolygon2,
128     const Handle(Poly_Triangulation)&          theTriangulation,
129     const TopLoc_Location&                     theLocation);
130
131   //! Applies location to the given point and return result.
132   //! @param thePnt point to be transformed.
133   //! @param theLoc location to be applied.
134   Standard_EXPORT static gp_Pnt UseLocation(const gp_Pnt&          thePnt,
135                                             const TopLoc_Location& theLoc);
136
137   //! Checks is the given edge degenerated.
138   //! Checks geometrical parameters in case if IsDegenerated flag is not set.
139   //! @param theEdge edge to be checked.
140   //! @param theFace face within which parametric space edge will be checked
141   //! for geometrical degenerativity.
142   Standard_EXPORT static Standard_Boolean IsDegenerated(
143     const TopoDS_Edge& theEdge,
144     const TopoDS_Face& theFace);
145 };
146
147 #endif