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_EdgeTessellator_HeaderFile |
17 | #define _BRepMesh_EdgeTessellator_HeaderFile |
18 | |
19 | #include <IMeshTools_CurveTessellator.hxx> |
20 | #include <GCPnts_TangentialDeflection.hxx> |
21 | #include <TopoDS_Vertex.hxx> |
22 | #include <BRepAdaptor_Curve.hxx> |
23 | #include <IMeshData_Types.hxx> |
24 | |
7bd071ed |
25 | class Geom_Surface; |
26 | class Geom2d_Curve; |
27 | struct IMeshTools_Parameters; |
28 | |
29 | //! Auxiliary class performing tessellation of passed edge according to specified parameters. |
30 | class BRepMesh_CurveTessellator : public IMeshTools_CurveTessellator |
31 | { |
32 | public: |
33 | |
34 | //! Constructor. |
35 | Standard_EXPORT BRepMesh_CurveTessellator( |
36 | const IMeshData::IEdgeHandle& theEdge, |
f73592ed |
37 | const IMeshTools_Parameters& theParameters, |
38 | const Standard_Integer theMinPointsNb = 2); |
7bd071ed |
39 | |
40 | //! Constructor. |
41 | Standard_EXPORT BRepMesh_CurveTessellator ( |
42 | const IMeshData::IEdgeHandle& theEdge, |
43 | const TopAbs_Orientation theOrientation, |
44 | const IMeshData::IFaceHandle& theFace, |
f73592ed |
45 | const IMeshTools_Parameters& theParameters, |
46 | const Standard_Integer theMinPointsNb = 2); |
7bd071ed |
47 | |
48 | //! Destructor. |
49 | Standard_EXPORT virtual ~BRepMesh_CurveTessellator (); |
50 | |
51 | //! Returns number of tessellation points. |
52 | Standard_EXPORT virtual Standard_Integer PointsNb () const Standard_OVERRIDE; |
53 | |
54 | //! Returns parameters of solution with the given index. |
55 | //! @param theIndex index of tessellation point. |
56 | //! @param theParameter parameters on PCurve corresponded to the solution. |
57 | //! @param thePoint tessellation point. |
58 | //! @return True in case of valid result, false elewhere. |
59 | Standard_EXPORT virtual Standard_Boolean Value ( |
60 | const Standard_Integer theIndex, |
61 | gp_Pnt& thePoint, |
62 | Standard_Real& theParameter) const Standard_OVERRIDE; |
63 | |
4945e8be |
64 | DEFINE_STANDARD_RTTIEXT(BRepMesh_CurveTessellator, IMeshTools_CurveTessellator) |
7bd071ed |
65 | |
66 | private: |
67 | |
68 | //! Performs initialization of this tool. |
69 | void init(); |
70 | |
71 | //! Adds internal vertices to discrete polygon. |
72 | void addInternalVertices (); |
73 | |
b81b237f |
74 | //Check deflection in 2d space for improvement of edge tessellation. |
7bd071ed |
75 | void splitByDeflection2d (); |
76 | |
77 | void splitSegment ( |
78 | const Handle (Geom_Surface)& theSurf, |
79 | const Handle (Geom2d_Curve)& theCurve2d, |
80 | const Standard_Real theFirst, |
81 | const Standard_Real theLast, |
82 | const Standard_Integer theNbIter); |
83 | |
84 | //! Checks whether the given point lies within tolerance of the vertex. |
85 | Standard_Boolean isInToleranceOfVertex ( |
86 | const gp_Pnt& thePoint, |
87 | const TopoDS_Vertex& theVertex) const; |
88 | |
89 | private: |
90 | |
91 | BRepMesh_CurveTessellator (const BRepMesh_CurveTessellator& theOther); |
92 | |
93 | void operator=(const BRepMesh_CurveTessellator& theOther); |
94 | |
95 | private: |
96 | |
97 | const IMeshData::IEdgeHandle& myDEdge; |
98 | const IMeshTools_Parameters& myParameters; |
99 | TopoDS_Edge myEdge; |
100 | BRepAdaptor_Curve myCurve; |
f73592ed |
101 | Standard_Integer myMinPointsNb; |
7bd071ed |
102 | GCPnts_TangentialDeflection myDiscretTool; |
103 | TopoDS_Vertex myFirstVertex; |
104 | TopoDS_Vertex myLastVertex; |
105 | Standard_Real mySquareEdgeDef; |
106 | Standard_Real mySquareMinSize; |
107 | Standard_Real myEdgeSqTol; |
108 | Standard_Real myFaceRangeU[2]; |
109 | Standard_Real myFaceRangeV[2]; |
110 | }; |
111 | |
112 | #endif |