Back to home page

EIC code displayed by LXR

 
 

    


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

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_ProjectPointOnCurve_HeaderFile
0018 #define _GeomAPI_ProjectPointOnCurve_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_ExtPC.hxx>
0026 #include <GeomAdaptor_Curve.hxx>
0027 class gp_Pnt;
0028 class Geom_Curve;
0029 
0030 
0031 
0032 //! This class implements methods for  computing all the orthogonal
0033 //! projections of a 3D point onto a  3D curve.
0034 class GeomAPI_ProjectPointOnCurve 
0035 {
0036 public:
0037 
0038   DEFINE_STANDARD_ALLOC
0039 
0040   
0041   //! Creates an empty object. Use an
0042   //! Init function for further initialization.
0043   Standard_EXPORT GeomAPI_ProjectPointOnCurve();
0044   
0045   //! Create the projection  of a  point  <P> on a curve
0046   //! <Curve>
0047   Standard_EXPORT GeomAPI_ProjectPointOnCurve(const gp_Pnt& P, const Handle(Geom_Curve)& Curve);
0048   
0049   //! Create  the projection  of a point <P>  on a curve
0050   //! <Curve> limited by the two points of parameter Umin and Usup.
0051   Standard_EXPORT GeomAPI_ProjectPointOnCurve(const gp_Pnt& P, const Handle(Geom_Curve)& Curve, const Standard_Real Umin, const Standard_Real Usup);
0052   
0053   //! Init the projection  of a  point  <P> on a curve
0054   //! <Curve>
0055   Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Curve)& Curve);
0056   
0057   //! Init  the  projection  of a  point <P>  on a curve
0058   //! <Curve> limited by the two points of parameter Umin and Usup.
0059   Standard_EXPORT void Init (const gp_Pnt& P, const Handle(Geom_Curve)& Curve, const Standard_Real Umin, const Standard_Real Usup);
0060   
0061   //! Init  the  projection  of a  point <P>  on a curve
0062   //! <Curve> limited by the two points of parameter Umin and Usup.
0063   Standard_EXPORT void Init (const Handle(Geom_Curve)& Curve, const Standard_Real Umin, const Standard_Real Usup);
0064   
0065   //! Performs the projection of a point on the current curve.
0066   Standard_EXPORT void Perform (const gp_Pnt& P);
0067   
0068   //! Returns the number of computed
0069   //! orthogonal projection points.
0070   //! Note: if this algorithm fails, NbPoints returns 0.
0071   Standard_EXPORT Standard_Integer NbPoints() const;
0072 Standard_EXPORT operator Standard_Integer() const;
0073   
0074   //! Returns the orthogonal projection
0075   //! on the curve. Index is a number of a computed point.
0076   //! Exceptions
0077   //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
0078   //! NbPoints is the number of solution points.
0079   Standard_EXPORT gp_Pnt Point (const Standard_Integer Index) const;
0080   
0081   //! Returns the parameter on the curve
0082   //! of the point, which is the orthogonal projection. Index is a
0083   //! number of a computed point.
0084   //! Exceptions
0085   //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
0086   //! NbPoints is the number of solution points.
0087   Standard_EXPORT Standard_Real Parameter (const Standard_Integer Index) const;
0088   
0089   //! Returns the parameter on the curve
0090   //! of the point, which is the orthogonal projection. Index is a
0091   //! number of a computed point.
0092   //! Exceptions
0093   //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
0094   //! NbPoints is the number of solution points.-
0095   Standard_EXPORT void Parameter (const Standard_Integer Index, Standard_Real& U) const;
0096   
0097   //! Computes the distance between the
0098   //! point and its orthogonal projection on the curve. Index is a number of a computed point.
0099   //! Exceptions
0100   //! Standard_OutOfRange if Index is not in the range [ 1,NbPoints ], where
0101   //! NbPoints is the number of solution points.
0102   Standard_EXPORT Standard_Real Distance (const Standard_Integer Index) const;
0103   
0104   //! Returns the nearest orthogonal
0105   //! projection of the point on the curve.
0106   //! Exceptions: StdFail_NotDone if this algorithm fails.
0107   Standard_EXPORT gp_Pnt NearestPoint() const;
0108 Standard_EXPORT operator gp_Pnt() const;
0109   
0110   //! Returns the parameter on the curve
0111   //! of the nearest orthogonal projection of the point.
0112   //! Exceptions: StdFail_NotDone if this algorithm fails.
0113   Standard_EXPORT Standard_Real LowerDistanceParameter() const;
0114   
0115   //! Computes the distance between the
0116   //! point and its nearest orthogonal projection on the curve.
0117   //! Exceptions: StdFail_NotDone if this algorithm fails.
0118   Standard_EXPORT Standard_Real LowerDistance() const;
0119 Standard_EXPORT operator Standard_Real() const;
0120   
0121   //! return the algorithmic object from Extrema
0122     const Extrema_ExtPC& Extrema() const;
0123 
0124 private:
0125 
0126   Standard_Boolean myIsDone;
0127   Standard_Integer myIndex;
0128   Extrema_ExtPC myExtPC;
0129   GeomAdaptor_Curve myC;
0130 
0131 };
0132 
0133 
0134 #include <GeomAPI_ProjectPointOnCurve.lxx>
0135 
0136 
0137 
0138 
0139 
0140 #endif // _GeomAPI_ProjectPointOnCurve_HeaderFile