0030686: Visualization, SelectMgr_ViewerSelector - sorting issues of transformation...
[occt.git] / src / Extrema / Extrema_ExtPElS.hxx
1 // Created on: 1991-02-21
2 // Created by: Isabelle GRIGNON
3 // Copyright (c) 1991-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 _Extrema_ExtPElS_HeaderFile
18 #define _Extrema_ExtPElS_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <Standard_Real.hxx>
27 #include <Extrema_POnSurf.hxx>
28 class StdFail_NotDone;
29 class Standard_OutOfRange;
30 class gp_Pnt;
31 class gp_Cylinder;
32 class gp_Pln;
33 class gp_Cone;
34 class gp_Torus;
35 class gp_Sphere;
36 class Extrema_POnSurf;
37
38
39 //! It calculates all the extremum distances
40 //! between a point and a surface.
41 //! These distances can be minimum or maximum.
42 class Extrema_ExtPElS 
43 {
44 public:
45
46   DEFINE_STANDARD_ALLOC
47
48   
49   Standard_EXPORT Extrema_ExtPElS();
50   
51   //! It calculates all the distances between a point
52   //! and a cylinder from gp.
53   //! Tol is used to test if the point is on the axis.
54   Standard_EXPORT Extrema_ExtPElS(const gp_Pnt& P, const gp_Cylinder& S, const Standard_Real Tol);
55   
56   Standard_EXPORT void Perform (const gp_Pnt& P, const gp_Cylinder& S, const Standard_Real Tol);
57   
58   //! It calculates all the distances between a point
59   //! and a plane from gp.
60   //! Tol is used to test if the point is on the plane.
61   Standard_EXPORT Extrema_ExtPElS(const gp_Pnt& P, const gp_Pln& S, const Standard_Real Tol);
62   
63   Standard_EXPORT void Perform (const gp_Pnt& P, const gp_Pln& S, const Standard_Real Tol);
64   
65   //! It calculates all the distances between a point
66   //! and a cone from gp.
67   //! Tol is used to test if the point is at the apex or
68   //! on the axis.
69   Standard_EXPORT Extrema_ExtPElS(const gp_Pnt& P, const gp_Cone& S, const Standard_Real Tol);
70   
71   Standard_EXPORT void Perform (const gp_Pnt& P, const gp_Cone& S, const Standard_Real Tol);
72   
73   //! It calculates all the distances between a point
74   //! and a torus from gp.
75   //! Tol is used to test if the point is on the axis.
76   Standard_EXPORT Extrema_ExtPElS(const gp_Pnt& P, const gp_Torus& S, const Standard_Real Tol);
77   
78   Standard_EXPORT void Perform (const gp_Pnt& P, const gp_Torus& S, const Standard_Real Tol);
79   
80   //! It calculates all the distances between a point
81   //! and a sphere from gp.
82   //! Tol is used to test if the point is at the center.
83   Standard_EXPORT Extrema_ExtPElS(const gp_Pnt& P, const gp_Sphere& S, const Standard_Real Tol);
84   
85   Standard_EXPORT void Perform (const gp_Pnt& P, const gp_Sphere& S, const Standard_Real Tol);
86   
87   //! Returns True if the distances are found.
88   Standard_EXPORT Standard_Boolean IsDone() const;
89   
90   //! Returns the number of extremum distances.
91   Standard_EXPORT Standard_Integer NbExt() const;
92   
93   //! Returns the value of the Nth resulting square distance.
94   Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
95   
96   //! Returns the point of the Nth resulting distance.
97   Standard_EXPORT const Extrema_POnSurf& Point (const Standard_Integer N) const;
98
99
100
101
102 protected:
103
104
105
106
107
108 private:
109
110
111
112   Standard_Boolean myDone;
113   Standard_Integer myNbExt;
114   Standard_Real mySqDist[4];
115   Extrema_POnSurf myPoint[4];
116
117
118 };
119
120
121
122
123
124
125
126 #endif // _Extrema_ExtPElS_HeaderFile