Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1994-03-17
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_ProjectPointOnSurf_HeaderFile
0018 #define _GeomAPI_ProjectPointOnSurf_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_ExtPS.hxx>
0026 #include <GeomAdaptor_Surface.hxx>
0027 #include <Extrema_ExtAlgo.hxx>
0028 #include <Extrema_ExtFlag.hxx>
0029 class gp_Pnt;
0030 class Geom_Surface;
0031 
0032 
0033 
0034 //! This class implements methods for  computing all the orthogonal
0035 //! projections of a point onto a  surface.
0036 class GeomAPI_ProjectPointOnSurf 
0037 {
0038 public:
0039 
0040   DEFINE_STANDARD_ALLOC
0041 
0042   
0043   //! Creates an empty object. Use the
0044   //! Init function for further initialization.
0045   Standard_EXPORT GeomAPI_ProjectPointOnSurf();
0046   
0047   //! Create the projection  of a point <P> on a surface
0048   //! <Surface>
0049   Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
0050   
0051   //! Create the projection  of a point <P> on a surface
0052   //! <Surface>
0053   //! Create the projection of a point <P>  on a surface
0054   //! <Surface>. The solution are computed in the domain
0055   //! [Umin,Usup] [Vmin,Vsup] of the surface.
0056   Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
0057   
0058   Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
0059   
0060   //! Init the projection  of a point <P> on a surface
0061   //! <Surface>
0062   Standard_EXPORT GeomAPI_ProjectPointOnSurf(const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
0063   
0064   Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
0065   
0066   //! Init the projection of a point <P>  on a surface
0067   //! <Surface>. The solution are computed in the domain
0068   //! [Umin,Usup] [Vmin,Vsup] of the surface.
0069   Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
0070   
0071   Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
0072   
0073   //! Init the projection for many points on a surface
0074   //! <Surface>. The solutions will be computed in the domain
0075   //! [Umin,Usup] [Vmin,Vsup] of the surface.
0076   Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
0077   
0078   Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Standard_Real Tolerance, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
0079   
0080   Standard_EXPORT void Init (const Handle(Geom_Surface)& Surface, const Standard_Real Umin, const Standard_Real Usup, const Standard_Real Vmin, const Standard_Real Vsup, const Extrema_ExtAlgo Algo = Extrema_ExtAlgo_Grad);
0081 
0082   //! Sets the Extrema search algorithm - Grad or Tree. <br>
0083   //! By default the Extrema is initialized with Grad algorithm.
0084   void SetExtremaAlgo(const Extrema_ExtAlgo theAlgo)
0085   {
0086     myExtPS.SetAlgo(theAlgo);
0087   }
0088 
0089   //! Sets the Extrema search flag - MIN or MAX or MINMAX.<br>
0090   //! By default the Extrema is set to search the MinMax solutions.
0091   void SetExtremaFlag(const Extrema_ExtFlag theExtFlag)
0092   {
0093     myExtPS.SetFlag(theExtFlag);
0094   }
0095 
0096   //! Performs the projection of a point on the current surface.
0097   Standard_EXPORT void Perform (const gp_Pnt& P);
0098   
0099   Standard_EXPORT Standard_Boolean IsDone() const;
0100   
0101   //! Returns the number of computed orthogonal projection points.
0102   //! Note: if projection fails, NbPoints returns 0.
0103   Standard_EXPORT Standard_Integer NbPoints() const;
0104 Standard_EXPORT operator Standard_Integer() const;
0105   
0106   //! Returns the orthogonal projection
0107   //! on the surface. Index is a number of a computed point.
0108   //! Exceptions
0109   //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
0110   //! NbPoints is the number of solution points.
0111   Standard_EXPORT gp_Pnt Point (const Standard_Integer Index) const;
0112   
0113   //! Returns the parameters (U,V) on the
0114   //! surface of the orthogonal projection. Index is a number of a
0115   //! computed point.
0116   //! Exceptions
0117   //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
0118   //! NbPoints is the number of solution points.
0119   Standard_EXPORT void Parameters (const Standard_Integer Index, Standard_Real& U, Standard_Real& V) const;
0120   
0121   //! Computes the distance between the
0122   //! point and its orthogonal projection on the surface. Index is a number
0123   //! of a computed point.
0124   //! Exceptions
0125   //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
0126   //! NbPoints is the number of solution points.
0127   Standard_EXPORT Standard_Real Distance (const Standard_Integer Index) const;
0128   
0129   //! Returns the nearest orthogonal projection of the point
0130   //! on the surface.
0131   //! Exceptions
0132   //! StdFail_NotDone if projection fails.
0133   Standard_EXPORT gp_Pnt NearestPoint() const;
0134 Standard_EXPORT operator gp_Pnt() const;
0135   
0136   //! Returns the parameters (U,V) on the
0137   //! surface of the nearest computed orthogonal projection of the point.
0138   //! Exceptions
0139   //! StdFail_NotDone if projection fails.
0140   Standard_EXPORT void LowerDistanceParameters (Standard_Real& U, Standard_Real& V) const;
0141   
0142   //! Computes the distance between the
0143   //! point and its nearest orthogonal projection on the surface.
0144   //! Exceptions
0145   //! StdFail_NotDone if projection fails.
0146   Standard_EXPORT Standard_Real LowerDistance() const;
0147 Standard_EXPORT operator Standard_Real() const;
0148   
0149   //! return the algorithmic object from Extrema
0150     const Extrema_ExtPS& Extrema() const;
0151 
0152 private:
0153 
0154   
0155   Standard_EXPORT void Init();
0156 
0157 
0158   Standard_Boolean myIsDone;
0159   Standard_Integer myIndex;
0160   Extrema_ExtPS myExtPS;
0161   GeomAdaptor_Surface myGeomAdaptor;
0162 
0163 
0164 };
0165 
0166 
0167 #include <GeomAPI_ProjectPointOnSurf.lxx>
0168 
0169 
0170 
0171 
0172 
0173 #endif // _GeomAPI_ProjectPointOnSurf_HeaderFile