Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:19:18

0001 // Created on: 1997-06-25
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 _Approx_SweepFunction_HeaderFile
0018 #define _Approx_SweepFunction_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <GeomAbs_Shape.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <Standard_Real.hxx>
0025 #include <Standard_Transient.hxx>
0026 #include <NCollection_Array1.hxx>
0027 #include <gp_Pnt.hxx>
0028 #include <gp_Pnt2d.hxx>
0029 #include <gp_Vec.hxx>
0030 #include <gp_Vec2d.hxx>
0031 class gp_Pnt;
0032 
0033 //! defined the function used by SweepApproximation to
0034 //! perform sweeping application.
0035 class Approx_SweepFunction : public Standard_Transient
0036 {
0037 
0038 public:
0039   //! compute the section for v = param
0040   Standard_EXPORT virtual bool D0(const double                  Param,
0041                                   const double                  First,
0042                                   const double                  Last,
0043                                   NCollection_Array1<gp_Pnt>&   Poles,
0044                                   NCollection_Array1<gp_Pnt2d>& Poles2d,
0045                                   NCollection_Array1<double>&   Weigths) = 0;
0046 
0047   //! compute the first derivative in v direction of the
0048   //! section for v = param
0049   //! Warning : It used only for C1 or C2 approximation
0050   Standard_EXPORT virtual bool D1(const double                  Param,
0051                                   const double                  First,
0052                                   const double                  Last,
0053                                   NCollection_Array1<gp_Pnt>&   Poles,
0054                                   NCollection_Array1<gp_Vec>&   DPoles,
0055                                   NCollection_Array1<gp_Pnt2d>& Poles2d,
0056                                   NCollection_Array1<gp_Vec2d>& DPoles2d,
0057                                   NCollection_Array1<double>&   Weigths,
0058                                   NCollection_Array1<double>&   DWeigths);
0059 
0060   //! compute the second derivative in v direction of the
0061   //! section for v = param
0062   //! Warning : It used only for C2 approximation
0063   Standard_EXPORT virtual bool D2(const double                  Param,
0064                                   const double                  First,
0065                                   const double                  Last,
0066                                   NCollection_Array1<gp_Pnt>&   Poles,
0067                                   NCollection_Array1<gp_Vec>&   DPoles,
0068                                   NCollection_Array1<gp_Vec>&   D2Poles,
0069                                   NCollection_Array1<gp_Pnt2d>& Poles2d,
0070                                   NCollection_Array1<gp_Vec2d>& DPoles2d,
0071                                   NCollection_Array1<gp_Vec2d>& D2Poles2d,
0072                                   NCollection_Array1<double>&   Weigths,
0073                                   NCollection_Array1<double>&   DWeigths,
0074                                   NCollection_Array1<double>&   D2Weigths);
0075 
0076   //! get the number of 2d curves to approximate.
0077   Standard_EXPORT virtual int Nb2dCurves() const = 0;
0078 
0079   //! get the format of an section
0080   Standard_EXPORT virtual void SectionShape(int& NbPoles, int& NbKnots, int& Degree) const = 0;
0081 
0082   //! get the Knots of the section
0083   Standard_EXPORT virtual void Knots(NCollection_Array1<double>& TKnots) const = 0;
0084 
0085   //! get the Multplicities of the section
0086   Standard_EXPORT virtual void Mults(NCollection_Array1<int>& TMults) const = 0;
0087 
0088   //! Returns if the sections are rational or not
0089   Standard_EXPORT virtual bool IsRational() const = 0;
0090 
0091   //! Returns the number of intervals for continuity
0092   //! <S>.
0093   //! May be one if Continuity(me) >= <S>
0094   Standard_EXPORT virtual int NbIntervals(const GeomAbs_Shape S) const = 0;
0095 
0096   //! Stores in <T> the parameters bounding the intervals
0097   //! of continuity <S>.
0098   //!
0099   //! The array must provide enough room to accommodate
0100   //! for the parameters. i.e. T.Length() > NbIntervals()
0101   Standard_EXPORT virtual void Intervals(NCollection_Array1<double>& T,
0102                                          const GeomAbs_Shape         S) const = 0;
0103 
0104   //! Sets the bounds of the parametric interval on
0105   //! the function
0106   //! This determines the derivatives in these values if the
0107   //! function is not Cn.
0108   Standard_EXPORT virtual void SetInterval(const double First, const double Last) = 0;
0109 
0110   //! Returns the resolutions in the sub-space 2d <Index>
0111   //! This information is useful to find a good tolerance in
0112   //! 2d approximation.
0113   Standard_EXPORT virtual void Resolution(const int    Index,
0114                                           const double Tol,
0115                                           double&      TolU,
0116                                           double&      TolV) const;
0117 
0118   //! Returns the tolerance to reach in approximation
0119   //! to satisfy.
0120   //! BoundTol error at the Boundary
0121   //! AngleTol tangent error at the Boundary (in radian)
0122   //! SurfTol error inside the surface.
0123   Standard_EXPORT virtual void GetTolerance(const double                BoundTol,
0124                                             const double                SurfTol,
0125                                             const double                AngleTol,
0126                                             NCollection_Array1<double>& Tol3d) const = 0;
0127 
0128   //! Is useful, if (me) have to run numerical algorithm to perform D0, D1 or D2
0129   Standard_EXPORT virtual void SetTolerance(const double Tol3d, const double Tol2d) = 0;
0130 
0131   //! Get the barycentre of Surface.
0132   //! An very poor estimation is sufficient.
0133   //! This information is useful to perform well conditioned rational approximation.
0134   //! Warning: Used only if <me> IsRational
0135   Standard_EXPORT virtual gp_Pnt BarycentreOfSurf() const;
0136 
0137   //! Returns the length of the greater section.
0138   //! This information is useful to G1's control.
0139   //! Warning: With an little value, approximation can be slower.
0140   Standard_EXPORT virtual double MaximalSection() const;
0141 
0142   //! Compute the minimal value of weight for each poles in all sections.
0143   //! This information is useful to control error in rational approximation.
0144   //! Warning: Used only if <me> IsRational
0145   Standard_EXPORT virtual void GetMinimalWeight(NCollection_Array1<double>& Weigths) const;
0146 
0147   DEFINE_STANDARD_RTTIEXT(Approx_SweepFunction, Standard_Transient)
0148 };
0149 
0150 #endif // _Approx_SweepFunction_HeaderFile