Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-22 08:29:22

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   DEFINE_STANDARD_ALLOC
0037 
0038   //! Computes the length of the 3D Curve.
0039   Standard_EXPORT static Standard_Real Length(const Adaptor3d_Curve& theC);
0040 
0041   //! Computes the length of the 2D Curve.
0042   Standard_EXPORT static Standard_Real Length(const Adaptor2d_Curve2d& theC);
0043 
0044   //! Computes the length of the 3D Curve with the given tolerance.
0045   Standard_EXPORT static Standard_Real Length(const Adaptor3d_Curve& theC,
0046                                               const Standard_Real    theTol);
0047 
0048   //! Computes the length of the 2D Curve with the given tolerance.
0049   Standard_EXPORT static Standard_Real Length(const Adaptor2d_Curve2d& theC,
0050                                               const Standard_Real      theTol);
0051 
0052   //! Computes the length of the 3D Curve.
0053   Standard_EXPORT static Standard_Real Length(const Adaptor3d_Curve& theC,
0054                                               const Standard_Real    theU1,
0055                                               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,
0060                                               const Standard_Real      theU2);
0061 
0062   //! Computes the length of the 3D Curve with the given tolerance.
0063   Standard_EXPORT static Standard_Real Length(const Adaptor3d_Curve& theC,
0064                                               const Standard_Real    theU1,
0065                                               const Standard_Real    theU2,
0066                                               const Standard_Real    theTol);
0067 
0068   //! Computes the length of the Curve with the given tolerance.
0069   Standard_EXPORT static Standard_Real Length(const Adaptor2d_Curve2d& theC,
0070                                               const Standard_Real      theU1,
0071                                               const Standard_Real      theU2,
0072                                               const Standard_Real      theTol);
0073 
0074 public:
0075   //! Empty constructor.
0076   Standard_EXPORT GCPnts_AbscissaPoint();
0077 
0078   //! The algorithm computes a point on a curve at the
0079   //! distance theAbscissa from the point of parameter theU0.
0080   Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& theC,
0081                                        const Standard_Real    theAbscissa,
0082                                        const Standard_Real    theU0);
0083 
0084   //! The algorithm computes a point on a curve at
0085   //! the distance theAbscissa from the point of parameter
0086   //! theU0 with the given tolerance.
0087   Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real    theTol,
0088                                        const Adaptor3d_Curve& theC,
0089                                        const Standard_Real    theAbscissa,
0090                                        const Standard_Real    theU0);
0091 
0092   //! The algorithm computes a point on a curve at
0093   //! the distance theAbscissa from the point of parameter
0094   //! theU0 with the given tolerance.
0095   Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real      theTol,
0096                                        const Adaptor2d_Curve2d& theC,
0097                                        const Standard_Real      theAbscissa,
0098                                        const Standard_Real      theU0);
0099 
0100   //! The algorithm computes a point on a curve at the
0101   //! distance theAbscissa from the point of parameter theU0.
0102   Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& theC,
0103                                        const Standard_Real      theAbscissa,
0104                                        const Standard_Real      theU0);
0105 
0106   //! The algorithm computes a point on a curve at the
0107   //! distance theAbscissa from the point of parameter theU0.
0108   //! theUi is the starting value used in the iterative process
0109   //! which find the solution, it must be close to the final solution.
0110   Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& theC,
0111                                        const Standard_Real    theAbscissa,
0112                                        const Standard_Real    theU0,
0113                                        const Standard_Real    theUi);
0114 
0115   //! The algorithm computes a point on a curve at the
0116   //! distance theAbscissa from the point of parameter theU0.
0117   //! theUi is the starting value used in the iterative process
0118   //! which find the solution, it must be closed to the final solution
0119   Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& theC,
0120                                        const Standard_Real      theAbscissa,
0121                                        const Standard_Real      theU0,
0122                                        const Standard_Real      theUi);
0123 
0124   //! The algorithm computes a point on a curve at the
0125   //! distance theAbscissa from the point of parameter theU0.
0126   //! theUi is the starting value used in the iterative process
0127   //! which find the solution, it must be close to the final solution
0128   Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& theC,
0129                                        const Standard_Real    theAbscissa,
0130                                        const Standard_Real    theU0,
0131                                        const Standard_Real    theUi,
0132                                        const Standard_Real    theTol);
0133 
0134   //! The algorithm computes a point on a curve at the
0135   //! distance theAbscissa from the point of parameter theU0.
0136   //! theUi is the starting value used in the iterative process
0137   //! which find the solution, it must be close to the final solution
0138   Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& theC,
0139                                        const Standard_Real      theAbscissa,
0140                                        const Standard_Real      theU0,
0141                                        const Standard_Real      theUi,
0142                                        const Standard_Real      theTol);
0143 
0144   //! True if the computation was successful, False otherwise.
0145   //! IsDone is a protection against:
0146   //! -   non-convergence of the algorithm
0147   //! -   querying the results before computation.
0148   Standard_Boolean IsDone() const { return myComputer.IsDone(); }
0149 
0150   //! Returns the parameter on the curve of the point
0151   //! solution of this algorithm.
0152   //! Exceptions
0153   //! StdFail_NotDone if the computation was not
0154   //! successful, or was not done.
0155   Standard_Real Parameter() const { return myComputer.Parameter(); }
0156 
0157 private:
0158   //! Computes the length of the Curve with the optional tolerance.
0159   template <class TheCurve>
0160   static Standard_Real length(const TheCurve&      theC,
0161                               const Standard_Real  theU1,
0162                               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, const Standard_Real theAbscissa, const Standard_Real theU0);
0168 
0169   //! Performs algorithm from the point of parameter with the given tolerance.
0170   template <class TheCurve>
0171   void advCompute(const Standard_Real theTol,
0172                   const TheCurve&     theC,
0173                   const Standard_Real theAbscissa,
0174                   const Standard_Real theU0);
0175 
0176 private:
0177   CPnts_AbscissaPoint myComputer;
0178 };
0179 
0180 #endif // _GCPnts_AbscissaPoint_HeaderFile