Commit | Line | Data |
---|---|---|
b311480e | 1 | -- Created on: 1996-02-27 |
2 | -- Created by: Laurent PAINNOT | |
3 | -- Copyright (c) 1996-1999 Matra Datavision | |
973c2be1 | 4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e | 5 | -- |
973c2be1 | 6 | -- This file is part of Open CASCADE Technology software library. |
b311480e | 7 | -- |
d5f74e42 | 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 | |
973c2be1 | 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. | |
b311480e | 13 | -- |
973c2be1 | 14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. | |
7fd59977 | 16 | |
17 | class FastDiscret from BRepMesh inherits TShared from MMgt | |
18 | ||
703a6abd O |
19 | ---Purpose: Algorithm to mesh a shape with respect of the |
20 | -- frontier the deflection and by option the shared | |
21 | -- components. | |
7fd59977 | 22 | |
23 | ||
24 | uses Boolean from Standard, | |
703a6abd O |
25 | Integer from Standard, |
26 | Box from Bnd, | |
27 | Real from Standard, | |
28 | Shape from TopoDS, | |
29 | Face from TopoDS, | |
30 | Edge from TopoDS, | |
31 | FaceAttribute from BRepMesh, | |
32 | Vertex from TopoDS, | |
33 | Triangle from BRepMesh, | |
34 | Vertex from BRepMesh, | |
35 | Edge 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, | |
42 | Dir from gp, | |
43 | Pnt from gp, | |
7fd59977 | 44 | XY from gp, |
703a6abd O |
45 | Pnt2d from gp, |
46 | DataMapOfIntegerPnt from BRepMesh, | |
47 | DataMapOfIntegerListOfXY from BRepMesh, | |
48 | DataMapOfShapePairOfPolygon from BRepMesh, | |
49 | Delaun 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, | |
7fd59977 | 56 | IndexedMapOfReal from TColStd, |
703a6abd O |
57 | Status from BRepMesh, |
58 | DataMapOfShapeReal from TopTools, | |
59 | ListOfShape from TopTools, | |
60 | Curve from Geom2d, | |
0d88155b O |
61 | MapOfInteger from BRepMesh, |
62 | BaseAllocator from BRepMesh, | |
0d36f7e4 | 63 | DataMapOfFaceAttribute from BRepMesh, |
d00cba63 | 64 | IndexedDataMapOfShapeListOfShape from TopTools, |
65 | MutexForShapeProvider from TopTools, | |
66 | ShapeEnum from TopAbs | |
703a6abd O |
67 | |
68 | is | |
69 | ||
01a6e62b | 70 | Create (defle : Real from Standard; |
71 | angle : Real from Standard; | |
72 | B : Box from Bnd; | |
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) | |
6e33d3ce | 78 | returns FastDiscret from BRepMesh; |
7fd59977 | 79 | |
7fd59977 | 80 | |
01a6e62b | 81 | Create (defle : Real from Standard; |
82 | shape : Shape from TopoDS; | |
83 | B : Box from Bnd; | |
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) | |
703a6abd O |
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. | |
95 | -- | |
96 | -- if <shapetrigu> is True, the triangulation, if exists | |
97 | -- with a correct deflection, can be used to re-triangulate | |
98 | -- the shape. | |
99 | -- | |
100 | -- if <inshape> is True, the calculated | |
101 | -- triangulation will be stored in the shape. | |
6e33d3ce | 102 | returns FastDiscret from BRepMesh; |
703a6abd O |
103 | |
104 | ||
105 | Perform (me: mutable; shape: Shape from TopoDS) is static; | |
106 | ---Purpose: Build triangulation on the whole shape | |
107 | ||
0d36f7e4 O |
108 | Add (me: mutable; face: Face from TopoDS; |
109 | ancestor : IndexedDataMapOfShapeListOfShape from TopTools) is static; | |
703a6abd O |
110 | ---Purpose: Record a face for further processing. |
111 | ||
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 | |
115 | -- parallel threads. | |
116 | ---C++: alias operator () | |
117 | ||
118 | CurrentFaceStatus(me) | |
119 | returns Status from BRepMesh; | |
120 | ||
121 | Add (me : mutable; | |
122 | edge : Edge from TopoDS; | |
123 | face : Face from TopoDS; | |
124 | S : HSurface from BRepAdaptor; | |
125 | C : Curve from Geom2d; | |
0d36f7e4 | 126 | ancestor : IndexedDataMapOfShapeListOfShape from TopTools; |
703a6abd | 127 | defedge: Real from Standard; |
7fd59977 | 128 | first : Real from Standard; |
129 | last : Real from Standard) | |
703a6abd O |
130 | is static private; |
131 | ||
132 | Add (me : mutable; | |
7fd59977 | 133 | theVert: Vertex from TopoDS; |
703a6abd O |
134 | face : Face from TopoDS; |
135 | S : HSurface from BRepAdaptor) is private; | |
7fd59977 | 136 | |
703a6abd O |
137 | Update (me: mutable; |
138 | Edge : Edge from TopoDS; | |
139 | Face : Face from TopoDS; | |
7fd59977 | 140 | C : Curve from Geom2d; |
703a6abd O |
141 | defedge: Real from Standard; |
142 | first : Real from Standard; | |
143 | last : Real from Standard) | |
144 | returns Boolean is private; | |
145 | ||
2b59653e E |
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; | |
153 | ||
154 | BoxMaxDimension(myclass; | |
155 | box : in Box from Bnd; | |
156 | maxdim : out Real from Standard); | |
157 | ---Purpose: Returns the maximal dimension of Bnd_Box | |
703a6abd O |
158 | |
159 | InternalVertices | |
160 | (me : mutable; | |
161 | caro : HSurface from BRepAdaptor; | |
162 | inter : in out ListOfVertex from BRepMesh; | |
163 | defedge : Real from Standard; | |
164 | classifier : ClassifierPtr from BRepMesh) | |
165 | is static private; | |
166 | ||
167 | ||
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; | |
177 | ||
178 | AddInShape(me: mutable; | |
179 | face : Face from TopoDS; | |
180 | defedge: Real from Standard) | |
181 | is static private; | |
7fd59977 | 182 | |
0b97567d K |
183 | SetParallel ( me : mutable; |
184 | theInParallel : Boolean from Standard); | |
185 | ---Purpose: | |
186 | -- Request algorithm to launch in multiple threads | |
187 | -- to improve performance (should be supported by plugin). | |
188 | ||
189 | IsParallel (me) | |
190 | returns Boolean from Standard; | |
191 | ---Purpose: | |
192 | -- Returns the multi-threading usage flag. | |
d00cba63 | 193 | |
194 | CreateMutexesForSubShapes(me : mutable; | |
195 | theShape : Shape from TopoDS; | |
196 | theType : ShapeEnum from TopAbs); | |
197 | ---Purpose: | |
198 | -- Creates mutexes for each sub-shape of type theType in theShape. | |
199 | -- Used to avoid data races. | |
200 | ||
201 | RemoveAllMutexes(me: mutable); | |
202 | ---Purpose: | |
203 | -- Removes all created mutexes | |
7fd59977 | 204 | |
205 | -- Output : | |
206 | ||
207 | ||
703a6abd O |
208 | NbTriangles(me) |
209 | ---Purpose: Gives the number of built triangles. | |
210 | returns Integer from Standard | |
211 | is static; | |
212 | ||
213 | Triangle (me; | |
214 | Index : Integer from Standard) | |
215 | ---Purpose: Gives the triangle of <Index>. | |
216 | ---C++: return const & | |
217 | returns Triangle from BRepMesh | |
218 | is static; | |
219 | ||
7fd59977 | 220 | |
703a6abd O |
221 | NbEdges (me) |
222 | ---Purpose: Gives the number of built Edges | |
223 | returns Integer from Standard | |
224 | is static; | |
7fd59977 | 225 | |
703a6abd O |
226 | Edge (me; |
227 | Index : Integer from Standard) | |
228 | ---Purpose: Gives the edge of index <Index>. | |
229 | ---C++: return const & | |
230 | returns Edge from BRepMesh | |
231 | is static; | |
7fd59977 | 232 | |
703a6abd O |
233 | NbVertices (me) |
234 | ---Purpose: Gives the number of built Vertices. | |
235 | returns Integer from Standard | |
236 | is static; | |
7fd59977 | 237 | |
703a6abd O |
238 | Vertex (me; |
239 | Index : Integer from Standard) | |
240 | ---Purpose: Gives the vertex of <Index>. | |
241 | ---C++: return const & | |
242 | returns Vertex from BRepMesh | |
243 | is static; | |
7fd59977 | 244 | |
703a6abd O |
245 | Pnt (me; |
246 | Index : Integer from Standard) | |
247 | ---Purpose: Gives the location3d of the vertex of <Index>. | |
248 | ---C++: return const & | |
249 | returns Pnt from gp | |
250 | is static; | |
7fd59977 | 251 | |
703a6abd | 252 | VerticesOfDomain |
0d88155b | 253 | (me; Indices : in out MapOfInteger from BRepMesh) |
703a6abd O |
254 | ---Purpose: Gives the list of indices of the vertices |
255 | is static; | |
7fd59977 | 256 | |
7fd59977 | 257 | |
703a6abd | 258 | EdgesOfDomain |
0d88155b | 259 | (me; Indices : in out MapOfInteger from BRepMesh) |
703a6abd O |
260 | ---Purpose: Gives the list of indices of the edges |
261 | ---C++: inline | |
262 | is static; | |
7fd59977 | 263 | |
7fd59977 | 264 | |
0d88155b | 265 | TrianglesOfDomain(me; Indices: in out MapOfInteger from BRepMesh) |
703a6abd O |
266 | ---Purpose: Gives the list of indices of the triangles |
267 | ---C++: inline | |
268 | is static; | |
7fd59977 | 269 | |
7fd59977 | 270 | |
703a6abd O |
271 | NbPoint3d (me) |
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. | |
277 | ---C++: inline | |
278 | returns Integer from Standard | |
279 | is static; | |
7fd59977 | 280 | |
703a6abd O |
281 | Point3d (me; |
282 | Index : Integer from Standard) | |
283 | ---Purpose: Gives the 3d space location of the vertex <Index>. | |
284 | ---C++: return const & | |
285 | ---C++: inline | |
286 | returns Pnt from gp | |
7fd59977 | 287 | is static; |
703a6abd O |
288 | |
289 | ||
290 | GetDeflection(me) | |
291 | ---Purpose: returns the deflection value. | |
292 | ---C++: inline | |
293 | returns Real from Standard; | |
294 | ||
295 | GetAngle(me) | |
296 | ---Purpose: returns the deflection value. | |
297 | ---C++: inline | |
298 | returns Real from Standard; | |
299 | ||
300 | WithShare(me) | |
301 | ---C++: inline | |
302 | returns Boolean from Standard; | |
303 | ||
304 | InShape(me) | |
305 | ---C++: inline | |
306 | returns Boolean from Standard; | |
307 | ||
7fd59977 | 308 | ShapeTrigu(me) |
703a6abd O |
309 | ---C++: inline |
310 | returns Boolean from Standard; | |
311 | ||
312 | GetFaceAttribute(me; | |
313 | face : Face from TopoDS; | |
314 | fattrib : in out FaceAttribute from BRepMesh) | |
315 | ---Purpose: returns the face deflection value. | |
316 | returns Boolean from Standard; | |
317 | ||
318 | RemoveFaceAttribute(me : mutable; | |
319 | face : Face from TopoDS); | |
320 | ---Purpose: remove face attribute as useless to free locate memory | |
321 | ||
7fd59977 | 322 | GetMapOfDefEdge(me) |
703a6abd O |
323 | ---C++: return const & |
324 | ---C++: inline | |
325 | returns DataMapOfShapeReal from TopTools; | |
326 | ||
7fd59977 | 327 | fields |
703a6abd O |
328 | myAngle : Real from Standard; |
329 | myDeflection : Real from Standard; | |
330 | myDtotale : Real from Standard; | |
331 | myWithShare : Boolean from Standard; | |
0b97567d | 332 | myInParallel : Boolean from Standard; |
703a6abd O |
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; | |
0d88155b | 348 | myAllocator : BaseAllocator from BRepMesh; |
d00cba63 | 349 | myMutexProvider: MutexForShapeProvider from TopTools; |
703a6abd | 350 | |
7fd59977 | 351 | end FastDiscret; |