0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / Extrema / Extrema_ExtPElC.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_ExtPElC_HeaderFile
18 #define _Extrema_ExtPElC_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_POnCurv.hxx>
28 class StdFail_NotDone;
29 class Standard_OutOfRange;
30 class gp_Pnt;
31 class gp_Lin;
32 class gp_Circ;
33 class gp_Elips;
34 class gp_Hypr;
35 class gp_Parab;
36 class Extrema_POnCurv;
37
38
39 //! It calculates all the distances between a point
40 //! and an elementary curve.
41 //! These distances can be minimum or maximum.
42 class Extrema_ExtPElC 
43 {
44 public:
45
46   DEFINE_STANDARD_ALLOC
47
48   
49   Standard_EXPORT Extrema_ExtPElC();
50   
51   //! Calculates the extremum distance between the
52   //! point P and the segment [Uinf,Usup] of the line C.
53   Standard_EXPORT Extrema_ExtPElC(const gp_Pnt& P, const gp_Lin& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
54   
55   Standard_EXPORT void Perform (const gp_Pnt& P, const gp_Lin& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
56   
57   //! Calculates the 2 extremum distances between the
58   //! point P and the segment [Uinf,Usup] of the circle C.
59   //! Tol is used to determine
60   //! if P is on the axis of the circle or
61   //! if an extremum is on an endpoint of the segment.
62   //! If P is on the axis of the circle,
63   //! there are infinite solution then IsDone(me)=False.
64   //! The conditions on the Uinf and Usup are:
65   //! 0. <= Uinf <= 2.*PI and Usup > Uinf.
66   //! If Usup > Uinf + 2.*PI, then only the solutions in
67   //! the range [Uinf,Uinf+2.*PI[ are computed.
68   Standard_EXPORT Extrema_ExtPElC(const gp_Pnt& P, const gp_Circ& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
69   
70   Standard_EXPORT void Perform (const gp_Pnt& P, const gp_Circ& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
71   
72   //! Calculates the 4 extremum distances between the
73   //! point P and the segment [Uinf,Usup] of the elipse C.
74   //! Tol is used to determine
75   //! if the point is on the axis of the elipse and
76   //! if the major radius is equal to the minor radius or
77   //! if an extremum is on an endpoint of the segment.
78   //! If P is on the axis of the elipse,
79   //! there are infinite solution then IsDone(me)=False.
80   //! The conditions on the Uinf and Usup are:
81   //! 0. <= Uinf <= 2.*PI and Usup > Uinf.
82   //! If Usup > Uinf + 2.*PI, then only the solutions in
83   //! the range [Uinf,Uinf+2.*PI[ are computed.
84   Standard_EXPORT Extrema_ExtPElC(const gp_Pnt& P, const gp_Elips& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
85   
86   Standard_EXPORT void Perform (const gp_Pnt& P, const gp_Elips& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
87   
88   //! Calculates the extremum distances between the
89   //! point P and the segment [Uinf,Usup] of the hyperbola
90   //! C.
91   //! Tol is used to determine if two solutions u and v
92   //! are identical; the condition is:
93   //! dist(C(u),C(v)) < Tol.
94   Standard_EXPORT Extrema_ExtPElC(const gp_Pnt& P, const gp_Hypr& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
95   
96   Standard_EXPORT void Perform (const gp_Pnt& P, const gp_Hypr& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
97   
98   //! Calculates the 4 extremum distances between the
99   //! point P and the segment [Uinf,Usup] of the parabola
100   //! C.
101   //! Tol is used to determine if two solutions u and v
102   //! are identical; the condition is:
103   //! dist(C(u),C(v)) < Tol.
104   Standard_EXPORT Extrema_ExtPElC(const gp_Pnt& P, const gp_Parab& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
105   
106   Standard_EXPORT void Perform (const gp_Pnt& P, const gp_Parab& C, const Standard_Real Tol, const Standard_Real Uinf, const Standard_Real Usup);
107   
108   //! True if the distances are found.
109   Standard_EXPORT Standard_Boolean IsDone() const;
110   
111   //! Returns the number of extremum distances.
112   Standard_EXPORT Standard_Integer NbExt() const;
113   
114   //! Returns the value of the Nth extremum square distance.
115   Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
116   
117   //! Returns True if the Nth extremum distance is a
118   //! minimum.
119   Standard_EXPORT Standard_Boolean IsMin (const Standard_Integer N) const;
120   
121   //! Returns the point of the Nth extremum distance.
122   Standard_EXPORT const Extrema_POnCurv& Point (const Standard_Integer N) const;
123
124
125
126
127 protected:
128
129
130
131
132
133 private:
134
135
136
137   Standard_Boolean myDone;
138   Standard_Integer myNbExt;
139   Standard_Real mySqDist[4];
140   Standard_Boolean myIsMin[4];
141   Extrema_POnCurv myPoint[4];
142
143
144 };
145
146
147
148
149
150
151
152 #endif // _Extrema_ExtPElC_HeaderFile