Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:37

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 
0031 //! Describes functions for computing all the extrema
0032 //! between a curve and a surface.
0033 //! An ExtremaCurveSurface algorithm minimizes or
0034 //! maximizes the distance between a point on the curve
0035 //! and a point on the surface. Thus, it computes start
0036 //! and end points of perpendiculars common to the
0037 //! curve and the surface (an intersection point is not an
0038 //! extremum except where the curve and the surface
0039 //! are tangential at this point).
0040 //! Solutions consist of pairs of points, and an extremum
0041 //! is considered to be a segment joining the two points of a solution.
0042 //! An ExtremaCurveSurface object provides a framework for:
0043 //! -   defining the construction of the extrema,
0044 //! -   implementing the construction algorithm, and
0045 //! -   consulting the results.
0046 //! Warning
0047 //! In some cases, the nearest points between a curve
0048 //! and a surface do not correspond to one of the
0049 //! computed extrema. Instead, they may be given by:
0050 //! -   a point of a bounding curve of the surface and one of the following:
0051 //! -   its orthogonal projection on the curve,
0052 //! -   a limit point of the curve; or
0053 //! -   a limit point of the curve and its projection on the surface; or
0054 //! -   an intersection point between the curve and the surface.
0055 class GeomAPI_ExtremaCurveSurface 
0056 {
0057 public:
0058 
0059   DEFINE_STANDARD_ALLOC
0060 
0061   
0062   //! Constructs an empty algorithm for computing
0063   //! extrema between a curve and a surface. Use an
0064   //! Init function to define the curve and the surface on
0065   //! which it is going to work.
0066   Standard_EXPORT GeomAPI_ExtremaCurveSurface();
0067   
0068   //! Computes  the  extrema  distances  between  the
0069   //! curve <C> and the surface  <S>.
0070   Standard_EXPORT GeomAPI_ExtremaCurveSurface(const Handle(Geom_Curve)& Curve, const Handle(Geom_Surface)& Surface);
0071   
0072   //! Computes  the  extrema  distances  between  the
0073   //! curve <C>  and the  surface  <S>.  The solution
0074   //! point are computed in the domain [Wmin,Wmax] of
0075   //! the  curve   and  in  the  domain   [Umin,Umax]
0076   //! [Vmin,Vmax] of the surface.
0077   //! Warning
0078   //! Use the function NbExtrema to obtain the number
0079   //! of solutions. If this algorithm fails, NbExtrema returns 0.
0080   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);
0081   
0082   //! Computes  the  extrema  distances  between  the
0083   //! curve <C> and the surface  <S>.
0084   Standard_EXPORT void Init (const Handle(Geom_Curve)& Curve, const Handle(Geom_Surface)& Surface);
0085   
0086   //! Computes  the  extrema  distances  between  the
0087   //! curve <C>  and the  surface  <S>.  The solution
0088   //! point are computed in the domain [Wmin,Wmax] of
0089   //! the  curve   and  in  the  domain   [Umin,Umax]
0090   //! [Vmin,Vmax] of the surface.
0091   //! Warning
0092   //! Use the function NbExtrema to obtain the number
0093   //! of solutions. If this algorithm fails, NbExtrema returns 0.
0094   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);
0095   
0096   //! Returns the number of extrema computed by this algorithm.
0097   //! Note: if this algorithm fails, NbExtrema returns 0.
0098   Standard_EXPORT Standard_Integer NbExtrema() const;
0099 Standard_EXPORT operator Standard_Integer() const;
0100   
0101   //! Returns the points P1 on the curve and P2 on the
0102   //! surface, which are the ends of the extremum of index
0103   //! Index computed by this algorithm.
0104   //! Exceptions
0105   //! Standard_OutOfRange if Index is not in the range [
0106   //! 1,NbExtrema ], where NbExtrema is the
0107   //! number of extrema computed by this algorithm.
0108   Standard_EXPORT void Points (const Standard_Integer Index, gp_Pnt& P1, gp_Pnt& P2) const;
0109   
0110   //! Returns the parameters W of the point on the curve,
0111   //! and (U,V) of the point on the surface, which are the
0112   //! ends of the extremum of index Index computed by this algorithm.
0113   //! Exceptions
0114   //! Standard_OutOfRange if Index is not in the range [
0115   //! 1,NbExtrema ], where NbExtrema is the
0116   //! number of extrema computed by this algorithm.
0117   Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& W, Standard_Real& U, Standard_Real& V) const;
0118   
0119   //! Computes the distance between the end points of the
0120   //! extremum of index Index computed by this algorithm.
0121   //! Exceptions
0122   //! Standard_OutOfRange if index is not in the range [
0123   //! 1,NbExtrema ], where NbExtrema is the
0124   //! number of extrema computed by this algorithm.
0125   Standard_EXPORT Standard_Real Distance (const Standard_Integer Index) const;
0126 
0127   //! Returns True if the curve is on a parallel surface.
0128   Standard_Boolean IsParallel() const
0129   {
0130     return myExtCS.IsParallel();
0131   }
0132   
0133   //! Returns the points PC on the curve and PS on the
0134   //! surface, which are the ends of the shortest extremum computed by this algorithm.
0135   //! Exceptions - StdFail_NotDone if this algorithm fails.
0136   Standard_EXPORT void NearestPoints (gp_Pnt& PC, gp_Pnt& PS) const;
0137   
0138   //! Returns the parameters W of the point on the curve
0139   //! and (U,V) of the point on the surface, which are the
0140   //! ends of the shortest extremum computed by this algorithm.
0141   //! Exceptions - StdFail_NotDone if this algorithm fails.
0142   Standard_EXPORT void LowerDistanceParameters (Standard_Real& W, Standard_Real& U, Standard_Real& V) const;
0143   
0144   //! Computes the distance between the end points of the
0145   //! shortest extremum computed by this algorithm.
0146   //! Exceptions - StdFail_NotDone if this algorithm fails.
0147   Standard_EXPORT Standard_Real LowerDistance() const;
0148 Standard_EXPORT operator Standard_Real() const;
0149   
0150   //! Returns the algorithmic object from Extrema
0151     const Extrema_ExtCS& Extrema() const;
0152 
0153 private:
0154 
0155   Standard_Boolean myIsDone;
0156   Standard_Integer myIndex;
0157   Extrema_ExtCS myExtCS;
0158 
0159 };
0160 
0161 
0162 #include <GeomAPI_ExtremaCurveSurface.lxx>
0163 
0164 
0165 
0166 
0167 
0168 #endif // _GeomAPI_ExtremaCurveSurface_HeaderFile