Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1992-03-25
0002 // Created by: Herve LEGRAND
0003 // Copyright (c) 1992-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 _GCPnts_AbscissaPoint_HeaderFile
0018 #define _GCPnts_AbscissaPoint_HeaderFile
0019 
0020 #include <CPnts_AbscissaPoint.hxx>
0021 
0022 class Adaptor3d_Curve;
0023 class Adaptor2d_Curve2d;
0024 
0025 //! Provides an algorithm to compute a point on a curve
0026 //! situated at a given distance from another point on the curve,
0027 //! the distance being measured along the curve (curvilinear abscissa on the curve).
0028 //! This algorithm is also used to compute the length of a curve.
0029 //! An AbscissaPoint object provides a framework for:
0030 //! -   defining the point to compute
0031 //! -   implementing the construction algorithm
0032 //! -   consulting the result.
0033 class GCPnts_AbscissaPoint
0034 {
0035 public:
0036 
0037   DEFINE_STANDARD_ALLOC
0038 
0039   //! Computes the length of the 3D Curve.
0040   Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC);
0041   
0042   //! Computes the length of the 2D Curve.
0043   Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC);
0044   
0045   //! Computes the length of the 3D Curve with the given tolerance.
0046   Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC,
0047                                                const Standard_Real theTol);
0048   
0049   //! Computes the length of the 2D Curve with the given tolerance.
0050   Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC,
0051                                                const Standard_Real theTol);
0052   
0053   //! Computes the length of the 3D Curve.
0054   Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC,
0055                                                const Standard_Real theU1, const Standard_Real theU2);
0056   
0057   //! Computes the length of the 2D Curve.
0058   Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC,
0059                                                const Standard_Real theU1, const Standard_Real theU2);
0060   
0061   //! Computes the length of the 3D Curve with the given tolerance.
0062   Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& theC,
0063                                                const Standard_Real theU1, const Standard_Real theU2,
0064                                                const Standard_Real theTol);
0065 
0066   //! Computes the length of the Curve with the given tolerance.
0067   Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& theC,
0068                                                const Standard_Real theU1, const Standard_Real theU2,
0069                                                const Standard_Real theTol);
0070 
0071 public:
0072 
0073   //! Empty constructor.
0074   Standard_EXPORT GCPnts_AbscissaPoint();
0075 
0076   //! The algorithm computes a point on a curve at the
0077   //! distance theAbscissa from the point of parameter theU0.
0078   Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
0079                                         const Standard_Real theAbscissa,
0080                                         const Standard_Real theU0);
0081 
0082   //! The algorithm computes a point on a curve at
0083   //! the distance theAbscissa from the point of parameter
0084   //! theU0 with the given tolerance.
0085   Standard_EXPORT GCPnts_AbscissaPoint (const Standard_Real theTol,
0086                                         const Adaptor3d_Curve& theC,
0087                                         const Standard_Real theAbscissa,
0088                                         const Standard_Real theU0);
0089 
0090   //! The algorithm computes a point on a curve at
0091   //! the distance theAbscissa from the point of parameter
0092   //! theU0 with the given tolerance.
0093   Standard_EXPORT GCPnts_AbscissaPoint (const Standard_Real theTol,
0094                                         const Adaptor2d_Curve2d& theC,
0095                                         const Standard_Real theAbscissa,
0096                                         const Standard_Real theU0);
0097 
0098   //! The algorithm computes a point on a curve at the
0099   //! distance theAbscissa from the point of parameter theU0.
0100   Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
0101                                         const Standard_Real theAbscissa,
0102                                         const Standard_Real theU0);
0103 
0104   //! The algorithm computes a point on a curve at the
0105   //! distance theAbscissa from the point of parameter theU0.
0106   //! theUi is the starting value used in the iterative process
0107   //! which find the solution, it must be close to the final solution.
0108   Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
0109                                         const Standard_Real theAbscissa,
0110                                         const Standard_Real theU0, const Standard_Real theUi);
0111 
0112   //! The algorithm computes a point on a curve at the
0113   //! distance theAbscissa from the point of parameter theU0.
0114   //! theUi is the starting value used in the iterative process
0115   //! which find the solution, it must be closed to the final solution
0116   Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
0117                                         const Standard_Real theAbscissa,
0118                                         const Standard_Real theU0, const Standard_Real theUi);
0119 
0120   //! The algorithm computes a point on a curve at the
0121   //! distance theAbscissa from the point of parameter theU0.
0122   //! theUi is the starting value used in the iterative process
0123   //! which find the solution, it must be close to the final solution
0124   Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor3d_Curve& theC,
0125                                         const Standard_Real theAbscissa,
0126                                         const Standard_Real theU0, const Standard_Real theUi,
0127                                         const Standard_Real theTol);
0128 
0129   //! The algorithm computes a point on a curve at the
0130   //! distance theAbscissa from the point of parameter theU0.
0131   //! theUi is the starting value used in the iterative process
0132   //! which find the solution, it must be close to the final solution
0133   Standard_EXPORT GCPnts_AbscissaPoint (const Adaptor2d_Curve2d& theC,
0134                                         const Standard_Real theAbscissa,
0135                                         const Standard_Real theU0, const Standard_Real theUi,
0136                                         const Standard_Real theTol);
0137 
0138   //! True if the computation was successful, False otherwise.
0139   //! IsDone is a protection against:
0140   //! -   non-convergence of the algorithm
0141   //! -   querying the results before computation.
0142   Standard_Boolean IsDone () const
0143   {
0144     return myComputer.IsDone ();
0145   }
0146   
0147   //! Returns the parameter on the curve of the point
0148   //! solution of this algorithm.
0149   //! Exceptions
0150   //! StdFail_NotDone if the computation was not
0151   //! successful, or was not done.
0152   Standard_Real Parameter () const
0153   {
0154     return myComputer.Parameter ();
0155   }
0156 
0157 private:
0158 
0159   //! Computes the length of the Curve with the optional tolerance.
0160   template<class TheCurve>
0161   static Standard_Real length (const TheCurve& theC,
0162                                const Standard_Real theU1, const Standard_Real theU2,
0163                                const Standard_Real* theTol);
0164 
0165   //! Performs algorithm from the point of parameter.
0166   template<class TheCurve>
0167   void compute (const TheCurve& theC,
0168                 const Standard_Real theAbscissa,
0169                 const Standard_Real theU0);
0170 
0171   //! Performs algorithm from the point of parameter with the given tolerance.
0172   template<class TheCurve>
0173   void advCompute (const Standard_Real theTol,
0174                    const TheCurve& theC,
0175                    const Standard_Real theAbscissa,
0176                    const Standard_Real theU0);
0177 
0178 private:
0179   CPnts_AbscissaPoint myComputer;
0180 };
0181 
0182 #endif // _GCPnts_AbscissaPoint_HeaderFile