Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-17 08:35:16

0001 // Created on: 1994-03-18
0002 // Created by: Bruno DUMORTIER
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _GeomAPI_ExtremaCurveSurface_HeaderFile
0018 #define _GeomAPI_ExtremaCurveSurface_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <Extrema_ExtCS.hxx>
0026 class Geom_Curve;
0027 class Geom_Surface;
0028 class gp_Pnt;
0029 
0030 //! Describes functions for computing all the extrema
0031 //! between a curve and a surface.
0032 //! An ExtremaCurveSurface algorithm minimizes or
0033 //! maximizes the distance between a point on the curve
0034 //! and a point on the surface. Thus, it computes start
0035 //! and end points of perpendiculars common to the
0036 //! curve and the surface (an intersection point is not an
0037 //! extremum except where the curve and the surface
0038 //! are tangential at this point).
0039 //! Solutions consist of pairs of points, and an extremum
0040 //! is considered to be a segment joining the two points of a solution.
0041 //! An ExtremaCurveSurface object provides a framework for:
0042 //! -   defining the construction of the extrema,
0043 //! -   implementing the construction algorithm, and
0044 //! -   consulting the results.
0045 //! Warning
0046 //! In some cases, the nearest points between a curve
0047 //! and a surface do not correspond to one of the
0048 //! computed extrema. Instead, they may be given by:
0049 //! -   a point of a bounding curve of the surface and one of the following:
0050 //! -   its orthogonal projection on the curve,
0051 //! -   a limit point of the curve; or
0052 //! -   a limit point of the curve and its projection on the surface; or
0053 //! -   an intersection point between the curve and the surface.
0054 class GeomAPI_ExtremaCurveSurface
0055 {
0056 public:
0057   DEFINE_STANDARD_ALLOC
0058 
0059   //! Constructs an empty algorithm for computing
0060   //! extrema between a curve and a surface. Use an
0061   //! Init function to define the curve and the surface on
0062   //! which it is going to work.
0063   Standard_EXPORT GeomAPI_ExtremaCurveSurface();
0064 
0065   //! Computes  the  extrema  distances  between  the
0066   //! curve <C> and the surface  <S>.
0067   Standard_EXPORT GeomAPI_ExtremaCurveSurface(const Handle(Geom_Curve)&   Curve,
0068                                               const Handle(Geom_Surface)& Surface);
0069 
0070   //! Computes  the  extrema  distances  between  the
0071   //! curve <C>  and the  surface  <S>.  The solution
0072   //! point are computed in the domain [Wmin,Wmax] of
0073   //! the  curve   and  in  the  domain   [Umin,Umax]
0074   //! [Vmin,Vmax] of the surface.
0075   //! Warning
0076   //! Use the function NbExtrema to obtain the number
0077   //! of solutions. If this algorithm fails, NbExtrema returns 0.
0078   Standard_EXPORT GeomAPI_ExtremaCurveSurface(const Handle(Geom_Curve)&   Curve,
0079                                               const Handle(Geom_Surface)& Surface,
0080                                               const Standard_Real         Wmin,
0081                                               const Standard_Real         Wmax,
0082                                               const Standard_Real         Umin,
0083                                               const Standard_Real         Umax,
0084                                               const Standard_Real         Vmin,
0085                                               const Standard_Real         Vmax);
0086 
0087   //! Computes  the  extrema  distances  between  the
0088   //! curve <C> and the surface  <S>.
0089   Standard_EXPORT void Init(const Handle(Geom_Curve)& Curve, const Handle(Geom_Surface)& Surface);
0090 
0091   //! Computes  the  extrema  distances  between  the
0092   //! curve <C>  and the  surface  <S>.  The solution
0093   //! point are computed in the domain [Wmin,Wmax] of
0094   //! the  curve   and  in  the  domain   [Umin,Umax]
0095   //! [Vmin,Vmax] of the surface.
0096   //! Warning
0097   //! Use the function NbExtrema to obtain the number
0098   //! of solutions. If this algorithm fails, NbExtrema returns 0.
0099   Standard_EXPORT void Init(const Handle(Geom_Curve)&   Curve,
0100                             const Handle(Geom_Surface)& Surface,
0101                             const Standard_Real         Wmin,
0102                             const Standard_Real         Wmax,
0103                             const Standard_Real         Umin,
0104                             const Standard_Real         Umax,
0105                             const Standard_Real         Vmin,
0106                             const Standard_Real         Vmax);
0107 
0108   //! Returns the number of extrema computed by this algorithm.
0109   //! Note: if this algorithm fails, NbExtrema returns 0.
0110   Standard_EXPORT Standard_Integer NbExtrema() const;
0111   Standard_EXPORT                  operator Standard_Integer() const;
0112 
0113   //! Returns the points P1 on the curve and P2 on the
0114   //! surface, which are the ends of the extremum of index
0115   //! Index computed by this algorithm.
0116   //! Exceptions
0117   //! Standard_OutOfRange if Index is not in the range [
0118   //! 1,NbExtrema ], where NbExtrema is the
0119   //! number of extrema computed by this algorithm.
0120   Standard_EXPORT void Points(const Standard_Integer Index, gp_Pnt& P1, gp_Pnt& P2) const;
0121 
0122   //! Returns the parameters W of the point on the curve,
0123   //! and (U,V) of the point on the surface, which are the
0124   //! ends of the extremum of index Index computed by this algorithm.
0125   //! Exceptions
0126   //! Standard_OutOfRange if Index is not in the range [
0127   //! 1,NbExtrema ], where NbExtrema is the
0128   //! number of extrema computed by this algorithm.
0129   Standard_EXPORT void Parameters(const Standard_Integer Index,
0130                                   Standard_Real&         W,
0131                                   Standard_Real&         U,
0132                                   Standard_Real&         V) const;
0133 
0134   //! Computes the distance between the end points of the
0135   //! extremum of index Index computed by this algorithm.
0136   //! Exceptions
0137   //! Standard_OutOfRange if index is not in the range [
0138   //! 1,NbExtrema ], where NbExtrema is the
0139   //! number of extrema computed by this algorithm.
0140   Standard_EXPORT Standard_Real Distance(const Standard_Integer Index) const;
0141 
0142   //! Returns True if the curve is on a parallel surface.
0143   Standard_Boolean IsParallel() const { return myExtCS.IsParallel(); }
0144 
0145   //! Returns the points PC on the curve and PS on the
0146   //! surface, which are the ends of the shortest extremum computed by this algorithm.
0147   //! Exceptions - StdFail_NotDone if this algorithm fails.
0148   Standard_EXPORT void NearestPoints(gp_Pnt& PC, gp_Pnt& PS) const;
0149 
0150   //! Returns the parameters W of the point on the curve
0151   //! and (U,V) of the point on the surface, which are the
0152   //! ends of the shortest extremum computed by this algorithm.
0153   //! Exceptions - StdFail_NotDone if this algorithm fails.
0154   Standard_EXPORT void LowerDistanceParameters(Standard_Real& W,
0155                                                Standard_Real& U,
0156                                                Standard_Real& V) const;
0157 
0158   //! Computes the distance between the end points of the
0159   //! shortest extremum computed by this algorithm.
0160   //! Exceptions - StdFail_NotDone if this algorithm fails.
0161   Standard_EXPORT Standard_Real LowerDistance() const;
0162   Standard_EXPORT               operator Standard_Real() const;
0163 
0164   //! Returns the algorithmic object from Extrema
0165   const Extrema_ExtCS& Extrema() const;
0166 
0167 private:
0168   Standard_Boolean myIsDone;
0169   Standard_Integer myIndex;
0170   Extrema_ExtCS    myExtCS;
0171 };
0172 
0173 #include <GeomAPI_ExtremaCurveSurface.lxx>
0174 
0175 #endif // _GeomAPI_ExtremaCurveSurface_HeaderFile