0028799: Coding Rules - elimilate confusing Quantity aliases of Standard_Real type
[occt.git] / src / GeomAPI / GeomAPI_ExtremaCurveSurface.hxx
1 // Created on: 1994-03-18
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1994-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 _GeomAPI_ExtremaCurveSurface_HeaderFile
18 #define _GeomAPI_ExtremaCurveSurface_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 <Extrema_ExtCS.hxx>
27 class Standard_OutOfRange;
28 class StdFail_NotDone;
29 class Geom_Curve;
30 class Geom_Surface;
31 class gp_Pnt;
32 class Extrema_ExtCS;
33
34
35 //! Describes functions for computing all the extrema
36 //! between a curve and a surface.
37 //! An ExtremaCurveSurface algorithm minimizes or
38 //! maximizes the distance between a point on the curve
39 //! and a point on the surface. Thus, it computes start
40 //! and end points of perpendiculars common to the
41 //! curve and the surface (an intersection point is not an
42 //! extremum except where the curve and the surface
43 //! are tangential at this point).
44 //! Solutions consist of pairs of points, and an extremum
45 //! is considered to be a segment joining the two points of a solution.
46 //! An ExtremaCurveSurface object provides a framework for:
47 //! -   defining the construction of the extrema,
48 //! -   implementing the construction algorithm, and
49 //! -   consulting the results.
50 //! Warning
51 //! In some cases, the nearest points between a curve
52 //! and a surface do not correspond to one of the
53 //! computed extrema. Instead, they may be given by:
54 //! -   a point of a bounding curve of the surface and one of the following:
55 //! -   its orthogonal projection on the curve,
56 //! -   a limit point of the curve; or
57 //! -   a limit point of the curve and its projection on the surface; or
58 //! -   an intersection point between the curve and the surface.
59 class GeomAPI_ExtremaCurveSurface 
60 {
61 public:
62
63   DEFINE_STANDARD_ALLOC
64
65   
66   //! Constructs an empty algorithm for computing
67   //! extrema between a curve and a surface. Use an
68   //! Init function to define the curve and the surface on
69   //! which it is going to work.
70   Standard_EXPORT GeomAPI_ExtremaCurveSurface();
71   
72   //! Computes  the  extrema  distances  between  the
73   //! curve <C> and the surface  <S>.
74   Standard_EXPORT GeomAPI_ExtremaCurveSurface(const Handle(Geom_Curve)& Curve, const Handle(Geom_Surface)& Surface);
75   
76   //! Computes  the  extrema  distances  between  the
77   //! curve <C>  and the  surface  <S>.  The solution
78   //! point are computed in the domain [Wmin,Wmax] of
79   //! the  curve   and  in  the  domain   [Umin,Umax]
80   //! [Vmin,Vmax] of the surface.
81   //! Warning
82   //! Use the function NbExtrema to obtain the number
83   //! of solutions. If this algorithm fails, NbExtrema returns 0.
84   Standard_EXPORT GeomAPI_ExtremaCurveSurface(const Handle(Geom_Curve)& Curve, const Handle(Geom_Surface)& Surface, const Standard_Real Wmin, const Standard_Real Wmax, const Standard_Real Umin, const Standard_Real Umax, const Standard_Real Vmin, const Standard_Real Vmax);
85   
86   //! Computes  the  extrema  distances  between  the
87   //! curve <C> and the surface  <S>.
88   Standard_EXPORT void Init (const Handle(Geom_Curve)& Curve, const Handle(Geom_Surface)& Surface);
89   
90   //! Computes  the  extrema  distances  between  the
91   //! curve <C>  and the  surface  <S>.  The solution
92   //! point are computed in the domain [Wmin,Wmax] of
93   //! the  curve   and  in  the  domain   [Umin,Umax]
94   //! [Vmin,Vmax] of the surface.
95   //! Warning
96   //! Use the function NbExtrema to obtain the number
97   //! of solutions. If this algorithm fails, NbExtrema returns 0.
98   Standard_EXPORT void Init (const Handle(Geom_Curve)& Curve, const Handle(Geom_Surface)& Surface, const Standard_Real Wmin, const Standard_Real Wmax, const Standard_Real Umin, const Standard_Real Umax, const Standard_Real Vmin, const Standard_Real Vmax);
99   
100   //! Returns the number of extrema computed by this algorithm.
101   //! Note: if this algorithm fails, NbExtrema returns 0.
102   Standard_EXPORT Standard_Integer NbExtrema() const;
103 Standard_EXPORT operator Standard_Integer() const;
104   
105   //! Returns the points P1 on the curve and P2 on the
106   //! surface, which are the ends of the extremum of index
107   //! Index computed by this algorithm.
108   //! Exceptions
109   //! Standard_OutOfRange if Index is not in the range [
110   //! 1,NbExtrema ], where NbExtrema is the
111   //! number of extrema computed by this algorithm.
112   Standard_EXPORT void Points (const Standard_Integer Index, gp_Pnt& P1, gp_Pnt& P2) const;
113   
114   //! Returns the parameters W of the point on the curve,
115   //! and (U,V) of the point on the surface, which are the
116   //! ends of the extremum of index Index computed by this algorithm.
117   //! Exceptions
118   //! Standard_OutOfRange if Index is not in the range [
119   //! 1,NbExtrema ], where NbExtrema is the
120   //! number of extrema computed by this algorithm.
121   Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& W, Standard_Real& U, Standard_Real& V) const;
122   
123   //! Computes the distance between the end points of the
124   //! extremum of index Index computed by this algorithm.
125   //! Exceptions
126   //! Standard_OutOfRange if index is not in the range [
127   //! 1,NbExtrema ], where NbExtrema is the
128   //! number of extrema computed by this algorithm.
129   Standard_EXPORT Standard_Real Distance (const Standard_Integer Index) const;
130   
131   //! Returns the points PC on the curve and PS on the
132   //! surface, which are the ends of the shortest extremum computed by this algorithm.
133   //! Exceptions - StdFail_NotDone if this algorithm fails.
134   Standard_EXPORT void NearestPoints (gp_Pnt& PC, gp_Pnt& PS) const;
135   
136   //! Returns the parameters W of the point on the curve
137   //! and (U,V) of the point on the surface, which are the
138   //! ends of the shortest extremum computed by this algorithm.
139   //! Exceptions - StdFail_NotDone if this algorithm fails.
140   Standard_EXPORT void LowerDistanceParameters (Standard_Real& W, Standard_Real& U, Standard_Real& V) const;
141   
142   //! Computes the distance between the end points of the
143   //! shortest extremum computed by this algorithm.
144   //! Exceptions - StdFail_NotDone if this algorithm fails.
145   Standard_EXPORT Standard_Real LowerDistance() const;
146 Standard_EXPORT operator Standard_Real() const;
147   
148   //! Returns the algorithmic object from Extrema
149     const Extrema_ExtCS& Extrema() const;
150
151 private:
152
153   Standard_Boolean myIsDone;
154   Standard_Integer myIndex;
155   Extrema_ExtCS myExtCS;
156
157 };
158
159
160 #include <GeomAPI_ExtremaCurveSurface.lxx>
161
162
163
164
165
166 #endif // _GeomAPI_ExtremaCurveSurface_HeaderFile