0023614: BRepMesh creates incorrect triangulation on the attached models
[occt.git] / src / BRepMesh / BRepMesh_Delaun.cdl
CommitLineData
b311480e 1-- Created on: 1993-05-11
2-- Created by: Didier PIFFAULT
3-- Copyright (c) 1993-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
21
0d88155b
O
22
23class Delaun from BRepMesh
24
25 ---Purpose: Compute the Delaunay's triangulation with the
26 -- algorithm of Watson.
27
28
29 uses Integer from Standard,
30 SequenceOfInteger from TColStd,
90dc2e5b 31 MapOfInteger from TColStd,
0d88155b
O
32 Array1OfInteger from TColStd,
33 Box2d from Bnd,
34 CircleTool from BRepMesh,
35 MapOfInteger from BRepMesh,
36 DataStructureOfDelaun from BRepMesh,
37 MapOfIntegerInteger from BRepMesh,
38 Vertex from BRepMesh,
39 Edge from BRepMesh,
40 Triangle from BRepMesh,
41 ComparatorOfVertexOfDelaun from BRepMesh,
42 ComparatorOfIndexedVertexOfDelaun from BRepMesh,
43 Array1OfVertexOfDelaun from BRepMesh,
44 HArray1OfVertexOfDelaun from BRepMesh,
45 HeapSortVertexOfDelaun from BRepMesh,
46 HeapSortIndexedVertexOfDelaun from BRepMesh
47
48
49 is
50 -- Interface :
51
2b59653e
E
52 Create (Vertices : in out Array1OfVertexOfDelaun from BRepMesh;
53 ZPositive : in Boolean from Standard=Standard_True)
0d88155b
O
54 ---Purpose: Creates the triangulation with an empty Mesh
55 -- data structure.
56 returns Delaun from BRepMesh;
57
58
2b59653e
E
59 Create (OldMesh : mutable DataStructureOfDelaun from BRepMesh;
60 Vertices : in out Array1OfVertexOfDelaun from BRepMesh;
61 ZPositive : in Boolean from Standard=Standard_True)
0d88155b
O
62 ---Purpose: Creates the triangulation with and existant
63 -- Mesh data structure.
64 returns Delaun from BRepMesh;
65
66
2b59653e
E
67 Create (OldMesh : mutable DataStructureOfDelaun from BRepMesh;
68 VertexIndices : in out Array1OfInteger from TColStd;
69 ZPositive : in Boolean from Standard=Standard_True)
0d88155b
O
70 ---Purpose: Creates the triangulation with and existant
71 -- Mesh data structure.
72 returns Delaun from BRepMesh;
73
74
2b59653e
E
75 RemoveVertex (me : in out;
76 theVertex : in Vertex from BRepMesh);
0d88155b
O
77 ---Purpose: Removes a vertex in the triangulation.
78
79
2b59653e
E
80 AddVertices (me : in out;
81 Vertices : in out Array1OfVertexOfDelaun from BRepMesh);
0d88155b
O
82 ---Purpose: Adds some vertices in the triangulation.
83
84
2b59653e
E
85 UseEdge (me : in out;
86 theEdge : in Integer from Standard)
0d88155b
O
87 ---Purpose: Modify mesh to use the edge. Return True if done.
88 returns Boolean from Standard;
89
90
2b59653e 91 Result (me)
0d88155b
O
92 ---C++: return const &
93 ---Purpose: Gives the Mesh data structure.
94 returns DataStructureOfDelaun from BRepMesh;
95
96
2b59653e 97 Frontier (me : in out)
0d88155b
O
98 ---Purpose: Gives the list of frontier edges
99 ---C++: return const &
100 returns MapOfInteger from BRepMesh;
101
102
2b59653e 103 InternalEdges (me : in out)
0d88155b
O
104 ---Purpose: Gives the list of internal edges
105 ---C++: return const &
106 returns MapOfInteger from BRepMesh;
107
108
2b59653e 109 FreeEdges (me : in out)
0d88155b
O
110 ---Purpose: Gives the list of free edges used only one time
111 ---C++: return const &
112 returns MapOfInteger from BRepMesh;
113
114
2b59653e
E
115 GetVertex (me;
116 vIndex : in Integer from Standard)
0d88155b
O
117 ---C++: return const &
118 ---C++: inline
119 returns Vertex from BRepMesh;
120
121
2b59653e
E
122 GetEdge (me;
123 eIndex : in Integer from Standard)
0d88155b
O
124 ---C++: return const &
125 ---C++: inline
126 returns Edge from BRepMesh;
127
128
2b59653e
E
129 GetTriangle (me;
130 tIndex : in Integer from Standard)
0d88155b
O
131 ---C++: return const &
132 ---C++: inline
133 returns Triangle from BRepMesh;
134
135
2b59653e 136 -- Implementation :
0d88155b 137
2b59653e
E
138 Init (me : in out;
139 Vertices : in out Array1OfVertexOfDelaun from BRepMesh);
140 ---Purpose: Initializes the triangulation with an Array of
0d88155b
O
141 -- Vertex.
142
143 Compute (me : in out;
144 VertexIndices : in out Array1OfInteger from TColStd);
145 ---Purpose: Computes the triangulation and add the vertices
146 -- edges and triangles to the Mesh data structure.
147
0d88155b
O
148
149 SuperMesh (me : in out;
2b59653e
E
150 theBox : Box2d from Bnd);
151 ---Purpose: Build the super mesh .
0d88155b
O
152
153
154 FrontierAdjust (me : in out)
155 ---Purpose: Adjust the mesh on the frontier.
156 is private;
157
158
2b59653e
E
159 MeshLeftPolygonOf (me : in out;
160 EdgeIndex : Integer from Standard;
161 EdgeSens : Boolean from Standard)
0d88155b
O
162 ---Purpose: Find left polygon of the edge and call MeshPolygon.
163 is private;
164
165
166 MeshPolygon (me : in out;
167 Polygon : in out SequenceOfInteger from TColStd)
168 ---Purpose: Mesh closed polygon.
169 is private;
170
171
172 CreateTriangles(me : in out;
2b59653e 173 vertexIndex : Integer from Standard;
0d88155b
O
174 --vertex : in Vertex from BRepMesh;
175 freeEdges: out MapOfIntegerInteger from BRepMesh)
176 ---Purpose: Creates the triangles beetween the node
177 -- <Vertex> and the polyline <freeEdges>.
178 is private;
179
180
181 DeleteTriangle (me : in out;
182 TrianIndex : Integer from Standard;
183 freeEdges : out MapOfIntegerInteger from BRepMesh)
184 ---Purpose: Deletes the triangle of index <TrianIndex> and
185 -- add the free edges to the map.
186 -- When an edge is suppressed more than one time
187 -- it is destroyed.
188 is private;
2b59653e
E
189
190
191 Perform (me: in out;
192 theBndBox : out Box2d from Bnd;
193 theVertexIndices: out Array1OfInteger from TColStd)
194 is private;
0d88155b
O
195
196
2b59653e
E
197 Contains (me;
198 TrianIndex : Integer from Standard;
199 theVertex : in Vertex from BRepMesh;
200 edgeOn : out Integer from Standard)
201 ---Purpose: Test if triangle of index <TrianIndex>
202 -- contains geometricaly <theVertex>. If <EdgeOn>
203 -- is != 0 then theVertex is on Edge of index
204 -- <edgeOn>.
205 returns Boolean from Standard;
206
207
208 CreateTrianglesOnNewVertices(me : in out;
209 theVertexIndices: out Array1OfInteger from TColStd)
210 --vertex : in Vertex from BRepMesh;
211 ---Purpose: Creates the triangles on new nodes
212 is private;
90dc2e5b 213
214 IntSegSeg (me : in out;
215 theEdge1 : in Edge from BRepMesh;
216 theEdge2 : in Edge from BRepMesh)
217 ---Purpose: Check intersection between the two segments.
218 returns Boolean is private;
219
220 KillInternalTriangles(me: in out;
221 theEdgeId : Integer from Standard;
222 theIgnoredEdges : in MapOfInteger from TColStd;
223 theLoopEdges : out MapOfIntegerInteger from BRepMesh)
224 ---Purpose: Removes triangles within polygon
225 is private;
226
227 CleanupMesh(me: in out)
228 ---Purpose: Cleanup mesh from the free triangles
229 is private;
230
231 RemovePivotTriangles(me: in out;
232 theEdgeInfo : Integer from Standard;
233 thePivotNode : Integer from Standard;
234 theInfectedEdges : out MapOfInteger from TColStd;
235 theLoopEdges : out MapOfIntegerInteger from BRepMesh;
236 isFirstPass : Boolean from Standard)
237 ---Purpose: Removes triangles around the given pivot node
238 is private;
239
240 CleanupPolygon(me: in out;
241 thePolygon : in SequenceOfInteger from TColStd;
242 theInfectedEdges : out MapOfInteger from TColStd;
243 theLoopEdges : out MapOfIntegerInteger from BRepMesh)
244 ---Purpose: Remove internal triangles from the given polygon
245 is private;
246
247
2b59653e 248
0d88155b 249
90dc2e5b 250 fields myMeshData : DataStructureOfDelaun from BRepMesh;
251 myPositiveOrientation : Boolean from Standard;
252 myCircles : CircleTool from BRepMesh;
253 mySupVert1 : Integer from Standard;
254 mySupVert2 : Integer from Standard;
255 mySupVert3 : Integer from Standard;
256 mySupTrian : Triangle from BRepMesh;
257 myMapEdges : MapOfInteger from BRepMesh;
0d88155b
O
258
259
260end Delaun;