Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-26 09:03:01

0001 // Created on: 1995-07-18
0002 // Created by: Modelistation
0003 // Copyright (c) 1995-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 _Extrema_GenLocateExtPS_HeaderFile
0018 #define _Extrema_GenLocateExtPS_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <Standard_Boolean.hxx>
0024 #include <Extrema_POnSurf.hxx>
0025 class gp_Pnt;
0026 class Adaptor3d_Surface;
0027 
0028 //! With a close point, it calculates the distance
0029 //! between a point and a surface.
0030 //! Criteria type is defined in "Perform" method.
0031 class Extrema_GenLocateExtPS
0032 {
0033 public:
0034   DEFINE_STANDARD_ALLOC
0035 
0036   //! Constructor.
0037   Standard_EXPORT Extrema_GenLocateExtPS(const Adaptor3d_Surface& theS,
0038                                          const double             theTolU = Precision::PConfusion(),
0039                                          const double theTolV = Precision::PConfusion());
0040 
0041   //! Calculates the extrema between the point and the surface using a close point.
0042   //! The close point is defined by the parameter values theU0 and theV0.
0043   //! Type of the algorithm depends on the isDistanceCriteria flag.
0044   //! If flag value is false - normal projection criteria will be used.
0045   //! If flag value is true - distance criteria will be used.
0046   Standard_EXPORT void Perform(const gp_Pnt& theP,
0047                                const double  theU0,
0048                                const double  theV0,
0049                                const bool    isDistanceCriteria = false);
0050 
0051   //! Returns True if the distance is found.
0052   Standard_EXPORT bool IsDone() const;
0053 
0054   //! Returns the value of the extremum square distance.
0055   Standard_EXPORT double SquareDistance() const;
0056 
0057   //! Returns the point of the extremum distance.
0058   Standard_EXPORT const Extrema_POnSurf& Point() const;
0059 
0060   //! Returns True if UV point theU0, theV0 is point of local minimum of square distance between
0061   //! point theP and points theS(U, V), U, V are in small area around theU0, theV0
0062   Standard_EXPORT static bool IsMinDist(const gp_Pnt&            theP,
0063                                         const Adaptor3d_Surface& theS,
0064                                         const double             theU0,
0065                                         const double             theV0);
0066 
0067 private:
0068   const Extrema_GenLocateExtPS& operator=(const Extrema_GenLocateExtPS&) = delete;
0069   Extrema_GenLocateExtPS(const Extrema_GenLocateExtPS&)                  = delete;
0070 
0071   // Input.
0072   const Adaptor3d_Surface& mySurf;
0073   double                   myTolU, myTolV;
0074 
0075   // State.
0076   bool myDone;
0077 
0078   // Result.
0079   double          mySqDist;
0080   Extrema_POnSurf myPoint;
0081 };
0082 
0083 #endif // _Extrema_GenLocateExtPS_HeaderFile