Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:56:57

0001 // Created on: 1998-05-12
0002 // Created by: Roman BORISOV
0003 // Copyright (c) 1998-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 _Approx_CurvlinFunc_HeaderFile
0018 #define _Approx_CurvlinFunc_HeaderFile
0019 
0020 #include <Adaptor2d_Curve2d.hxx>
0021 #include <Adaptor3d_Surface.hxx>
0022 #include <GeomAbs_Shape.hxx>
0023 #include <NCollection_Array1.hxx>
0024 #include <NCollection_HArray1.hxx>
0025 
0026 //! defines an abstract curve with
0027 //! curvilinear parametrization
0028 class Approx_CurvlinFunc : public Standard_Transient
0029 {
0030 
0031 public:
0032   Standard_EXPORT Approx_CurvlinFunc(const occ::handle<Adaptor3d_Curve>& C, const double Tol);
0033 
0034   Standard_EXPORT Approx_CurvlinFunc(const occ::handle<Adaptor2d_Curve2d>& C2D,
0035                                      const occ::handle<Adaptor3d_Surface>& S,
0036                                      const double                          Tol);
0037 
0038   Standard_EXPORT Approx_CurvlinFunc(const occ::handle<Adaptor2d_Curve2d>& C2D1,
0039                                      const occ::handle<Adaptor2d_Curve2d>& C2D2,
0040                                      const occ::handle<Adaptor3d_Surface>& S1,
0041                                      const occ::handle<Adaptor3d_Surface>& S2,
0042                                      const double                          Tol);
0043 
0044   //! ---Purpose Update the tolerance to used
0045   Standard_EXPORT void SetTol(const double Tol);
0046 
0047   Standard_EXPORT double FirstParameter() const;
0048 
0049   Standard_EXPORT double LastParameter() const;
0050 
0051   //! Returns the number of intervals for continuity
0052   //! <S>. May be one if Continuity(me) >= <S>
0053   Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const;
0054 
0055   //! Stores in <T> the parameters bounding the intervals
0056   //! of continuity <S>.
0057   //!
0058   //! The array must provide enough room to accommodate
0059   //! for the parameters. i.e. T.Length() > NbIntervals()
0060   Standard_EXPORT void Intervals(NCollection_Array1<double>& T, const GeomAbs_Shape S) const;
0061 
0062   //! if First < 0 or Last > 1
0063   Standard_EXPORT void Trim(const double First, const double Last, const double Tol);
0064 
0065   //! Computes length of the curve.
0066   Standard_EXPORT void Length();
0067 
0068   //! Computes length of the curve segment.
0069   Standard_EXPORT double Length(Adaptor3d_Curve& C, const double FirstU, const double LasrU) const;
0070 
0071   Standard_EXPORT double GetLength() const;
0072 
0073   //! returns original parameter corresponding S. if
0074   //! Case == 1 computation is performed on myC2D1 and mySurf1,
0075   //! otherwise it is done on myC2D2 and mySurf2.
0076   Standard_EXPORT double GetUParameter(Adaptor3d_Curve& C,
0077                                        const double     S,
0078                                        const int        NumberOfCurve) const;
0079 
0080   //! returns original parameter corresponding S.
0081   Standard_EXPORT double GetSParameter(const double U) const;
0082 
0083   //! if myCase != 1
0084   Standard_EXPORT bool EvalCase1(const double                S,
0085                                  const int                   Order,
0086                                  NCollection_Array1<double>& Result) const;
0087 
0088   //! if myCase != 2
0089   Standard_EXPORT bool EvalCase2(const double                S,
0090                                  const int                   Order,
0091                                  NCollection_Array1<double>& Result) const;
0092 
0093   //! if myCase != 3
0094   Standard_EXPORT bool EvalCase3(const double                S,
0095                                  const int                   Order,
0096                                  NCollection_Array1<double>& Result);
0097 
0098   DEFINE_STANDARD_RTTIEXT(Approx_CurvlinFunc, Standard_Transient)
0099 
0100 private:
0101   Standard_EXPORT void Init();
0102 
0103   Standard_EXPORT void Init(Adaptor3d_Curve&                          C,
0104                             occ::handle<NCollection_HArray1<double>>& Si,
0105                             occ::handle<NCollection_HArray1<double>>& Ui) const;
0106 
0107   //! returns curvilinear parameter corresponding U.
0108   Standard_EXPORT double GetSParameter(Adaptor3d_Curve& C,
0109                                        const double     U,
0110                                        const double     Length) const;
0111 
0112   Standard_EXPORT bool EvalCurOnSur(const double                S,
0113                                     const int                   Order,
0114                                     NCollection_Array1<double>& Result,
0115                                     const int                   NumberOfCurve) const;
0116 
0117   occ::handle<Adaptor3d_Curve>             myC3D;
0118   occ::handle<Adaptor2d_Curve2d>           myC2D1;
0119   occ::handle<Adaptor2d_Curve2d>           myC2D2;
0120   occ::handle<Adaptor3d_Surface>           mySurf1;
0121   occ::handle<Adaptor3d_Surface>           mySurf2;
0122   int                                      myCase;
0123   double                                   myFirstS;
0124   double                                   myLastS;
0125   double                                   myFirstU1;
0126   double                                   myLastU1;
0127   double                                   myFirstU2;
0128   double                                   myLastU2;
0129   double                                   myLength;
0130   double                                   myLength1;
0131   double                                   myLength2;
0132   double                                   myTolLen;
0133   double                                   myPrevS;
0134   double                                   myPrevU;
0135   occ::handle<NCollection_HArray1<double>> myUi_1;
0136   occ::handle<NCollection_HArray1<double>> mySi_1;
0137   occ::handle<NCollection_HArray1<double>> myUi_2;
0138   occ::handle<NCollection_HArray1<double>> mySi_2;
0139 };
0140 
0141 #endif // _Approx_CurvlinFunc_HeaderFile