1 // Created on: 1996-07-15
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1996-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 _BRepClass3d_SClassifier_HeaderFile
18 #define _BRepClass3d_SClassifier_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23 
24 #include <TopoDS_Face.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Real.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <TopAbs_State.hxx>
29 class Standard_DomainError;
30 class BRepClass3d_SolidExplorer;
31 class gp_Pnt;
32 class TopoDS_Face;
33 
34 
35 //! Provides an algorithm to classify a point in a solid.
36 class BRepClass3d_SClassifier
37 {
38 public:
39 
40   DEFINE_STANDARD_ALLOC
41 
42 
43   //! Empty constructor.
44   Standard_EXPORT BRepClass3d_SClassifier();
45 
46   //! Constructor to classify the point P with the
47   //! tolerance Tol on the solid S.
48   Standard_EXPORT BRepClass3d_SClassifier(BRepClass3d_SolidExplorer& S, const gp_Pnt& P, const Standard_Real Tol);
49 
50   //! Classify the point P with the
51   //! tolerance Tol on the solid S.
52   Standard_EXPORT void Perform (BRepClass3d_SolidExplorer& S, const gp_Pnt& P, const Standard_Real Tol);
53 
54   //! Classify an infinite point with the
55   //! tolerance Tol on the solid S.
56   Standard_EXPORT void PerformInfinitePoint (BRepClass3d_SolidExplorer& S, const Standard_Real Tol);
57 
58   //! Returns True if the classification has been
59   //! computed by rejection.
60   //! The State is then OUT.
61   Standard_EXPORT Standard_Boolean Rejected() const;
62 
63   //! Returns the result of the classification.
64   Standard_EXPORT TopAbs_State State() const;
65 
66   //! Returns True when the point is a point of a face.
67   Standard_EXPORT Standard_Boolean IsOnAFace() const;
68 
69   //! Returns the face used to determine the
70   //! classification. When the state is ON, this is the
71   //! face containing the point.
72   //!
73   //! When Rejected() returns True, Face() has no signification.
74   Standard_EXPORT TopoDS_Face Face() const;
75 
76 
77 
78 
79 protected:
80 
81 
82   Standard_EXPORT void ForceIn();
83 
84   Standard_EXPORT void ForceOut();
85 
86 
87 
88 
89 private:
90 
91 
92 
93   TopoDS_Face myFace;
94 
95   //! This variable stores information about algorithm internal state.
96   //! Type of this variable differs from TopAbs_State since it contains
97   //! additional information about error status.
98   //! 1 - Error inside of the algorithm.
99   //! 2 - ON.
100   //! 3 - IN.
101   //! 4 - OUT.
102   Standard_Integer myState;
103 
104 
105 };
106 
107 
108 
109 
110 
111 
112 
113 #endif // _BRepClass3d_SClassifier_HeaderFile
114