Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:20:14

0001 // Created on: 1991-02-27
0002 // Created by: Jean Claude Vauthier
0003 // Copyright (c) 1991-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_UniformAbscissa_HeaderFile
0018 #define _GCPnts_UniformAbscissa_HeaderFile
0019 
0020 #include <StdFail_NotDone.hxx>
0021 #include <NCollection_Array1.hxx>
0022 #include <NCollection_HArray1.hxx>
0023 
0024 class Adaptor3d_Curve;
0025 class Adaptor2d_Curve2d;
0026 
0027 //! This class allows to compute a uniform distribution of points
0028 //! on a curve (i.e. the points will all be equally distant).
0029 class GCPnts_UniformAbscissa
0030 {
0031 public:
0032   DEFINE_STANDARD_ALLOC
0033 
0034   //! creation of a indefinite UniformAbscissa
0035   Standard_EXPORT GCPnts_UniformAbscissa();
0036 
0037   //! Computes a uniform abscissa distribution of points on the 3D curve.
0038   //! @param[in] theC  input curve
0039   //! @param[in] theAbscissa  abscissa (distance between two consecutive points)
0040   //! @param[in] theToler  used for more precise calculation of curve length
0041   //!                      (Precision::Confusion() by default)
0042   Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor3d_Curve& theC,
0043                                          const double           theAbscissa,
0044                                          const double           theToler = -1);
0045 
0046   //! Computes a Uniform abscissa distribution of points on a part of the 3D Curve.
0047   //! @param[in] theC  input curve
0048   //! @param[in] theAbscissa  abscissa (distance between two consecutive points)
0049   //! @param[in] theU1  first parameter on curve
0050   //! @param[in] theU2  last  parameter on curve
0051   //! @param[in] theToler  used for more precise calculation of curve length
0052   //!                      (Precision::Confusion() by default)
0053   Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor3d_Curve& theC,
0054                                          const double           theAbscissa,
0055                                          const double           theU1,
0056                                          const double           theU2,
0057                                          const double           theToler = -1);
0058 
0059   //! Computes a uniform abscissa distribution of points on the 3D Curve.
0060   //! @param[in] theC  input curve
0061   //! @param[in] theNbPoints  defines the number of desired points
0062   //! @param[in] theToler  used for more precise calculation of curve length
0063   //!                      (Precision::Confusion() by default)
0064   Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor3d_Curve& theC,
0065                                          const int              theNbPoints,
0066                                          const double           theToler = -1);
0067 
0068   //! Computes a Uniform abscissa distribution of points on a part of the 3D Curve.
0069   //! @param[in] theC  input curve
0070   //! @param[in] theNbPoints  defines the number of desired points
0071   //! @param[in] theU1  first parameter on curve
0072   //! @param[in] theU2  last  parameter on curve
0073   //! @param[in] theToler  used for more precise calculation of curve length
0074   //!                      (Precision::Confusion() by default)
0075   Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor3d_Curve& theC,
0076                                          const int              theNbPoints,
0077                                          const double           theU1,
0078                                          const double           theU2,
0079                                          const double           theToler = -1);
0080 
0081   //! Initialize the algorithms with 3D curve, Abscissa, and Tolerance.
0082   //! @param[in] theC  input curve
0083   //! @param[in] theAbscissa  abscissa (distance between two consecutive points)
0084   //! @param[in] theToler  used for more precise calculation of curve length
0085   //!                      (Precision::Confusion() by default)
0086   Standard_EXPORT void Initialize(const Adaptor3d_Curve& theC,
0087                                   const double           theAbscissa,
0088                                   const double           theToler = -1);
0089 
0090   //! Initialize the algorithms with 3D curve, Abscissa, Tolerance, and parameter range.
0091   //! @param[in] theC  input curve
0092   //! @param[in] theAbscissa  abscissa (distance between two consecutive points)
0093   //! @param[in] theU1  first parameter on curve
0094   //! @param[in] theU2  last  parameter on curve
0095   //! @param[in] theToler  used for more precise calculation of curve length
0096   //!                      (Precision::Confusion() by default)
0097   Standard_EXPORT void Initialize(const Adaptor3d_Curve& theC,
0098                                   const double           theAbscissa,
0099                                   const double           theU1,
0100                                   const double           theU2,
0101                                   const double           theToler = -1);
0102 
0103   //! Initialize the algorithms with 3D curve, number of points, and Tolerance.
0104   //! @param[in] theC  input curve
0105   //! @param[in] theNbPoints  defines the number of desired points
0106   //! @param[in] theToler  used for more precise calculation of curve length
0107   //!                      (Precision::Confusion() by default)
0108   Standard_EXPORT void Initialize(const Adaptor3d_Curve& theC,
0109                                   const int              theNbPoints,
0110                                   const double           theToler = -1);
0111 
0112   //! Initialize the algorithms with 3D curve, number of points, Tolerance, and parameter range.
0113   //! @param[in] theC  input curve
0114   //! @param[in] theNbPoints  defines the number of desired points
0115   //! @param[in] theU1  first parameter on curve
0116   //! @param[in] theU2  last  parameter on curve
0117   //! @param[in] theToler  used for more precise calculation of curve length
0118   //!                      (Precision::Confusion() by default)
0119   Standard_EXPORT void Initialize(const Adaptor3d_Curve& theC,
0120                                   const int              theNbPoints,
0121                                   const double           theU1,
0122                                   const double           theU2,
0123                                   const double           theToler = -1);
0124 
0125 public:
0126   //! Computes a uniform abscissa distribution of points on the 2D curve.
0127   //! @param[in] theC  input curve
0128   //! @param[in] theAbscissa  abscissa (distance between two consecutive points)
0129   //! @param[in] theToler  used for more precise calculation of curve length
0130   //!                      (Precision::Confusion() by default)
0131   Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor2d_Curve2d& theC,
0132                                          const double             theAbscissa,
0133                                          const double             theToler = -1);
0134 
0135   //! Computes a Uniform abscissa distribution of points on a part of the 2D Curve.
0136   //! @param[in] theC  input curve
0137   //! @param[in] theAbscissa  abscissa (distance between two consecutive points)
0138   //! @param[in] theU1  first parameter on curve
0139   //! @param[in] theU2  last  parameter on curve
0140   //! @param[in] theToler  used for more precise calculation of curve length
0141   //!                      (Precision::Confusion() by default)
0142   Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor2d_Curve2d& theC,
0143                                          const double             theAbscissa,
0144                                          const double             theU1,
0145                                          const double             theU2,
0146                                          const double             theToler = -1);
0147 
0148   //! Computes a uniform abscissa distribution of points on the 2D Curve.
0149   //! @param[in] theC  input curve
0150   //! @param[in] theNbPoints  defines the number of desired points
0151   //! @param[in] theToler  used for more precise calculation of curve length
0152   //!                      (Precision::Confusion() by default)
0153   Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor2d_Curve2d& theC,
0154                                          const int                theNbPoints,
0155                                          const double             theToler = -1);
0156 
0157   //! Computes a Uniform abscissa distribution of points on a part of the 2D Curve.
0158   //! @param[in] theC  input curve
0159   //! @param[in] theNbPoints  defines the number of desired points
0160   //! @param[in] theU1  first parameter on curve
0161   //! @param[in] theU2  last  parameter on curve
0162   //! @param[in] theToler  used for more precise calculation of curve length
0163   //!                      (Precision::Confusion() by default)
0164   Standard_EXPORT GCPnts_UniformAbscissa(const Adaptor2d_Curve2d& theC,
0165                                          const int                theNbPoints,
0166                                          const double             theU1,
0167                                          const double             theU2,
0168                                          const double             theToler = -1);
0169 
0170   //! Initialize the algorithms with 2D curve, Abscissa, and Tolerance.
0171   //! @param[in] theC  input curve
0172   //! @param[in] theAbscissa  abscissa (distance between two consecutive points)
0173   //! @param[in] theToler  used for more precise calculation of curve length
0174   //!                      (Precision::Confusion() by default)
0175   Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theC,
0176                                   const double             theAbscissa,
0177                                   const double             theToler = -1);
0178 
0179   //! Initialize the algorithms with 2D curve, Abscissa, Tolerance, and parameter range.
0180   //! @param[in] theC  input curve
0181   //! @param[in] theAbscissa  abscissa (distance between two consecutive points)
0182   //! @param[in] theU1  first parameter on curve
0183   //! @param[in] theU2  last  parameter on curve
0184   //! @param[in] theToler  used for more precise calculation of curve length
0185   //!                      (Precision::Confusion() by default)
0186   Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theC,
0187                                   const double             theAbscissa,
0188                                   const double             theU1,
0189                                   const double             theU2,
0190                                   const double             theToler = -1);
0191 
0192   //! Initialize the algorithms with 2D curve, number of points, and Tolerance.
0193   //! @param[in] theC  input curve
0194   //! @param[in] theNbPoints  defines the number of desired points
0195   //! @param[in] theToler  used for more precise calculation of curve length
0196   //!                      (Precision::Confusion() by default)
0197   Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theC,
0198                                   const int                theNbPoints,
0199                                   const double             theToler = -1);
0200 
0201   //! Initialize the algorithms with 2D curve, number of points, Tolerance, and parameter range.
0202   //! @param[in] theC  input curve
0203   //! @param[in] theNbPoints  defines the number of desired points
0204   //! @param[in] theU1  first parameter on curve
0205   //! @param[in] theU2  last  parameter on curve
0206   //! @param[in] theToler  used for more precise calculation of curve length
0207   //!                      (Precision::Confusion() by default)
0208   Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theC,
0209                                   const int                theNbPoints,
0210                                   const double             theU1,
0211                                   const double             theU2,
0212                                   const double             theToler = -1);
0213 
0214   bool IsDone() const { return myDone; }
0215 
0216   int NbPoints() const
0217   {
0218     StdFail_NotDone_Raise_if(!myDone, "GCPnts_UniformAbscissa::NbPoints()");
0219     return myNbPoints;
0220   }
0221 
0222   //! returns the computed Parameter of index <Index>.
0223   double Parameter(const int Index) const
0224   {
0225     StdFail_NotDone_Raise_if(!myDone, "GCPnts_UniformAbscissa::Parameter()");
0226     return myParams->Value(Index);
0227   }
0228 
0229   //! Returns the current abscissa, i.e. the distance between two consecutive points.
0230   double Abscissa() const
0231   {
0232     StdFail_NotDone_Raise_if(!myDone, "GCPnts_UniformAbscissa::Abscissa()");
0233     return myAbscissa;
0234   }
0235 
0236 private:
0237   //! Initializes algorithm.
0238   template <class TheCurve>
0239   void initialize(const TheCurve& theC,
0240                   const double    theAbscissa,
0241                   const double    theU1,
0242                   const double    theU2,
0243                   const double    theTol);
0244 
0245   //! Initializes algorithm.
0246   template <class TheCurve>
0247   void initialize(const TheCurve& theC,
0248                   const int       theNbPoints,
0249                   const double    theU1,
0250                   const double    theU2,
0251                   const double    theTol);
0252 
0253 private:
0254   bool                                     myDone;
0255   int                                      myNbPoints;
0256   double                                   myAbscissa;
0257   occ::handle<NCollection_HArray1<double>> myParams;
0258 };
0259 
0260 #endif // _GCPnts_UniformAbscissa_HeaderFile