0025039: Improvement of code structure of general and supporting tools implemented...
[occt.git] / src / BRepMesh / BRepMesh_WireInterferenceChecker.hxx
CommitLineData
01a6e62b 1// Created on: 2014-06-18
2// Created by: Oleg AGASHIN
3// Copyright (c) 2011-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _BRepMesh_WireInterferenceChecker_HeaderFile
17#define _BRepMesh_WireInterferenceChecker_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_Mutex.hxx>
21#include <BRepMesh_WireChecker.hxx>
22#include <BRepMesh_Status.hxx>
23
24#ifdef HAVE_TBB
25 // paralleling using Intel TBB
26 #include <tbb/blocked_range.h>
27#endif
28
29//! Auxilary class implementing functionality for
30//! checking interference between two discretized wires.
31class BRepMesh_WireInterferenceChecker
32{
33public:
34
35 //! Enumerates states of segments intersection check.
36 enum IntFlag
37 {
38 NoIntersection,
39 Cross,
40 EndPointTouch,
41 PointOnSegment,
42 Glued,
43 Same
44 };
45
46#ifdef HAVE_TBB
47 //! Constructor
48 //! \param theWires wires that should be checked.
49 //! \param theStatus shared flag to set status of the check.
50 //! \param theMutex shared mutex for parallel processing.
51 BRepMesh_WireInterferenceChecker(
fc9b36d6 52 const std::vector<BRepMeshCol::SegmentsTree>& theWires,
53 BRepMesh_Status* theStatus,
54 Standard_Mutex* theMutex);
01a6e62b 55
56 //! Checker's body.
57 //! \param theWireRange range of wires to be checked.
58 void operator ()(const tbb::blocked_range<Standard_Integer>& theWireRange) const;
59#else
60 //! Constructor
61 //! \param theWires wires that should be checked.
62 //! \param theStatus shared flag to set status of the check.
63 BRepMesh_WireInterferenceChecker(
64 const std::vector<BRepMesh_WireChecker::SegmentsTree>& theWires,
65 BRepMesh_Status* theStatus);
66#endif
67
68 //! Checker's body.
69 //! \param theWireId Id of discretized wire to be checked.
70 void operator ()(const Standard_Integer& theWireId) const;
71
01a6e62b 72private:
73
74 //! Classifies the point in case of coincidence of two vectors.
75 //! \param thePoint1 the start point of a segment (base point).
76 //! \param thePoint2 the end point of a segment.
77 //! \param thePointToCheck the point to classify.
78 //! \return zero value if point is out of segment and non zero value
79 //! if point is between the first and the second point of segment.
80 static Standard_Integer classifyPoint (const gp_XY& thePoint1,
81 const gp_XY& thePoint2,
82 const gp_XY& thePointToCheck);
83private:
fc9b36d6 84 const BRepMeshCol::SegmentsTree* myWires;
85 Standard_Integer myWiresNb;
86 BRepMesh_Status* myStatus;
01a6e62b 87
88#ifdef HAVE_TBB
fc9b36d6 89 Standard_Mutex* myMutex;
01a6e62b 90#endif
91};
92
93#endif