1 // Created on: 2014-06-03
2 // Created by: Oleg AGASHIN
3 // Copyright (c) 1997-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 #ifndef _BRepMesh_WireChecker_HeaderFile
18 #define _BRepMesh_WireChecker_HeaderFile
20 #include <Standard.hxx>
21 #include <TopoDS_Face.hxx>
22 #include <BRepMesh_Status.hxx>
23 #include <BRepMesh_DataStructureOfDelaun.hxx>
24 #include <BRepMesh.hxx>
25 #include <TColStd_IndexedMapOfInteger.hxx>
26 #include <TopoDS_Edge.hxx>
27 #include <Bnd_Box2d.hxx>
28 #include <gp_Pnt2d.hxx>
34 //! Auxilary class intended to check correctness of discretized face.
35 //! In particular, checks boundaries of discretized face for self
36 //! intersections and gaps.
37 class BRepMesh_WireChecker
42 //! Used to identify segments with overlapped bounding boxes.
43 //! Note that instance of selector can be used only once due to
44 //! unextentable array of indices.
45 class BndBox2dTreeSelector : public BRepMesh::BndBox2dTree::Selector
48 Standard_EXPORT BndBox2dTreeSelector(const Standard_Integer theReservedSize);
49 Standard_EXPORT virtual Standard_Boolean Reject(const Bnd_Box2d& theBox2D) const;
50 Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer& theIndex);
52 Standard_EXPORT void Clear();
53 Standard_EXPORT void SetBox(const Bnd_Box2d& theBox2D);
54 Standard_EXPORT void SetSkippedIndex(const Standard_Integer theIndex);
55 Standard_EXPORT const BRepMesh::Array1OfInteger& Indices() const;
56 Standard_EXPORT Standard_Integer IndicesNb() const;
60 Standard_Integer mySkippedIndex;
61 BRepMesh::Array1OfInteger myIndices;
62 Standard_Integer myIndicesNb;
67 typedef NCollection_List<TopoDS_Edge> ListOfEdges;
68 typedef NCollection_Sequence<ListOfEdges> SeqOfWireEdges;
70 typedef NCollection_Sequence<gp_Pnt2d> SeqOfPnt2d;
71 typedef NCollection_Sequence<SeqOfPnt2d> SeqOfDWires;
76 //! @param theFace Face to be checked.
77 //! @param theTolUV Tolerance to be used for calculations in parametric space.
78 //! @param theEdges Map of edges with associated polygon on triangulation.
79 //! @param theVertexMap Map of face vertices.
80 //! @param theStructure Discretized representation of face in parametric space.
81 //! @param theUmin Lower U boundary of the face in parametric space.
82 //! @param theUmax Upper U boundary of the face in parametric space.
83 //! @param theVmin Lower V boundary of the face in parametric space.
84 //! @param theVmax Upper V boundary of the face in parametric space.
85 Standard_EXPORT BRepMesh_WireChecker(
86 const TopoDS_Face& theFace,
87 const Standard_Real theTolUV,
88 const BRepMesh::HDMapOfShapePairOfPolygon& theEdges,
89 const BRepMesh::HIMapOfInteger& theVertexMap,
90 const Handle(BRepMesh_DataStructureOfDelaun)& theStructure,
91 const Standard_Real theUmin,
92 const Standard_Real theUmax,
93 const Standard_Real theVmin,
94 const Standard_Real theVmax,
95 const Standard_Boolean isInParallel);
97 //! Recompute data using parameters passed in constructor.
98 //! @param[out] theClassifier Classifier to be updated using calculated data.
99 Standard_EXPORT void ReCompute(BRepMesh::HClassifier& theClassifier);
101 //! Returns status of the check.
102 inline BRepMesh_Status Status() const
109 //! Collects discrete wires.
110 //! @param[out] theDWires sequence of discretized wires to be filled.
111 //! @return TRUE on success, FALSE in case of open wire.
112 Standard_Boolean collectDiscretizedWires(SeqOfDWires& theDWires);
114 //! Fills array of BiPoints for corresponding wire.
115 //! @param theDWires Sequence of wires to be processed.
116 //! @param theWiresSegmentsTree Array of segments with corresponding
117 //! bounding boxes trees to be filled.
118 void fillSegmentsTree(
119 const SeqOfDWires& theDWires,
120 BRepMesh::Array1OfSegmentsTree& theWiresSegmentsTree);
122 //! Assignment operator.
123 void operator =(BRepMesh_WireChecker& /*theOther*/)
129 const Standard_Real myTolUV;
130 const BRepMesh::HDMapOfShapePairOfPolygon& myEdges;
131 const BRepMesh::HIMapOfInteger& myVertexMap;
132 const Handle(BRepMesh_DataStructureOfDelaun)& myStructure;
133 const Standard_Real myUmin;
134 const Standard_Real myUmax;
135 const Standard_Real myVmin;
136 const Standard_Real myVmax;
137 BRepMesh_Status myStatus;
138 SeqOfWireEdges myWiresEdges;
139 Standard_Boolean myIsInParallel;