Back to home page

EIC code displayed by LXR

 
 

    


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

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