Commit | Line | Data |
---|---|---|
b311480e | 1 | -- Created on: 1996-02-27 |
2 | -- Created by: Laurent PAINNOT | |
3 | -- Copyright (c) 1996-1999 Matra Datavision | |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS | |
5 | -- | |
6 | -- The content of this file is subject to the Open CASCADE Technology Public | |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file | |
8 | -- except in compliance with the License. Please obtain a copy of the License | |
9 | -- at http://www.opencascade.org and read it completely before using this file. | |
10 | -- | |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its | |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. | |
13 | -- | |
14 | -- The Original Code and all software distributed under the License is | |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the | |
16 | -- Initial Developer hereby disclaims all such warranties, including without | |
17 | -- limitation, any warranties of merchantability, fitness for a particular | |
18 | -- purpose or non-infringement. Please see the License for the specific terms | |
19 | -- and conditions governing the rights and limitations under the License. | |
20 | ||
7fd59977 | 21 | |
22 | ||
23 | class FastDiscret from BRepMesh inherits TShared from MMgt | |
24 | ||
703a6abd O |
25 | ---Purpose: Algorithm to mesh a shape with respect of the |
26 | -- frontier the deflection and by option the shared | |
27 | -- components. | |
7fd59977 | 28 | |
29 | ||
30 | uses Boolean from Standard, | |
703a6abd O |
31 | Integer from Standard, |
32 | Box from Bnd, | |
33 | Real from Standard, | |
34 | Shape from TopoDS, | |
35 | Face from TopoDS, | |
36 | Edge from TopoDS, | |
37 | FaceAttribute from BRepMesh, | |
38 | Vertex from TopoDS, | |
39 | Triangle from BRepMesh, | |
40 | Vertex from BRepMesh, | |
41 | Edge from BRepMesh, | |
42 | ListOfInteger from TColStd, | |
43 | MapOfInteger from TColStd, | |
44 | SequenceOfInteger from TColStd, | |
45 | ListOfReal from TColStd, | |
46 | IndexedMapOfInteger from TColStd, | |
47 | SequenceOfPnt2d from TColgp, | |
48 | Dir from gp, | |
49 | Pnt from gp, | |
7fd59977 | 50 | XY from gp, |
703a6abd O |
51 | Pnt2d from gp, |
52 | DataMapOfIntegerPnt from BRepMesh, | |
53 | DataMapOfIntegerListOfXY from BRepMesh, | |
54 | DataMapOfShapePairOfPolygon from BRepMesh, | |
55 | Delaun from BRepMesh, | |
56 | DataMapOfVertexInteger from BRepMesh, | |
57 | DataStructureOfDelaun from BRepMesh, | |
58 | ListOfVertex from BRepMesh, | |
59 | MapOfShape from TopTools, | |
60 | HSurface from BRepAdaptor, | |
61 | ClassifierPtr from BRepMesh, | |
7fd59977 | 62 | IndexedMapOfReal from TColStd, |
703a6abd O |
63 | Status from BRepMesh, |
64 | DataMapOfShapeReal from TopTools, | |
65 | ListOfShape from TopTools, | |
66 | Curve from Geom2d, | |
0d88155b O |
67 | MapOfInteger from BRepMesh, |
68 | BaseAllocator from BRepMesh, | |
0d36f7e4 O |
69 | DataMapOfFaceAttribute from BRepMesh, |
70 | IndexedDataMapOfShapeListOfShape from TopTools | |
703a6abd O |
71 | |
72 | ||
73 | is | |
74 | ||
75 | Create (defle : Real from Standard; | |
76 | angle : Real from Standard; | |
77 | B : Box from Bnd; | |
78 | withShare : Boolean from Standard=Standard_True; | |
79 | inshape : Boolean from Standard=Standard_False; | |
80 | relative : Boolean from Standard=Standard_False; | |
81 | shapetrigu: Boolean from Standard=Standard_False) | |
82 | returns mutable FastDiscret from BRepMesh; | |
7fd59977 | 83 | |
7fd59977 | 84 | |
85 | Create (defle : Real from Standard; | |
703a6abd O |
86 | shape : Shape from TopoDS; |
87 | B : Box from Bnd; | |
88 | angle : Real from Standard; | |
89 | withShare : Boolean from Standard=Standard_True; | |
90 | inshape : Boolean from Standard=Standard_False; | |
91 | relative : Boolean from Standard=Standard_False; | |
92 | shapetrigu: Boolean from Standard=Standard_False) | |
93 | ---Purpose: if the boolean <relative> is True, the | |
94 | -- deflection used for the polygonalisation of | |
95 | -- each edge will be <defle> * Size of Edge. | |
96 | -- the deflection used for the faces will be the maximum | |
97 | -- deflection of their edges. | |
98 | -- | |
99 | -- if <shapetrigu> is True, the triangulation, if exists | |
100 | -- with a correct deflection, can be used to re-triangulate | |
101 | -- the shape. | |
102 | -- | |
103 | -- if <inshape> is True, the calculated | |
104 | -- triangulation will be stored in the shape. | |
105 | returns mutable FastDiscret from BRepMesh; | |
106 | ||
107 | ||
108 | Perform (me: mutable; shape: Shape from TopoDS) is static; | |
109 | ---Purpose: Build triangulation on the whole shape | |
110 | ||
0d36f7e4 O |
111 | Add (me: mutable; face: Face from TopoDS; |
112 | ancestor : IndexedDataMapOfShapeListOfShape from TopTools) is static; | |
703a6abd O |
113 | ---Purpose: Record a face for further processing. |
114 | ||
115 | Process (me; face: Face from TopoDS) is static; | |
116 | ---Purpose: Triangulate a face previously recorded for | |
117 | -- processing by call to Add(). Can be executed in | |
118 | -- parallel threads. | |
119 | ---C++: alias operator () | |
120 | ||
121 | CurrentFaceStatus(me) | |
122 | returns Status from BRepMesh; | |
123 | ||
124 | Add (me : mutable; | |
125 | edge : Edge from TopoDS; | |
126 | face : Face from TopoDS; | |
127 | S : HSurface from BRepAdaptor; | |
128 | C : Curve from Geom2d; | |
0d36f7e4 | 129 | ancestor : IndexedDataMapOfShapeListOfShape from TopTools; |
703a6abd | 130 | defedge: Real from Standard; |
7fd59977 | 131 | first : Real from Standard; |
132 | last : Real from Standard) | |
703a6abd O |
133 | is static private; |
134 | ||
135 | Add (me : mutable; | |
7fd59977 | 136 | theVert: Vertex from TopoDS; |
703a6abd O |
137 | face : Face from TopoDS; |
138 | S : HSurface from BRepAdaptor) is private; | |
7fd59977 | 139 | |
703a6abd O |
140 | Update (me: mutable; |
141 | Edge : Edge from TopoDS; | |
142 | Face : Face from TopoDS; | |
7fd59977 | 143 | C : Curve from Geom2d; |
703a6abd O |
144 | defedge: Real from Standard; |
145 | first : Real from Standard; | |
146 | last : Real from Standard) | |
147 | returns Boolean is private; | |
148 | ||
2b59653e E |
149 | RelativeEdgeDeflection(myclass; |
150 | edge : Edge from TopoDS; | |
151 | defle : Real from Standard; | |
152 | dtotale : Real from Standard; | |
153 | cdef : out Real from Standard) | |
154 | ---Purpose: Returns computed relative deflection for edge | |
155 | returns Real from Standard; | |
156 | ||
157 | BoxMaxDimension(myclass; | |
158 | box : in Box from Bnd; | |
159 | maxdim : out Real from Standard); | |
160 | ---Purpose: Returns the maximal dimension of Bnd_Box | |
703a6abd O |
161 | |
162 | InternalVertices | |
163 | (me : mutable; | |
164 | caro : HSurface from BRepAdaptor; | |
165 | inter : in out ListOfVertex from BRepMesh; | |
166 | defedge : Real from Standard; | |
167 | classifier : ClassifierPtr from BRepMesh) | |
168 | is static private; | |
169 | ||
170 | ||
171 | Control (me : mutable; | |
172 | caro : HSurface from BRepAdaptor; | |
173 | defface : Real from Standard; | |
174 | inter : in out ListOfVertex from BRepMesh; | |
175 | badTri : in out ListOfInteger from TColStd; | |
176 | nulTri : in out ListOfInteger from TColStd; | |
177 | trigu : in out Delaun from BRepMesh; | |
178 | isfirst : Boolean from Standard) | |
179 | returns Real from Standard is static private; | |
180 | ||
181 | AddInShape(me: mutable; | |
182 | face : Face from TopoDS; | |
183 | defedge: Real from Standard) | |
184 | is static private; | |
7fd59977 | 185 | |
0b97567d K |
186 | SetParallel ( me : mutable; |
187 | theInParallel : Boolean from Standard); | |
188 | ---Purpose: | |
189 | -- Request algorithm to launch in multiple threads | |
190 | -- to improve performance (should be supported by plugin). | |
191 | ||
192 | IsParallel (me) | |
193 | returns Boolean from Standard; | |
194 | ---Purpose: | |
195 | -- Returns the multi-threading usage flag. | |
7fd59977 | 196 | |
197 | -- Output : | |
198 | ||
199 | ||
703a6abd O |
200 | NbTriangles(me) |
201 | ---Purpose: Gives the number of built triangles. | |
202 | returns Integer from Standard | |
203 | is static; | |
204 | ||
205 | Triangle (me; | |
206 | Index : Integer from Standard) | |
207 | ---Purpose: Gives the triangle of <Index>. | |
208 | ---C++: return const & | |
209 | returns Triangle from BRepMesh | |
210 | is static; | |
211 | ||
7fd59977 | 212 | |
703a6abd O |
213 | NbEdges (me) |
214 | ---Purpose: Gives the number of built Edges | |
215 | returns Integer from Standard | |
216 | is static; | |
7fd59977 | 217 | |
703a6abd O |
218 | Edge (me; |
219 | Index : Integer from Standard) | |
220 | ---Purpose: Gives the edge of index <Index>. | |
221 | ---C++: return const & | |
222 | returns Edge from BRepMesh | |
223 | is static; | |
7fd59977 | 224 | |
703a6abd O |
225 | NbVertices (me) |
226 | ---Purpose: Gives the number of built Vertices. | |
227 | returns Integer from Standard | |
228 | is static; | |
7fd59977 | 229 | |
703a6abd O |
230 | Vertex (me; |
231 | Index : Integer from Standard) | |
232 | ---Purpose: Gives the vertex of <Index>. | |
233 | ---C++: return const & | |
234 | returns Vertex from BRepMesh | |
235 | is static; | |
7fd59977 | 236 | |
703a6abd O |
237 | Pnt (me; |
238 | Index : Integer from Standard) | |
239 | ---Purpose: Gives the location3d of the vertex of <Index>. | |
240 | ---C++: return const & | |
241 | returns Pnt from gp | |
242 | is static; | |
7fd59977 | 243 | |
703a6abd | 244 | VerticesOfDomain |
0d88155b | 245 | (me; Indices : in out MapOfInteger from BRepMesh) |
703a6abd O |
246 | ---Purpose: Gives the list of indices of the vertices |
247 | is static; | |
7fd59977 | 248 | |
7fd59977 | 249 | |
703a6abd | 250 | EdgesOfDomain |
0d88155b | 251 | (me; Indices : in out MapOfInteger from BRepMesh) |
703a6abd O |
252 | ---Purpose: Gives the list of indices of the edges |
253 | ---C++: inline | |
254 | is static; | |
7fd59977 | 255 | |
7fd59977 | 256 | |
0d88155b | 257 | TrianglesOfDomain(me; Indices: in out MapOfInteger from BRepMesh) |
703a6abd O |
258 | ---Purpose: Gives the list of indices of the triangles |
259 | ---C++: inline | |
260 | is static; | |
7fd59977 | 261 | |
7fd59977 | 262 | |
703a6abd O |
263 | NbPoint3d (me) |
264 | ---Purpose: Gives the number of different location in 3d | |
265 | -- space. It is different of the number of | |
266 | -- vertices if there is more than one surface. | |
267 | -- Even for one surface, the number can be different | |
268 | -- if an edge is shared. | |
269 | ---C++: inline | |
270 | returns Integer from Standard | |
271 | is static; | |
7fd59977 | 272 | |
703a6abd O |
273 | Point3d (me; |
274 | Index : Integer from Standard) | |
275 | ---Purpose: Gives the 3d space location of the vertex <Index>. | |
276 | ---C++: return const & | |
277 | ---C++: inline | |
278 | returns Pnt from gp | |
7fd59977 | 279 | is static; |
703a6abd O |
280 | |
281 | ||
282 | GetDeflection(me) | |
283 | ---Purpose: returns the deflection value. | |
284 | ---C++: inline | |
285 | returns Real from Standard; | |
286 | ||
287 | GetAngle(me) | |
288 | ---Purpose: returns the deflection value. | |
289 | ---C++: inline | |
290 | returns Real from Standard; | |
291 | ||
292 | WithShare(me) | |
293 | ---C++: inline | |
294 | returns Boolean from Standard; | |
295 | ||
296 | InShape(me) | |
297 | ---C++: inline | |
298 | returns Boolean from Standard; | |
299 | ||
7fd59977 | 300 | ShapeTrigu(me) |
703a6abd O |
301 | ---C++: inline |
302 | returns Boolean from Standard; | |
303 | ||
304 | GetFaceAttribute(me; | |
305 | face : Face from TopoDS; | |
306 | fattrib : in out FaceAttribute from BRepMesh) | |
307 | ---Purpose: returns the face deflection value. | |
308 | returns Boolean from Standard; | |
309 | ||
310 | RemoveFaceAttribute(me : mutable; | |
311 | face : Face from TopoDS); | |
312 | ---Purpose: remove face attribute as useless to free locate memory | |
313 | ||
7fd59977 | 314 | GetMapOfDefEdge(me) |
703a6abd O |
315 | ---C++: return const & |
316 | ---C++: inline | |
317 | returns DataMapOfShapeReal from TopTools; | |
318 | ||
7fd59977 | 319 | fields |
703a6abd O |
320 | myAngle : Real from Standard; |
321 | myDeflection : Real from Standard; | |
322 | myDtotale : Real from Standard; | |
323 | myWithShare : Boolean from Standard; | |
0b97567d | 324 | myInParallel : Boolean from Standard; |
703a6abd O |
325 | myVertices : DataMapOfVertexInteger from BRepMesh; |
326 | myEdges : DataMapOfShapePairOfPolygon from BRepMesh; | |
327 | myInternaledges: DataMapOfShapePairOfPolygon from BRepMesh; | |
328 | myNbLocat : Integer from Standard; | |
329 | myLocation3d : DataMapOfIntegerPnt from BRepMesh; | |
330 | myStructure : DataStructureOfDelaun from BRepMesh; | |
331 | myMapattrib : DataMapOfFaceAttribute from BRepMesh; | |
332 | myVemap : IndexedMapOfInteger from TColStd; | |
333 | myLocation2d : DataMapOfIntegerListOfXY from BRepMesh; | |
334 | myRelative : Boolean from Standard; | |
335 | myShapetrigu : Boolean from Standard; | |
336 | myInshape : Boolean from Standard; | |
337 | myFacestate : Status from BRepMesh; | |
338 | myMapdefle : DataMapOfShapeReal from TopTools; | |
339 | myNottriangulated : ListOfShape from TopTools; | |
0d88155b | 340 | myAllocator : BaseAllocator from BRepMesh; |
703a6abd | 341 | |
7fd59977 | 342 | end FastDiscret; |