Back to home page

EIC code displayed by LXR

 
 

    


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

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_GenExtPS_HeaderFile
0018 #define _Extrema_GenExtPS_HeaderFile
0019 
0020 #include <Bnd_HArray1OfSphere.hxx>
0021 #include <Extrema_Array2OfPOnSurfParams.hxx>
0022 #include <Extrema_POnSurfParams.hxx>
0023 #include <Extrema_HUBTreeOfSphere.hxx>
0024 #include <Extrema_FuncPSNorm.hxx>
0025 #include <Extrema_ExtFlag.hxx>
0026 #include <Extrema_ExtAlgo.hxx>
0027 #include <TColStd_HArray1OfReal.hxx>
0028 
0029 class Adaptor3d_Surface;
0030 
0031 //! It calculates all the extremum distances
0032 //! between a point and a surface.
0033 //! These distances can be minimum or maximum.
0034 class Extrema_GenExtPS 
0035 {
0036 public:
0037 
0038   DEFINE_STANDARD_ALLOC
0039 
0040   //! Empty constructor.
0041   Standard_EXPORT Extrema_GenExtPS();
0042 
0043   //! Destructor.
0044   Standard_EXPORT ~Extrema_GenExtPS();
0045 
0046   //! It calculates all the distances.
0047   //! The function F(u,v)=distance(P,S(u,v)) has an
0048   //! extremum when gradient(F)=0. The algorithm searches
0049   //! all the zeros inside the definition ranges of the
0050   //! surface.
0051   //! NbU and NbV are used to locate the close points
0052   //! to find the zeros. They must be great enough
0053   //! such that if there is N extrema, there will
0054   //! be N extrema between P and the grid.
0055   //! TolU et TolV are used to determine the conditions
0056   //! to stop the iterations; at the iteration number n:
0057   //! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
0058   Standard_EXPORT Extrema_GenExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
0059   
0060   //! It calculates all the distances.
0061   //! The function F(u,v)=distance(P,S(u,v)) has an
0062   //! extremum when gradient(F)=0. The algorithm searches
0063   //! all the zeros inside the definition ranges of the
0064   //! surface.
0065   //! NbU and NbV are used to locate the close points
0066   //! to find the zeros. They must be great enough
0067   //! such that if there is N extrema, there will
0068   //! be N extrema between P and the grid.
0069   //! TolU et TolV are used to determine the conditions
0070   //! to stop the iterations; at the iteration number n:
0071   //! (Un - Un-1) < TolU and (Vn - Vn-1) < TolV .
0072   Standard_EXPORT Extrema_GenExtPS(const gp_Pnt& P, const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV, const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX, const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
0073   
0074   Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real TolU, const Standard_Real TolV);
0075   
0076   Standard_EXPORT void Initialize (const Adaptor3d_Surface& S, const Standard_Integer NbU, const Standard_Integer NbV, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real TolU, const Standard_Real TolV);
0077   
0078   //! the algorithm is done with the point P.
0079   //! An exception is raised if the fields have not
0080   //! been initialized.
0081   Standard_EXPORT void Perform (const gp_Pnt& P);
0082   
0083   Standard_EXPORT void SetFlag (const Extrema_ExtFlag F);
0084   
0085   Standard_EXPORT void SetAlgo (const Extrema_ExtAlgo A);
0086   
0087   //! Returns True if the distances are found.
0088   Standard_EXPORT Standard_Boolean IsDone() const;
0089   
0090   //! Returns the number of extremum distances.
0091   Standard_EXPORT Standard_Integer NbExt() const;
0092   
0093   //! Returns the value of the Nth resulting square distance.
0094   Standard_EXPORT Standard_Real SquareDistance (const Standard_Integer N) const;
0095   
0096   //! Returns the point of the Nth resulting distance.
0097   Standard_EXPORT const Extrema_POnSurf& Point (const Standard_Integer N) const;
0098 
0099 private:
0100   
0101   Standard_EXPORT void BuildTree();
0102   
0103   Standard_EXPORT void FindSolution (const gp_Pnt& P, const Extrema_POnSurfParams& theParams);
0104   
0105   //! Selection of points to build grid, depending on the type of surface
0106   Standard_EXPORT void GetGridPoints (const Adaptor3d_Surface& theSurf);
0107   
0108   //! Creation of grid of parametric points
0109   Standard_EXPORT void BuildGrid (const gp_Pnt& thePoint);
0110   
0111   //! Compute new edge parameters.
0112   Standard_EXPORT const Extrema_POnSurfParams& ComputeEdgeParameters (const Standard_Boolean IsUEdge, const Extrema_POnSurfParams& theParam0, const Extrema_POnSurfParams& theParam1, const gp_Pnt& thePoints, const Standard_Real theDiffTol);
0113 
0114 private:
0115 
0116   // disallow copies
0117   Extrema_GenExtPS            (const Extrema_GenExtPS& ) Standard_DELETE;
0118   Extrema_GenExtPS& operator= (const Extrema_GenExtPS& ) Standard_DELETE;
0119 
0120 private:
0121 
0122   Standard_Boolean myDone;
0123   Standard_Boolean myInit;
0124   Standard_Real myumin;
0125   Standard_Real myusup;
0126   Standard_Real myvmin;
0127   Standard_Real myvsup;
0128   Standard_Integer myusample;
0129   Standard_Integer myvsample;
0130   Standard_Real mytolu;
0131   Standard_Real mytolv;
0132 
0133   Extrema_Array2OfPOnSurfParams myPoints;
0134   Extrema_HUBTreeOfSphere mySphereUBTree;
0135   Handle(Bnd_HArray1OfSphere) mySphereArray;
0136   Extrema_FuncPSNorm myF;
0137   const Adaptor3d_Surface* myS;
0138   Extrema_ExtFlag myFlag;
0139   Extrema_ExtAlgo myAlgo;
0140   Handle(TColStd_HArray1OfReal) myUParams;
0141   Handle(TColStd_HArray1OfReal) myVParams;
0142   Extrema_Array2OfPOnSurfParams myFacePntParams;
0143   Extrema_Array2OfPOnSurfParams myUEdgePntParams;
0144   Extrema_Array2OfPOnSurfParams myVEdgePntParams;
0145   Extrema_POnSurfParams myGridParam;
0146 
0147 };
0148 
0149 #endif // _Extrema_GenExtPS_HeaderFile