1 -- Created on: 1996-02-27
2 -- Created by: Laurent PAINNOT
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class FastDiscret from BRepMesh inherits TShared from MMgt
19 ---Purpose: Algorithm to mesh a shape with respect of the
20 -- frontier the deflection and by option the shared
24 uses Boolean from Standard,
25 Integer from Standard,
31 FaceAttribute from BRepMesh,
33 Triangle from BRepMesh,
36 ListOfInteger from TColStd,
37 MapOfInteger from TColStd,
38 SequenceOfInteger from TColStd,
39 ListOfReal from TColStd,
40 IndexedMapOfInteger from TColStd,
41 SequenceOfPnt2d from TColgp,
46 DataMapOfIntegerPnt from BRepMesh,
47 DataMapOfIntegerListOfXY from BRepMesh,
48 DataMapOfShapePairOfPolygon from BRepMesh,
50 DataMapOfVertexInteger from BRepMesh,
51 DataStructureOfDelaun from BRepMesh,
52 ListOfVertex from BRepMesh,
53 MapOfShape from TopTools,
54 HSurface from BRepAdaptor,
55 ClassifierPtr from BRepMesh,
56 IndexedMapOfReal from TColStd,
58 DataMapOfShapeReal from TopTools,
59 ListOfShape from TopTools,
61 MapOfInteger from BRepMesh,
62 BaseAllocator from BRepMesh,
63 DataMapOfFaceAttribute from BRepMesh,
64 IndexedDataMapOfShapeListOfShape from TopTools,
65 MutexForShapeProvider from TopTools,
70 Create (defle : Real from Standard;
71 angle : Real from Standard;
73 withShare : Boolean from Standard=Standard_True;
74 inshape : Boolean from Standard=Standard_False;
75 relative : Boolean from Standard=Standard_False;
76 shapetrigu : Boolean from Standard=Standard_False;
77 isInParallel: Boolean from Standard=Standard_False)
78 returns FastDiscret from BRepMesh;
81 Create (defle : Real from Standard;
82 shape : Shape from TopoDS;
84 angle : Real from Standard;
85 withShare : Boolean from Standard=Standard_True;
86 inshape : Boolean from Standard=Standard_False;
87 relative : Boolean from Standard=Standard_False;
88 shapetrigu : Boolean from Standard=Standard_False;
89 isInParallel: Boolean from Standard=Standard_False)
90 ---Purpose: if the boolean <relative> is True, the
91 -- deflection used for the polygonalisation of
92 -- each edge will be <defle> * Size of Edge.
93 -- the deflection used for the faces will be the maximum
94 -- deflection of their edges.
96 -- if <shapetrigu> is True, the triangulation, if exists
97 -- with a correct deflection, can be used to re-triangulate
100 -- if <inshape> is True, the calculated
101 -- triangulation will be stored in the shape.
102 returns FastDiscret from BRepMesh;
105 Perform (me: mutable; shape: Shape from TopoDS) is static;
106 ---Purpose: Build triangulation on the whole shape
108 Add (me: mutable; face: Face from TopoDS;
109 ancestor : IndexedDataMapOfShapeListOfShape from TopTools) is static;
110 ---Purpose: Record a face for further processing.
112 Process (me; face: Face from TopoDS) is static;
113 ---Purpose: Triangulate a face previously recorded for
114 -- processing by call to Add(). Can be executed in
116 ---C++: alias operator ()
118 CurrentFaceStatus(me)
119 returns Status from BRepMesh;
122 edge : Edge from TopoDS;
123 face : Face from TopoDS;
124 S : HSurface from BRepAdaptor;
125 C : Curve from Geom2d;
126 ancestor : IndexedDataMapOfShapeListOfShape from TopTools;
127 defedge: Real from Standard;
128 first : Real from Standard;
129 last : Real from Standard)
133 theVert: Vertex from TopoDS;
134 face : Face from TopoDS;
135 S : HSurface from BRepAdaptor) is private;
138 Edge : Edge from TopoDS;
139 Face : Face from TopoDS;
140 C : Curve from Geom2d;
141 defedge: Real from Standard;
142 first : Real from Standard;
143 last : Real from Standard)
144 returns Boolean is private;
146 RelativeEdgeDeflection(myclass;
147 edge : Edge from TopoDS;
148 defle : Real from Standard;
149 dtotale : Real from Standard;
150 cdef : out Real from Standard)
151 ---Purpose: Returns computed relative deflection for edge
152 returns Real from Standard;
154 BoxMaxDimension(myclass;
155 box : in Box from Bnd;
156 maxdim : out Real from Standard);
157 ---Purpose: Returns the maximal dimension of Bnd_Box
161 caro : HSurface from BRepAdaptor;
162 inter : in out ListOfVertex from BRepMesh;
163 defedge : Real from Standard;
164 classifier : ClassifierPtr from BRepMesh)
168 Control (me : mutable;
169 caro : HSurface from BRepAdaptor;
170 defface : Real from Standard;
171 inter : in out ListOfVertex from BRepMesh;
172 badTri : in out ListOfInteger from TColStd;
173 nulTri : in out ListOfInteger from TColStd;
174 trigu : in out Delaun from BRepMesh;
175 isfirst : Boolean from Standard)
176 returns Real from Standard is static private;
178 AddInShape(me: mutable;
179 face : Face from TopoDS;
180 defedge: Real from Standard)
183 SetParallel ( me : mutable;
184 theInParallel : Boolean from Standard);
186 -- Request algorithm to launch in multiple threads
187 -- to improve performance (should be supported by plugin).
190 returns Boolean from Standard;
192 -- Returns the multi-threading usage flag.
194 CreateMutexesForSubShapes(me : mutable;
195 theShape : Shape from TopoDS;
196 theType : ShapeEnum from TopAbs);
198 -- Creates mutexes for each sub-shape of type theType in theShape.
199 -- Used to avoid data races.
201 RemoveAllMutexes(me: mutable);
203 -- Removes all created mutexes
209 ---Purpose: Gives the number of built triangles.
210 returns Integer from Standard
214 Index : Integer from Standard)
215 ---Purpose: Gives the triangle of <Index>.
216 ---C++: return const &
217 returns Triangle from BRepMesh
222 ---Purpose: Gives the number of built Edges
223 returns Integer from Standard
227 Index : Integer from Standard)
228 ---Purpose: Gives the edge of index <Index>.
229 ---C++: return const &
230 returns Edge from BRepMesh
234 ---Purpose: Gives the number of built Vertices.
235 returns Integer from Standard
239 Index : Integer from Standard)
240 ---Purpose: Gives the vertex of <Index>.
241 ---C++: return const &
242 returns Vertex from BRepMesh
246 Index : Integer from Standard)
247 ---Purpose: Gives the location3d of the vertex of <Index>.
248 ---C++: return const &
253 (me; Indices : in out MapOfInteger from BRepMesh)
254 ---Purpose: Gives the list of indices of the vertices
259 (me; Indices : in out MapOfInteger from BRepMesh)
260 ---Purpose: Gives the list of indices of the edges
265 TrianglesOfDomain(me; Indices: in out MapOfInteger from BRepMesh)
266 ---Purpose: Gives the list of indices of the triangles
272 ---Purpose: Gives the number of different location in 3d
273 -- space. It is different of the number of
274 -- vertices if there is more than one surface.
275 -- Even for one surface, the number can be different
276 -- if an edge is shared.
278 returns Integer from Standard
282 Index : Integer from Standard)
283 ---Purpose: Gives the 3d space location of the vertex <Index>.
284 ---C++: return const &
291 ---Purpose: returns the deflection value.
293 returns Real from Standard;
296 ---Purpose: returns the deflection value.
298 returns Real from Standard;
302 returns Boolean from Standard;
306 returns Boolean from Standard;
310 returns Boolean from Standard;
313 face : Face from TopoDS;
314 fattrib : in out FaceAttribute from BRepMesh)
315 ---Purpose: returns the face deflection value.
316 returns Boolean from Standard;
318 RemoveFaceAttribute(me : mutable;
319 face : Face from TopoDS);
320 ---Purpose: remove face attribute as useless to free locate memory
323 ---C++: return const &
325 returns DataMapOfShapeReal from TopTools;
328 myAngle : Real from Standard;
329 myDeflection : Real from Standard;
330 myDtotale : Real from Standard;
331 myWithShare : Boolean from Standard;
332 myInParallel : Boolean from Standard;
333 myVertices : DataMapOfVertexInteger from BRepMesh;
334 myEdges : DataMapOfShapePairOfPolygon from BRepMesh;
335 myInternaledges: DataMapOfShapePairOfPolygon from BRepMesh;
336 myNbLocat : Integer from Standard;
337 myLocation3d : DataMapOfIntegerPnt from BRepMesh;
338 myStructure : DataStructureOfDelaun from BRepMesh;
339 myMapattrib : DataMapOfFaceAttribute from BRepMesh;
340 myVemap : IndexedMapOfInteger from TColStd;
341 myLocation2d : DataMapOfIntegerListOfXY from BRepMesh;
342 myRelative : Boolean from Standard;
343 myShapetrigu : Boolean from Standard;
344 myInshape : Boolean from Standard;
345 myFacestate : Status from BRepMesh;
346 myMapdefle : DataMapOfShapeReal from TopTools;
347 myNottriangulated : ListOfShape from TopTools;
348 myAllocator : BaseAllocator from BRepMesh;
349 myMutexProvider: MutexForShapeProvider from TopTools;