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_ExtremaSurfaceSurface_HeaderFile
0018 #define _GeomAPI_ExtremaSurfaceSurface_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_ExtSS.hxx>
0026 class Geom_Surface;
0027 class gp_Pnt;
0028 
0029 
0030 //! Describes functions for computing all the extrema
0031 //! between two surfaces.
0032 //! An ExtremaSurfaceSurface algorithm minimizes or
0033 //! maximizes the distance between a point on the first
0034 //! surface and a point on the second surface. Results
0035 //! are start and end points of perpendiculars common to the two surfaces.
0036 //! Solutions consist of pairs of points, and an extremum
0037 //! is considered to be a segment joining the two points of a solution.
0038 //! An ExtremaSurfaceSurface object provides a framework for:
0039 //! -   defining the construction of the extrema,
0040 //! -   implementing the construction algorithm, and
0041 //! -   consulting the results.
0042 //! Warning
0043 //! In some cases, the nearest points between the two
0044 //! surfaces do not correspond to one of the computed
0045 //! extrema. Instead, they may be given by:
0046 //! -   a point of a bounding curve of one surface and one of the following:
0047 //! -   its orthogonal projection on the other surface,
0048 //! -   a point of a bounding curve of the other surface; or
0049 //! -   any point on intersection curves between the two surfaces.
0050 class GeomAPI_ExtremaSurfaceSurface 
0051 {
0052 public:
0053 
0054   DEFINE_STANDARD_ALLOC
0055 
0056   
0057   //! Constructs an empty algorithm for computing
0058   //! extrema between two surfaces. Use an Init function
0059   //! to define the surfaces on which it is going to work.
0060   Standard_EXPORT GeomAPI_ExtremaSurfaceSurface();
0061   
0062   //! Computes  the  extrema  distances  between  the
0063   //! surfaces <S1>  and <S2>
0064   Standard_EXPORT GeomAPI_ExtremaSurfaceSurface(const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2);
0065   
0066   //! Computes  the  extrema  distances  between
0067   //! the portion of the surface S1 limited by the
0068   //! two values of parameter (U1min,U1max) in
0069   //! the u parametric direction, and by the two
0070   //! values of parameter (V1min,V1max) in the v
0071   //! parametric direction, and
0072   //! -   the portion of the surface S2 limited by the
0073   //! two values of parameter (U2min,U2max) in
0074   //! the u parametric direction, and by the two
0075   //! values of parameter (V2min,V2max) in the v
0076   //! parametric direction.
0077   Standard_EXPORT GeomAPI_ExtremaSurfaceSurface(const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2, const Standard_Real U1min, const Standard_Real U1max, const Standard_Real V1min, const Standard_Real V1max, const Standard_Real U2min, const Standard_Real U2max, const Standard_Real V2min, const Standard_Real V2max);
0078   
0079   //! Initializes this algorithm with the given arguments
0080   //! and computes  the  extrema  distances  between  the
0081   //! surfaces <S1>  and <S2>
0082   Standard_EXPORT void Init (const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2);
0083   
0084   //! Initializes this algorithm with the given arguments
0085   //! and computes  the  extrema  distances  between -
0086   //! the portion of the surface S1 limited by the two
0087   //! values of parameter (U1min,U1max) in the u
0088   //! parametric direction, and by the two values of
0089   //! parameter (V1min,V1max) in the v parametric direction, and
0090   //! -   the portion of the surface S2 limited by the two
0091   //! values of parameter (U2min,U2max) in the u
0092   //! parametric direction, and by the two values of
0093   //! parameter (V2min,V2max) in the v parametric direction.
0094   Standard_EXPORT void Init (const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2, const Standard_Real U1min, const Standard_Real U1max, const Standard_Real V1min, const Standard_Real V1max, const Standard_Real U2min, const Standard_Real U2max, const Standard_Real V2min, const Standard_Real V2max);
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 first surface and P2 on
0102   //! the second surface, which are the ends of the
0103   //! extremum of index 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 (U1,V1) of the point on the
0111   //! first surface, and (U2,V2) of the point on the second
0112   //! surface, which are the ends of the extremum of index
0113   //! Index computed by this algorithm.
0114   //! Exceptions
0115   //! Standard_OutOfRange if Index is not in the range [
0116   //! 1,NbExtrema ], where NbExtrema is the
0117   //! number of extrema computed by this algorithm.
0118   Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& U1, Standard_Real& V1, Standard_Real& U2, Standard_Real& V2) const;
0119   
0120   //! Computes the distance between the end points of the
0121   //! extremum of index Index computed by this algorithm.
0122   //! Exceptions
0123   //! Standard_OutOfRange if Index is not in the range [
0124   //! 1,NbExtrema ], where NbExtrema is the
0125   //! number of extrema computed by this algorithm.
0126   Standard_EXPORT Standard_Real Distance (const Standard_Integer Index) const;
0127 
0128   //! Returns True if the surfaces are parallel
0129   Standard_Boolean IsParallel() const
0130   {
0131     return myExtSS.IsParallel();
0132   }
0133   
0134   //! Returns the points P1 on the first surface and P2 on
0135   //! the second surface, which are the ends of the
0136   //! shortest extremum computed by this algorithm.
0137   //! Exceptions StdFail_NotDone if this algorithm fails.
0138   Standard_EXPORT void NearestPoints (gp_Pnt& P1, gp_Pnt& P2) const;
0139   
0140   //! Returns the parameters (U1,V1) of the point on the
0141   //! first surface and (U2,V2) of the point on the second
0142   //! surface, which are the ends of the shortest extremum
0143   //! computed by this algorithm.
0144   //! Exceptions - StdFail_NotDone if this algorithm fails.
0145   Standard_EXPORT void LowerDistanceParameters (Standard_Real& U1, Standard_Real& V1, Standard_Real& U2, Standard_Real& V2) const;
0146   
0147   //! Computes the distance between the end points of the
0148   //! shortest extremum computed by this algorithm.
0149   //! Exceptions StdFail_NotDone if this algorithm fails.
0150   Standard_EXPORT Standard_Real LowerDistance() const;
0151 Standard_EXPORT operator Standard_Real() const;
0152   
0153   //! return the algorithmic object from Extrema
0154     const Extrema_ExtSS& Extrema() const;
0155 
0156 private:
0157 
0158   Standard_Boolean myIsDone;
0159   Standard_Integer myIndex;
0160   Extrema_ExtSS myExtSS;
0161 
0162 };
0163 
0164 
0165 #include <GeomAPI_ExtremaSurfaceSurface.lxx>
0166 
0167 
0168 
0169 
0170 
0171 #endif // _GeomAPI_ExtremaSurfaceSurface_HeaderFile