Test for 0022778: Bug in BRepMesh
[occt.git] / src / BRepExtrema / BRepExtrema_ExtPF.hxx
1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18 #ifndef _BRepExtrema_ExtPF_HeaderFile
19 #define _BRepExtrema_ExtPF_HeaderFile
20
21 #ifndef _Standard_HeaderFile
22 #include <Standard.hxx>
23 #endif
24 #ifndef _Standard_DefineAlloc_HeaderFile
25 #include <Standard_DefineAlloc.hxx>
26 #endif
27 #ifndef _Standard_Macro_HeaderFile
28 #include <Standard_Macro.hxx>
29 #endif
30
31 #ifndef _Extrema_ExtPS_HeaderFile
32 #include <Extrema_ExtPS.hxx>
33 #endif
34 #ifndef _Standard_Integer_HeaderFile
35 #include <Standard_Integer.hxx>
36 #endif
37 #ifndef _TColStd_SequenceOfReal_HeaderFile
38 #include <TColStd_SequenceOfReal.hxx>
39 #endif
40 #ifndef _Extrema_SequenceOfPOnSurf_HeaderFile
41 #include <Extrema_SequenceOfPOnSurf.hxx>
42 #endif
43 #ifndef _BRepAdaptor_Surface_HeaderFile
44 #include <BRepAdaptor_Surface.hxx>
45 #endif
46 #ifndef _Extrema_ExtFlag_HeaderFile
47 #include <Extrema_ExtFlag.hxx>
48 #endif
49 #ifndef _Extrema_ExtAlgo_HeaderFile
50 #include <Extrema_ExtAlgo.hxx>
51 #endif
52 #ifndef _Standard_Boolean_HeaderFile
53 #include <Standard_Boolean.hxx>
54 #endif
55 #ifndef _Standard_Real_HeaderFile
56 #include <Standard_Real.hxx>
57 #endif
58 class TopoDS_Vertex;
59 class TopoDS_Face;
60 class gp_Pnt;
61
62
63 class BRepExtrema_ExtPF
64 {
65  public:
66
67   DEFINE_STANDARD_ALLOC
68
69   Standard_EXPORT BRepExtrema_ExtPF()
70   {}
71   //! It calculates all the distances. <br>
72   Standard_EXPORT BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex,const TopoDS_Face& TheFace,
73                                     const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
74                                     const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
75   
76   Standard_EXPORT void Initialize(const TopoDS_Face& TheFace,
77                                   const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
78                                   const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
79
80   //! An exception is raised if the fields have not been initialized. <br>
81   //! Be careful: this method uses the Face only for classify not for the fields. <br>
82   Standard_EXPORT void Perform(const TopoDS_Vertex& TheVertex,const TopoDS_Face& TheFace);
83   //! True if the distances are found. <br>
84   Standard_EXPORT Standard_Boolean IsDone() const
85   {
86     return myExtPS.IsDone();
87   }
88   //! Returns the number of extremum distances. <br>
89   Standard_EXPORT Standard_Integer NbExt() const
90   {
91     return myPoints.Length();
92   }
93   //! Returns the value of the <N>th extremum square distance. <br>
94   Standard_EXPORT Standard_Real SquareDistance(const Standard_Integer N) const
95   {
96     return mySqDist.Value(N);
97   }
98   //! Returns the parameters on the Face of the <N>th extremum distance. <br>
99   Standard_EXPORT void Parameter(const Standard_Integer N,Standard_Real& U,Standard_Real& V) const
100   {
101     myPoints.Value(N).Parameter(U, V);
102   }
103   //! Returns the Point of the <N>th extremum distance. <br>
104   Standard_EXPORT gp_Pnt Point(const Standard_Integer N) const
105   {
106     return myPoints.Value(N).Value();
107   }
108
109   Standard_EXPORT void SetFlag(const Extrema_ExtFlag F)
110   {
111     myExtPS.SetFlag(F);
112   }
113
114   Standard_EXPORT void SetAlgo(const Extrema_ExtAlgo A)
115   {
116     myExtPS.SetAlgo(A);
117   }
118
119  private:
120
121   Extrema_ExtPS myExtPS;
122   TColStd_SequenceOfReal mySqDist;
123   Extrema_SequenceOfPOnSurf myPoints;
124   BRepAdaptor_Surface mySurf;
125 };
126
127 #endif