42cf5bc1 |
1 | // Created on: 1998-06-03 |
2 | // Created by: data exchange team |
3 | // Copyright (c) 1998-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _ShapeAnalysis_Wire_HeaderFile |
18 | #define _ShapeAnalysis_Wire_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <TopoDS_Face.hxx> |
24 | #include <Standard_Real.hxx> |
25 | #include <Standard_Integer.hxx> |
25e59720 |
26 | #include <Standard_Transient.hxx> |
42cf5bc1 |
27 | #include <Standard_Boolean.hxx> |
28 | #include <IntRes2d_SequenceOfIntersectionPoint.hxx> |
29 | #include <TColgp_SequenceOfPnt.hxx> |
30 | #include <TColStd_SequenceOfReal.hxx> |
31 | #include <TopTools_IndexedMapOfShape.hxx> |
32 | #include <TopTools_DataMapOfShapeListOfShape.hxx> |
33 | #include <TopTools_MapOfShape.hxx> |
34 | #include <ShapeExtend_Status.hxx> |
35 | class ShapeExtend_WireData; |
36 | class ShapeAnalysis_Surface; |
37 | class TopoDS_Wire; |
42cf5bc1 |
38 | class Geom_Surface; |
39 | class TopLoc_Location; |
40 | class ShapeAnalysis_WireOrder; |
41 | class Geom2d_Curve; |
42 | class gp_Pnt2d; |
43 | class TopoDS_Shape; |
44 | class TopoDS_Edge; |
45 | |
9fd2d2c3 |
46 | // resolve name collisions with X11 headers |
47 | #ifdef Status |
48 | #undef Status |
49 | #endif |
42cf5bc1 |
50 | |
51 | class ShapeAnalysis_Wire; |
25e59720 |
52 | DEFINE_STANDARD_HANDLE(ShapeAnalysis_Wire, Standard_Transient) |
42cf5bc1 |
53 | |
54 | //! This class provides analysis of a wire to be compliant to |
55 | //! CAS.CADE requirements. |
56 | //! |
57 | //! The functionalities provided are the following: |
58 | //! 1. consistency of 2d and 3d edge curve senses |
59 | //! 2. connection of adjacent edges regarding to: |
60 | //! a. their vertices |
61 | //! b. their pcurves |
62 | //! c. their 3d curves |
63 | //! 3. adjacency of the edge vertices to its pcurve and 3d curve |
64 | //! 4. if a wire is closed or not (considering its 3d and 2d |
65 | //! contour) |
66 | //! 5. if a wire is outer on its face (considering pcurves) |
67 | //! |
68 | //! This class can be used in conjunction with class |
69 | //! ShapeFix_Wire, which will fix the problems detected by this class. |
70 | //! |
71 | //! The methods of the given class match to ones of the class |
72 | //! ShapeFix_Wire, e.g., CheckSmall and FixSmall. |
73 | //! This class also includes some auxilary methods |
74 | //! (e.g., CheckOuterBound, etc.), |
75 | //! which have no pair in ShapeFix_Wire. |
76 | //! |
77 | //! Like methods of ShapeFix_Wire the ones of this class are |
78 | //! grouped into two levels: |
79 | //! - Public which are recommended for use (the most global |
80 | //! method is Perform), |
81 | //! - Advanced, for optional use only |
82 | //! |
83 | //! For analyzing result of Public API checking methods use |
84 | //! corresponding Status... method. |
85 | //! The 'advanced' functions share the single status field which |
86 | //! contains the result of the last performed 'advanced' method. |
87 | //! It is quried by the method LastCheckStatus(). |
88 | //! |
89 | //! In order to prepare an analyzer, it is necessary to load a wire, |
90 | //! set face and precision. |
25e59720 |
91 | class ShapeAnalysis_Wire : public Standard_Transient |
42cf5bc1 |
92 | { |
93 | |
94 | public: |
95 | |
96 | |
97 | //! Empty constructor |
98 | Standard_EXPORT ShapeAnalysis_Wire(); |
99 | |
100 | //! Creates object with standard TopoDS_Wire, face |
101 | //! and precision |
102 | Standard_EXPORT ShapeAnalysis_Wire(const TopoDS_Wire& wire, const TopoDS_Face& face, const Standard_Real precision); |
103 | |
104 | //! Creates the object with WireData object, face |
105 | //! and precision |
106 | Standard_EXPORT ShapeAnalysis_Wire(const Handle(ShapeExtend_WireData)& sbwd, const TopoDS_Face& face, const Standard_Real precision); |
107 | |
108 | //! Initializes the object with standard TopoDS_Wire, face |
109 | //! and precision |
110 | Standard_EXPORT void Init (const TopoDS_Wire& wire, const TopoDS_Face& face, const Standard_Real precision); |
111 | |
112 | //! Initializes the object with WireData object, face |
113 | //! and precision |
114 | Standard_EXPORT void Init (const Handle(ShapeExtend_WireData)& sbwd, const TopoDS_Face& face, const Standard_Real precision); |
115 | |
116 | //! Loads the object with standard TopoDS_Wire |
117 | Standard_EXPORT void Load (const TopoDS_Wire& wire); |
118 | |
119 | //! Loads the object with WireData object |
120 | Standard_EXPORT void Load (const Handle(ShapeExtend_WireData)& sbwd); |
121 | |
122 | //! Loads the face the wire lies on |
123 | Standard_EXPORT void SetFace (const TopoDS_Face& face); |
124 | |
125 | //! Loads the surface the wire lies on |
126 | Standard_EXPORT void SetSurface (const Handle(Geom_Surface)& surface); |
127 | |
128 | //! Loads the surface the wire lies on |
129 | Standard_EXPORT void SetSurface (const Handle(Geom_Surface)& surface, const TopLoc_Location& location); |
130 | |
131 | Standard_EXPORT void SetPrecision (const Standard_Real precision); |
132 | |
133 | //! Unsets all the status and distance fields |
134 | //! wire, face and precision are not cleared |
135 | Standard_EXPORT void ClearStatuses(); |
136 | |
137 | //! Returns True if wire is loaded and has number of edges >0 |
138 | Standard_Boolean IsLoaded() const; |
139 | |
140 | //! Returns True if IsLoaded and underlying face is not null |
141 | Standard_Boolean IsReady() const; |
142 | |
143 | //! Returns the value of precision |
144 | Standard_Real Precision() const; |
145 | |
146 | //! Returns wire object being analyzed |
147 | const Handle(ShapeExtend_WireData)& WireData() const; |
148 | |
149 | //! Returns the number of edges in the wire, or 0 if it is not loaded |
150 | Standard_Integer NbEdges() const; |
151 | |
152 | //! Returns the working face |
153 | const TopoDS_Face& Face() const; |
154 | |
155 | //! Returns the working surface |
156 | const Handle(ShapeAnalysis_Surface)& Surface() const; |
157 | |
158 | //! Performs all the checks in the following order : |
159 | //! CheckOrder, CheckSmall, CheckConected, CheckEdgeCurves, |
160 | //! CheckDegenerated, CheckSelfIntersection, CheckLacking, |
161 | //! CheckClosed |
162 | //! Returns: True if at least one method returned True; |
163 | //! For deeper analysis use Status...(status) methods |
164 | Standard_EXPORT Standard_Boolean Perform(); |
165 | |
166 | //! Calls CheckOrder and returns False if wire is already |
167 | //! ordered (tail-to-head), True otherwise |
168 | //! Flag <isClosed> defines if the wire is closed or not |
169 | //! Flag <mode3d> defines which mode is used (3d or 2d) |
170 | Standard_EXPORT Standard_Boolean CheckOrder (const Standard_Boolean isClosed = Standard_True, const Standard_Boolean mode3d = Standard_True); |
171 | |
172 | //! Calls to CheckConnected for each edge |
173 | //! Returns: True if at least one pair of disconnected edges (not sharing the |
174 | //! same vertex) was detected |
175 | Standard_EXPORT Standard_Boolean CheckConnected (const Standard_Real prec = 0.0); |
176 | |
177 | //! Calls to CheckSmall for each edge |
178 | //! Returns: True if at least one small edge was detected |
179 | Standard_EXPORT Standard_Boolean CheckSmall (const Standard_Real precsmall = 0.0); |
180 | |
181 | //! Checks edges geometry (consitency of 2d and 3d senses, adjasment |
182 | //! of curves to the vertices, etc.). |
183 | //! The order of the checks : |
184 | //! Call ShapeAnalysis_Wire to check: |
185 | //! ShapeAnalysis_Edge::CheckCurve3dWithPCurve (1), |
186 | //! ShapeAnalysis_Edge::CheckVertcesWithPCurve (2), |
187 | //! ShapeAnalysis_Edge::CheckVertcesWithCurve3d (3), |
188 | //! CheckSeam (4) |
189 | //! Additional: |
190 | //! CheckGap3d (5), |
191 | //! CheckGap2d (6), |
192 | //! ShapeAnalysis_Edge::CheckSameParameter (7) |
193 | //! Returns: True if at least one check returned True |
194 | //! Remark: The numbers in brackets show with what DONEi or FAILi |
195 | //! the status can be queried |
196 | Standard_EXPORT Standard_Boolean CheckEdgeCurves(); |
197 | |
198 | //! Calls to CheckDegenerated for each edge |
199 | //! Returns: True if at least one incorrect degenerated edge was detected |
200 | Standard_EXPORT Standard_Boolean CheckDegenerated(); |
201 | |
202 | //! Checks if wire is closed, performs CheckConnected, |
203 | //! CheckDegenerated and CheckLacking for the first and the last edges |
204 | //! Returns: True if at least one check returned True |
205 | //! Status: |
206 | //! FAIL1 or DONE1: see CheckConnected |
207 | //! FAIL2 or DONE2: see CheckDegenerated |
208 | Standard_EXPORT Standard_Boolean CheckClosed (const Standard_Real prec = 0.0); |
209 | |
210 | //! Checks self-intersection of the wire (considering pcurves) |
211 | //! Looks for self-intersecting edges and each pair of intersecting |
212 | //! edges. |
213 | //! Warning: It does not check each edge with any other one (only each two |
214 | //! adjacent edges) |
215 | //! The order of the checks : |
216 | //! CheckSelfIntersectingEdge, CheckIntersectingEdges |
217 | //! Returns: True if at least one check returned True |
218 | //! Status: FAIL1 or DONE1 - see CheckSelfIntersectingEdge |
219 | //! FAIL2 or DONE2 - see CheckIntersectingEdges |
220 | Standard_EXPORT Standard_Boolean CheckSelfIntersection(); |
221 | |
222 | //! Calls to CheckLacking for each edge |
223 | //! Returns: True if at least one lacking edge was detected |
224 | Standard_EXPORT Standard_Boolean CheckLacking(); |
225 | |
226 | Standard_EXPORT Standard_Boolean CheckGaps3d(); |
227 | |
228 | Standard_EXPORT Standard_Boolean CheckGaps2d(); |
229 | |
230 | Standard_EXPORT Standard_Boolean CheckCurveGaps(); |
231 | |
232 | //! Analyzes the order of the edges in the wire, |
233 | //! uses class WireOrder for that purpose. |
234 | //! Flag <isClosed> defines if the wire is closed or not |
235 | //! Flag <mode3d> defines which mode is used (3d or 2d) |
236 | //! Returns False if wire is already ordered (tail-to-head), |
237 | //! True otherwise. |
238 | //! Use returned WireOrder object for deeper analysis. |
239 | //! Status: |
240 | //! OK : the same edges orientation, the same edges sequence |
241 | //! DONE1: the same edges orientation, not the same edges sequence |
242 | //! DONE2: as DONE1 and gaps more than myPrecision |
243 | //! DONE3: not the same edges orientation (some need to be reversed) |
244 | //! DONE4: as DONE3 and gaps more than myPrecision |
245 | //! FAIL : algorithm failed (could not detect order) |
246 | Standard_EXPORT Standard_Boolean CheckOrder (ShapeAnalysis_WireOrder& sawo, const Standard_Boolean isClosed = Standard_True, const Standard_Boolean mode3d = Standard_True); |
247 | |
248 | //! Checks connected edges (num-th and preceeding). |
249 | //! Tests with starting preci from <SBWD> or with <prec> if |
250 | //! it is greater. |
251 | //! Considers Vertices. |
252 | //! Returns: False if edges are connected by the common vertex, else True |
253 | //! Status : |
254 | //! OK : Vertices (end of num-1 th edge and start on num-th one) |
255 | //! are already the same |
256 | //! DONE1 : Absolutely confused (gp::Resolution) |
257 | //! DONE2 : Confused at starting <preci> from <SBWD> |
258 | //! DONE3 : Confused at <prec> but not <preci> |
259 | //! FAIL1 : Not confused |
260 | //! FAIL2 : Not confused but confused with <preci> if reverse num-th edge |
261 | Standard_EXPORT Standard_Boolean CheckConnected (const Standard_Integer num, const Standard_Real prec = 0.0); |
262 | |
263 | //! Checks if an edge has a length not greater than myPreci or |
264 | //! precsmall (if it is smaller) |
265 | //! Returns: False if its length is greater than precision |
266 | //! Status: |
267 | //! OK : edge is not small or degenerated |
268 | //! DONE1: edge is small, vertices are the same |
269 | //! DONE2: edge is small, vertices are not the same |
270 | //! FAIL : no 3d curve and pcurve |
271 | Standard_EXPORT Standard_Boolean CheckSmall (const Standard_Integer num, const Standard_Real precsmall = 0.0); |
272 | |
273 | //! Checks if a seam pcurves are correct oriented |
274 | //! Returns: False (status OK) if given edge is not a seam or if it is OK |
275 | //! C1 - current pcurve for FORWARD edge, |
276 | //! C2 - current pcurve for REVERSED edge (if returns True they |
277 | //! should be swapped for the seam), |
278 | //! cf, cl - first and last parameters on curves |
279 | //! Status: |
280 | //! OK : Pcurves are correct or edge is not seam |
281 | //! DONE : Seam pcurves should be swapped |
282 | Standard_EXPORT Standard_Boolean CheckSeam (const Standard_Integer num, Handle(Geom2d_Curve)& C1, Handle(Geom2d_Curve)& C2, Standard_Real& cf, Standard_Real& cl); |
283 | |
284 | //! Checks if a seam pcurves are correct oriented |
285 | //! See previous functions for details |
286 | Standard_EXPORT Standard_Boolean CheckSeam (const Standard_Integer num); |
287 | |
288 | //! Checks for degenerated edge between two adjacent ones. |
289 | //! Fills parameters dgnr1 and dgnr2 with points in paramterical |
290 | //! space that correspond to the singularity (either gap that |
291 | //! needs to be filled by degenerated edge or that already filled) |
292 | //! Returns: False if no singularity or edge is already degenerated, |
293 | //! otherwise True |
294 | //! Status: |
295 | //! OK : No surface singularity, or edge is already degenerated |
296 | //! DONE1: Degenerated edge should be inserted (gap in 2D) |
297 | //! DONE2: Edge <num> should be made degenerated (recompute pcurve |
298 | //! and set the flag) |
299 | //! FAIL1: One of edges neighbouring to degenerated one has |
300 | //! no pcurve |
301 | //! FAIL2: Edge marked as degenerated and has no pcurve |
302 | //! but singularity is not detected |
303 | Standard_EXPORT Standard_Boolean CheckDegenerated (const Standard_Integer num, gp_Pnt2d& dgnr1, gp_Pnt2d& dgnr2); |
304 | |
305 | //! Checks for degenerated edge between two adjacent ones. |
306 | //! Remark : Calls previous function |
307 | //! Status : See the function above for details |
308 | Standard_EXPORT Standard_Boolean CheckDegenerated (const Standard_Integer num); |
309 | |
310 | //! Checks gap between edges in 3D (3d curves). |
311 | //! Checks the distance between ends of 3d curves of the num-th |
312 | //! and preceeding edge. |
313 | //! The distance can be queried by MinDistance3d. |
314 | //! |
315 | //! Returns: True if status is DONE |
316 | //! Status: |
317 | //! OK : Gap is less than myPrecision |
318 | //! DONE : Gap is greater than myPrecision |
319 | //! FAIL : No 3d curve(s) on the edge(s) |
320 | Standard_EXPORT Standard_Boolean CheckGap3d (const Standard_Integer num = 0); |
321 | |
322 | //! Checks gap between edges in 2D (pcurves). |
323 | //! Checks the distance between ends of pcurves of the num-th |
324 | //! and preceeding edge. |
325 | //! The distance can be queried by MinDistance2d. |
326 | //! |
327 | //! Returns: True if status is DONE |
328 | //! Status: |
329 | //! OK : Gap is less than parametric precision out of myPrecision |
330 | //! DONE : Gap is greater than parametric precision out of myPrecision |
331 | //! FAIL : No pcurve(s) on the edge(s) |
332 | Standard_EXPORT Standard_Boolean CheckGap2d (const Standard_Integer num = 0); |
333 | |
334 | //! Checks gap between points on 3D curve and points on surface |
335 | //! generated by pcurve of the num-th edge. |
336 | //! The distance can be queried by MinDistance3d. |
337 | //! |
338 | //! Returns: True if status is DONE |
339 | //! Status: |
340 | //! OK : Gap is less than myPrecision |
341 | //! DONE : Gap is greater than myPrecision |
342 | //! FAIL : No 3d curve(s) on the edge(s) |
343 | Standard_EXPORT Standard_Boolean CheckCurveGap (const Standard_Integer num = 0); |
344 | |
345 | //! Checks if num-th edge is self-intersecting. |
346 | //! Self-intersection is reported only if intersection point lies outside |
347 | //! of both end vertices of the edge. |
348 | //! Returns: True if edge is self-intersecting. |
349 | //! If returns True it also fills the sequences of intersection points |
350 | //! and corresponding 3d points (only that are not enclosed by a vertices) |
351 | //! Status: |
352 | //! FAIL1 : No pcurve |
353 | //! FAIL2 : No vertices |
354 | //! DONE1 : Self-intersection found |
355 | Standard_EXPORT Standard_Boolean CheckSelfIntersectingEdge (const Standard_Integer num, IntRes2d_SequenceOfIntersectionPoint& points2d, TColgp_SequenceOfPnt& points3d); |
356 | |
357 | Standard_EXPORT Standard_Boolean CheckSelfIntersectingEdge (const Standard_Integer num); |
358 | |
359 | //! Checks two adjacent edges for intersecting. |
360 | //! Intersection is reported only if intersection point is not enclosed |
361 | //! by the common end vertex of the edges. |
362 | //! Returns: True if intersection is found. |
363 | //! If returns True it also fills the sequences of intersection points, |
364 | //! corresponding 3d points, and errors for them (half-distances between |
365 | //! intersection points in 3d calculated from one and from another edge) |
366 | //! Status: |
367 | //! FAIL1 : No pcurve |
368 | //! FAIL2 : No vertices |
369 | //! DONE1 : Self-intersection found |
370 | Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num, IntRes2d_SequenceOfIntersectionPoint& points2d, TColgp_SequenceOfPnt& points3d, TColStd_SequenceOfReal& errors); |
371 | |
372 | //! Checks two adjacent edges for intersecting. |
373 | //! Remark : Calls the previous method |
374 | //! Status : See the function above for details |
375 | Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num); |
376 | |
377 | //! Checks i-th and j-th edges for intersecting. |
378 | //! Remark : See the previous method for details |
379 | Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num1, const Standard_Integer num2, IntRes2d_SequenceOfIntersectionPoint& points2d, TColgp_SequenceOfPnt& points3d, TColStd_SequenceOfReal& errors); |
380 | |
381 | //! Checks i-th and j-th edges for intersecting. |
382 | //! Remark : Calls previous method. |
383 | //! Status : See the function above for details |
384 | Standard_EXPORT Standard_Boolean CheckIntersectingEdges (const Standard_Integer num1, const Standard_Integer num2); |
385 | |
386 | //! Checks if there is a gap in 2d between edges, not comprised by |
387 | //! the tolerance of their common vertex. |
388 | //! If <Tolerance> is greater than 0. and less than tolerance of |
389 | //! the vertex, then this value is used for check. |
390 | //! Returns: True if not closed gap was detected |
391 | //! p2d1 and p2d2 are the endpoint of <num-1>th edge and start of |
392 | //! the <num>th edge in 2d. |
393 | //! Status: |
394 | //! OK: No edge is lacking (3d and 2d connection) |
395 | //! FAIL1: edges have no vertices (at least one of them) |
396 | //! FAIL2: edges are neither connected by common vertex, nor have |
397 | //! coincided vertices |
398 | //! FAIL1: edges have no pcurves |
399 | //! DONE1: the gap is detected which cannot be closed by the tolerance |
400 | //! of the common vertex (or with value of <Tolerance>) |
401 | //! DONE2: is set (together with DONE1) if gap is detected and the |
402 | //! vector (p2d2 - p2d1) goes in direction opposite to the pcurves |
403 | //! of the edges (if angle is more than 0.9*PI). |
404 | Standard_EXPORT Standard_Boolean CheckLacking (const Standard_Integer num, const Standard_Real Tolerance, gp_Pnt2d& p2d1, gp_Pnt2d& p2d2); |
405 | |
406 | //! Checks if there is a gap in 2D between edges and not comprised by vertex tolerance |
407 | //! The value of SBWD.thepreci is used. |
408 | //! Returns: False if no edge should be inserted |
409 | //! Status: |
410 | //! OK : No edge is lacking (3d and 2d connection) |
411 | //! DONE1 : The vertex tolerance should be increased only (2d gap is |
412 | //! small) |
413 | //! DONE2 : Edge can be inserted (3d and 2d gaps are large enough) |
414 | Standard_EXPORT Standard_Boolean CheckLacking (const Standard_Integer num, const Standard_Real Tolerance = 0.0); |
415 | |
416 | //! Checks if wire defines an outer bound on the face |
417 | //! Uses ShapeAnalysis::IsOuterBound for analysis |
418 | //! If <APIMake> is True uses BRepAPI_MakeWire to build the |
419 | //! wire, if False (to be used only when edges share common |
420 | //! vertices) uses BRep_Builder to build the wire |
421 | Standard_EXPORT Standard_Boolean CheckOuterBound (const Standard_Boolean APIMake = Standard_True); |
422 | |
423 | //! Detects a notch |
424 | Standard_EXPORT Standard_Boolean CheckNotchedEdges (const Standard_Integer num, Standard_Integer& shortNum, Standard_Real& param, const Standard_Real Tolerance = 0.0); |
425 | |
426 | //! Checks if wire has parametric area less than precision. |
8b1e055f |
427 | Standard_EXPORT Standard_Boolean CheckSmallArea (const TopoDS_Wire& theWire); |
42cf5bc1 |
428 | |
429 | //! Checks with what orientation <shape> (wire or edge) can be |
430 | //! connected to the wire. |
431 | //! Tests distances with starting <preci> from <SBWD> (close confusion), |
432 | //! but if given <prec> is greater, tests with <prec> (coarse confusion). |
433 | //! The smallest found distance can be returned by MinDistance3d |
434 | //! |
435 | //! Returns: False if status is FAIL (see below) |
436 | //! Status: |
437 | //! DONE1 : If <shape> follows <SBWD>, direct sense (normal) |
438 | //! DONE2 : If <shape> follows <SBWD>, but if reversed |
439 | //! DONE3 : If <shape> preceeds <SBWD>, direct sense |
440 | //! DONE4 : If <shape> preceeds <SBWD>, but if reversed |
441 | //! FAIL1 : If <shape> is neither an edge nor a wire |
442 | //! FAIL2 : If <shape> cannot be connected to <SBWD> |
443 | //! |
444 | //! DONE5 : To the tail of <SBWD> the <shape> is closer with |
445 | //! direct sense |
446 | //! DONE6 : To the head of <SBWD> the <shape> is closer with |
447 | //! direct sense |
448 | //! |
449 | //! Remark: Statuses DONE1 - DONE4, FAIL1 - FAIL2 are basic and |
450 | //! describe the nearest connection of the <shape> to <SBWD>. |
451 | //! Statuses DONE5 and DONE6 are advanced and are to be used when |
452 | //! analyzing with what sense (direct or reversed) the <shape> |
453 | //! should be connected to <SBWD>: |
454 | //! For tail of <SBWD> if DONE4 is True <shape> should be direct, |
455 | //! otherwise reversed. |
456 | //! For head of <SBWD> if DONE5 is True <shape> should be direct, |
457 | //! otherwise reversed. |
458 | Standard_EXPORT Standard_Boolean CheckShapeConnect (const TopoDS_Shape& shape, const Standard_Real prec = 0.0); |
459 | |
460 | //! The same as previous CheckShapeConnect but is more advanced. |
461 | //! It returns the distances between each end of <sbwd> and each |
462 | //! end of <shape>. For example, <tailhead> stores distance |
463 | //! between tail of <sbwd> and head of <shape> |
464 | //! Remark: First method CheckShapeConnect calls this one |
465 | Standard_EXPORT Standard_Boolean CheckShapeConnect (Standard_Real& tailhead, Standard_Real& tailtail, Standard_Real& headtail, Standard_Real& headhead, const TopoDS_Shape& shape, const Standard_Real prec = 0.0); |
466 | |
467 | //! Checks existance of loop on wire and return vertices wich are loop vertices |
468 | //! (vertices belonging to a few pairs of edges) |
469 | Standard_EXPORT Standard_Boolean CheckLoop (TopTools_IndexedMapOfShape& aMapLoopVertices, TopTools_DataMapOfShapeListOfShape& aMapVertexEdges, TopTools_MapOfShape& aMapSmallEdges, TopTools_MapOfShape& aMapSeemEdges); |
470 | |
471 | Standard_EXPORT Standard_Boolean CheckTail (const TopoDS_Edge& theEdge1, const TopoDS_Edge& theEdge2, const Standard_Real theMaxSine, const Standard_Real theMaxWidth, const Standard_Real theMaxTolerance, TopoDS_Edge& theEdge11, TopoDS_Edge& theEdge12, TopoDS_Edge& theEdge21, TopoDS_Edge& theEdge22); |
472 | |
473 | Standard_Boolean StatusOrder (const ShapeExtend_Status Status) const; |
474 | |
475 | Standard_Boolean StatusConnected (const ShapeExtend_Status Status) const; |
476 | |
477 | Standard_Boolean StatusEdgeCurves (const ShapeExtend_Status Status) const; |
478 | |
479 | Standard_Boolean StatusDegenerated (const ShapeExtend_Status Status) const; |
480 | |
481 | Standard_Boolean StatusClosed (const ShapeExtend_Status Status) const; |
482 | |
483 | Standard_Boolean StatusSmall (const ShapeExtend_Status Status) const; |
484 | |
485 | Standard_Boolean StatusSelfIntersection (const ShapeExtend_Status Status) const; |
486 | |
487 | Standard_Boolean StatusLacking (const ShapeExtend_Status Status) const; |
488 | |
489 | Standard_Boolean StatusGaps3d (const ShapeExtend_Status Status) const; |
490 | |
491 | Standard_Boolean StatusGaps2d (const ShapeExtend_Status Status) const; |
492 | |
493 | Standard_Boolean StatusCurveGaps (const ShapeExtend_Status Status) const; |
494 | |
495 | Standard_Boolean StatusLoop (const ShapeExtend_Status Status) const; |
496 | |
497 | //! Querying the status of the LAST perfomed 'Advanced' checking procedure |
498 | Standard_Boolean LastCheckStatus (const ShapeExtend_Status Status) const; |
499 | |
500 | //! Returns the last lowest distance in 3D computed by |
501 | //! CheckOrientation, CheckConnected, CheckContinuity3d, |
502 | //! CheckVertex, CheckNewVertex |
503 | Standard_Real MinDistance3d() const; |
504 | |
505 | //! Returns the last lowest distance in 2D-UV computed by |
506 | //! CheckContinuity2d |
507 | Standard_Real MinDistance2d() const; |
508 | |
509 | //! Returns the last maximal distance in 3D computed by |
510 | //! CheckOrientation, CheckConnected, CheckContinuity3d, |
511 | //! CheckVertex, CheckNewVertex, CheckSameParameter |
512 | Standard_Real MaxDistance3d() const; |
513 | |
514 | //! Returns the last maximal distance in 2D-UV computed by |
515 | //! CheckContinuity2d |
516 | Standard_Real MaxDistance2d() const; |
517 | |
518 | |
519 | |
520 | |
25e59720 |
521 | DEFINE_STANDARD_RTTIEXT(ShapeAnalysis_Wire,Standard_Transient) |
42cf5bc1 |
522 | |
523 | protected: |
524 | |
525 | |
526 | Handle(ShapeExtend_WireData) myWire; |
527 | TopoDS_Face myFace; |
528 | Handle(ShapeAnalysis_Surface) mySurf; |
529 | Standard_Real myPrecision; |
530 | Standard_Real myMin3d; |
531 | Standard_Real myMin2d; |
532 | Standard_Real myMax3d; |
533 | Standard_Real myMax2d; |
534 | Standard_Integer myStatusOrder; |
535 | Standard_Integer myStatusConnected; |
536 | Standard_Integer myStatusEdgeCurves; |
537 | Standard_Integer myStatusDegenerated; |
538 | Standard_Integer myStatusClosed; |
539 | Standard_Integer myStatusSmall; |
540 | Standard_Integer myStatusSelfIntersection; |
541 | Standard_Integer myStatusLacking; |
542 | Standard_Integer myStatusGaps3d; |
543 | Standard_Integer myStatusGaps2d; |
544 | Standard_Integer myStatusCurveGaps; |
545 | Standard_Integer myStatusLoop; |
546 | Standard_Integer myStatus; |
547 | |
548 | |
549 | private: |
550 | |
551 | |
552 | |
553 | |
554 | }; |
555 | |
556 | |
557 | #include <ShapeAnalysis_Wire.lxx> |
558 | |
559 | |
560 | |
561 | |
562 | |
563 | #endif // _ShapeAnalysis_Wire_HeaderFile |