Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-30 09:03:35

0001 // Created on: 1997-11-20
0002 // Created by: Philippe MANGIN
0003 // Copyright (c) 1997-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 _GeomFill_SweepFunction_HeaderFile
0018 #define _GeomFill_SweepFunction_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <gp_Mat.hxx>
0024 #include <gp_Vec.hxx>
0025 #include <Approx_SweepFunction.hxx>
0026 #include <gp_Pnt.hxx>
0027 #include <NCollection_Array1.hxx>
0028 #include <gp_Pnt2d.hxx>
0029 #include <gp_Vec2d.hxx>
0030 #include <Standard_Integer.hxx>
0031 #include <GeomAbs_Shape.hxx>
0032 class GeomFill_LocationLaw;
0033 class GeomFill_SectionLaw;
0034 class gp_Pnt;
0035 
0036 //! Function to approximate by SweepApproximation from
0037 //! Approx. To build general sweep Surface.
0038 class GeomFill_SweepFunction : public Approx_SweepFunction
0039 {
0040 
0041 public:
0042   Standard_EXPORT GeomFill_SweepFunction(const occ::handle<GeomFill_SectionLaw>&  Section,
0043                                          const occ::handle<GeomFill_LocationLaw>& Location,
0044                                          const double                             FirstParameter,
0045                                          const double                             FirstParameterOnS,
0046                                          const double RatioParameterOnS);
0047 
0048   //! compute the section for v = param
0049   Standard_EXPORT bool D0(const double                  Param,
0050                           const double                  First,
0051                           const double                  Last,
0052                           NCollection_Array1<gp_Pnt>&   Poles,
0053                           NCollection_Array1<gp_Pnt2d>& Poles2d,
0054                           NCollection_Array1<double>&   Weigths) override;
0055 
0056   //! compute the first derivative in v direction of the
0057   //! section for v = param
0058   Standard_EXPORT bool D1(const double                  Param,
0059                           const double                  First,
0060                           const double                  Last,
0061                           NCollection_Array1<gp_Pnt>&   Poles,
0062                           NCollection_Array1<gp_Vec>&   DPoles,
0063                           NCollection_Array1<gp_Pnt2d>& Poles2d,
0064                           NCollection_Array1<gp_Vec2d>& DPoles2d,
0065                           NCollection_Array1<double>&   Weigths,
0066                           NCollection_Array1<double>&   DWeigths) override;
0067 
0068   //! compute the second derivative in v direction of the
0069   //! section for v = param
0070   Standard_EXPORT bool D2(const double                  Param,
0071                           const double                  First,
0072                           const double                  Last,
0073                           NCollection_Array1<gp_Pnt>&   Poles,
0074                           NCollection_Array1<gp_Vec>&   DPoles,
0075                           NCollection_Array1<gp_Vec>&   D2Poles,
0076                           NCollection_Array1<gp_Pnt2d>& Poles2d,
0077                           NCollection_Array1<gp_Vec2d>& DPoles2d,
0078                           NCollection_Array1<gp_Vec2d>& D2Poles2d,
0079                           NCollection_Array1<double>&   Weigths,
0080                           NCollection_Array1<double>&   DWeigths,
0081                           NCollection_Array1<double>&   D2Weigths) override;
0082 
0083   //! get the number of 2d curves to approximate.
0084   Standard_EXPORT int Nb2dCurves() const override;
0085 
0086   //! get the format of a section
0087   Standard_EXPORT void SectionShape(int& NbPoles, int& NbKnots, int& Degree) const override;
0088 
0089   //! get the Knots of the section
0090   Standard_EXPORT void Knots(NCollection_Array1<double>& TKnots) const override;
0091 
0092   //! get the Multplicities of the section
0093   Standard_EXPORT void Mults(NCollection_Array1<int>& TMults) const override;
0094 
0095   //! Returns if the section is rational or not
0096   Standard_EXPORT bool IsRational() const override;
0097 
0098   //! Returns the number of intervals for continuity
0099   //! <S>. May be one if Continuity(me) >= <S>
0100   Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override;
0101 
0102   //! Stores in <T> the parameters bounding the intervals
0103   //! of continuity <S>.
0104   //!
0105   //! The array must provide enough room to accommodate
0106   //! for the parameters. i.e. T.Length() > NbIntervals()
0107   Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
0108                                  const GeomAbs_Shape         S) const override;
0109 
0110   //! Sets the bounds of the parametric interval on
0111   //! the function
0112   //! This determines the derivatives in these values if the
0113   //! function is not Cn.
0114   Standard_EXPORT void SetInterval(const double First, const double Last) override;
0115 
0116   //! Returns the resolutions in the sub-space 2d <Index>
0117   //! This information is useful to find a good tolerance in
0118   //! 2d approximation.
0119   //! Warning: Used only if Nb2dCurve > 0
0120   Standard_EXPORT void Resolution(const int    Index,
0121                                   const double Tol,
0122                                   double&      TolU,
0123                                   double&      TolV) const override;
0124 
0125   //! Returns the tolerance to reach in approximation
0126   //! to respect
0127   //! BoundTol error at the Boundary
0128   //! AngleTol tangent error at the Boundary (in radian)
0129   //! SurfTol error inside the surface.
0130   Standard_EXPORT void GetTolerance(const double                BoundTol,
0131                                     const double                SurfTol,
0132                                     const double                AngleTol,
0133                                     NCollection_Array1<double>& Tol3d) const override;
0134 
0135   //! Is useful, if <me> has to be run numerical
0136   //! algorithme to perform D0, D1 or D2
0137   Standard_EXPORT void SetTolerance(const double Tol3d, const double Tol2d) override;
0138 
0139   //! Get the barycentre of Surface. An very poor
0140   //! estimation is sufficient. This information is useful
0141   //! to perform well conditioned rational approximation.
0142   //! Warning: Used only if <me> IsRational
0143   Standard_EXPORT gp_Pnt BarycentreOfSurf() const override;
0144 
0145   //! Returns the length of the maximum section. This
0146   //! information is useful to perform well conditioned rational
0147   //! approximation.
0148   Standard_EXPORT double MaximalSection() const override;
0149 
0150   //! Compute the minimal value of weight for each poles
0151   //! of all sections. This information is useful to
0152   //! perform well conditioned rational approximation.
0153   //! Warning: Used only if <me> IsRational
0154   Standard_EXPORT void GetMinimalWeight(NCollection_Array1<double>& Weigths) const override;
0155 
0156   DEFINE_STANDARD_RTTIEXT(GeomFill_SweepFunction, Approx_SweepFunction)
0157 
0158 private:
0159   occ::handle<GeomFill_LocationLaw> myLoc;
0160   occ::handle<GeomFill_SectionLaw>  mySec;
0161   double                            myf;
0162   double                            myfOnS;
0163   double                            myRatio;
0164   gp_Mat                            M;
0165   gp_Mat                            DM;
0166   gp_Mat                            D2M;
0167   gp_Vec                            V;
0168   gp_Vec                            DV;
0169   gp_Vec                            D2V;
0170 };
0171 
0172 #endif // _GeomFill_SweepFunction_HeaderFile