Back to home page

EIC code displayed by LXR

 
 

    


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

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