0025154: Collections in BRepMesh package are named in non-conformant manner
[occt.git] / src / BRepMesh / BRepMesh_FastDiscretFace.hxx
CommitLineData
fc9b36d6 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#ifndef _BRepMesh_FastDiscretFace_HeaderFile
15#define _BRepMesh_FastDiscretFace_HeaderFile
16
17#include <Standard.hxx>
18#include <Standard_DefineHandle.hxx>
19#include <BRepMesh_FastDiscretFace.hxx>
20#include <BRepMesh_DataStructureOfDelaun.hxx>
848fa7e3 21#include <BRepMesh.hxx>
fc9b36d6 22#include <BRepMesh_FaceAttribute.hxx>
23#include <Standard_Transient.hxx>
24#include <TopTools_MutexForShapeProvider.hxx>
25#include <Handle_BRepAdaptor_HSurface.hxx>
26#include <Handle_Poly_Triangulation.hxx>
27#include <BRepMesh_Delaun.hxx>
28#include <BRepMesh_Triangle.hxx>
ceb418e1 29#include <BRepMesh_Classifier.hxx>
30#include <ElSLib.hxx>
fc9b36d6 31
32class BRepMesh_DataStructureOfDelaun;
33class BRepMesh_FaceAttribute;
34class TopoDS_Face;
35class TopTools_DataMapOfShapeReal;
36class TopoDS_Vertex;
37class BRepAdaptor_HSurface;
38class TopoDS_Edge;
39class Poly_Triangulation;
40class TopLoc_Location;
41class gp_XY;
42class gp_Pnt2d;
43class BRepMesh_Edge;
44class BRepMesh_Vertex;
45class gp_Pnt;
46
47//! Algorithm to mesh a face with respect of the frontier
ceb418e1 48//! the deflection and by option the shared components.
fc9b36d6 49class BRepMesh_FastDiscretFace : public Standard_Transient
50{
51public:
848fa7e3 52
53 Standard_EXPORT BRepMesh_FastDiscretFace(
54 const Standard_Real theAngle,
55 const Standard_Boolean theWithShare = Standard_True);
ceb418e1 56
57 Standard_EXPORT void Add(const Handle(BRepMesh_FaceAttribute)& theAttribute);
fc9b36d6 58
ceb418e1 59 DEFINE_STANDARD_RTTI(BRepMesh_FastDiscretFace)
fc9b36d6 60
ceb418e1 61private:
fc9b36d6 62
ceb418e1 63 void add(const TopoDS_Vertex& theVertex);
fc9b36d6 64
848fa7e3 65 Standard_Real control(BRepMesh::ListOfVertex& theNewVertices,
66 BRepMesh_Delaun& theMeshBuilder,
67 const Standard_Boolean theIsFirst);
fc9b36d6 68
ceb418e1 69 //! Registers the given nodes in mesh data structure and
70 //! performs refinement of existing mesh.
71 //! @param theVertices nodes to be inserted.
72 //! @param theMeshBuilder initialized tool refining mesh
73 //! in respect to inserting nodes.
74 //! @return TRUE if vertices were been inserted, FALSE elewhere.
75 Standard_Boolean addVerticesToMesh(
848fa7e3 76 const BRepMesh::ListOfVertex& theVertices,
77 BRepMesh_Delaun& theMeshBuilder);
ceb418e1 78
79 //! Calculates nodes lying on face's surface and inserts them to a mesh.
80 //! @param theNewVertices list of vertices to be extended and added to mesh.
81 //! @param theMeshBuilder initialized tool refining mesh
82 //! in respect to inserting nodes.
848fa7e3 83 void insertInternalVertices(BRepMesh::ListOfVertex& theNewVertices,
84 BRepMesh_Delaun& theMeshBuilder);
ceb418e1 85
86 //! Calculates nodes lying on spherical surface.
87 //! @param theNewVertices list of vertices to be extended and added to mesh.
848fa7e3 88 void insertInternalVerticesSphere(BRepMesh::ListOfVertex& theNewVertices);
ceb418e1 89
90 //! Calculates nodes lying on cylindrical surface.
91 //! @param theNewVertices list of vertices to be extended and added to mesh.
848fa7e3 92 void insertInternalVerticesCylinder(BRepMesh::ListOfVertex& theNewVertices);
ceb418e1 93
94 //! Calculates nodes lying on conical surface.
95 //! @param theNewVertices list of vertices to be extended and added to mesh.
848fa7e3 96 void insertInternalVerticesCone(BRepMesh::ListOfVertex& theNewVertices);
ceb418e1 97
98 //! Calculates nodes lying on toroidal surface.
99 //! @param theNewVertices list of vertices to be extended and added to mesh.
848fa7e3 100 void insertInternalVerticesTorus(BRepMesh::ListOfVertex& theNewVertices);
ceb418e1 101
102 //! Calculates nodes lying on Bezier/BSpline surface.
103 //! @param theNewVertices list of vertices to be extended and added to mesh.
848fa7e3 104 void insertInternalVerticesBSpline(BRepMesh::ListOfVertex& theNewVertices);
ceb418e1 105
106 //! Calculates nodes lying on custom-type surface.
107 //! @param theNewVertices list of vertices to be extended and added to mesh.
848fa7e3 108 void insertInternalVerticesOther(BRepMesh::ListOfVertex& theNewVertices);
fc9b36d6 109
ceb418e1 110 //! Template method trying to insert new internal vertex corresponded to
111 //! the given 2d point. Calculates 3d position analytically using the given
112 //! surface.
113 //! @param thePnt2d 2d point to be inserted to the list.
114 //! @param theAnalyticSurface analytic surface to calculate 3d point.
115 //! @param[out] theVertices list of vertices to be updated.
116 template<class AnalyticSurface>
848fa7e3 117 void tryToInsertAnalyticVertex(const gp_Pnt2d& thePnt2d,
118 const AnalyticSurface& theAnalyticSurface,
119 BRepMesh::ListOfVertex& theVertices)
ceb418e1 120 {
121 if (!myClassifier->Perform(thePnt2d) == TopAbs_IN)
122 return;
123
124 gp_Pnt aPnt;
125 ElSLib::D0(thePnt2d.X(), thePnt2d.Y(), theAnalyticSurface, aPnt);
126 insertVertex(aPnt, thePnt2d.Coord(), theVertices);
127 }
128
129 //! Creates new vertex with the given parameters.
130 //! @param thePnt3d 3d point corresponded to the vertex.
131 //! @param theUV UV point corresponded to the vertex.
132 //! @param[out] theVertices list of vertices to be updated.
848fa7e3 133 void insertVertex(const gp_Pnt& thePnt3d,
134 const gp_XY& theUV,
135 BRepMesh::ListOfVertex& theVertices);
fc9b36d6 136
137private:
ceb418e1 138
848fa7e3 139 Standard_Real myAngle;
140 Standard_Boolean myWithShare;
141 Standard_Boolean myInternalVerticesMode;
142 BRepMesh::IMapOfReal myUParam;
143 BRepMesh::IMapOfReal myVParam;
144 Handle(NCollection_IncAllocator) myAllocator;
ceb418e1 145
146 // Fast access to attributes of current face
848fa7e3 147 Handle(BRepMesh_FaceAttribute) myAttribute;
148 Handle(BRepMesh_DataStructureOfDelaun) myStructure;
149 BRepMesh::HIMapOfInteger myVertexEdgeMap;
150 BRepMesh::HClassifier myClassifier;
151 BRepMesh::HDMapOfIntegerPnt mySurfacePoints;
fc9b36d6 152};
153
154DEFINE_STANDARD_HANDLE (BRepMesh_FastDiscretFace, Standard_Transient)
155
156#endif