Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:17:32

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_LocationLaw_HeaderFile
0018 #define _GeomFill_LocationLaw_HeaderFile
0019 
0020 #include <Adaptor3d_Curve.hxx>
0021 #include <GeomAbs_Shape.hxx>
0022 #include <GeomFill_PipeError.hxx>
0023 #include <gp_Pnt2d.hxx>
0024 #include <NCollection_Array1.hxx>
0025 #include <gp_Vec2d.hxx>
0026 
0027 class gp_Mat;
0028 class gp_Vec;
0029 class gp_Pnt;
0030 
0031 //! To define location law in Sweeping location is
0032 //! defined by an Matrix M and an Vector V, and
0033 //! transform an point P in MP+V.
0034 class GeomFill_LocationLaw : public Standard_Transient
0035 {
0036 
0037 public:
0038   //! initialize curve of location law
0039   Standard_EXPORT virtual bool SetCurve(const occ::handle<Adaptor3d_Curve>& C) = 0;
0040 
0041   Standard_EXPORT virtual const occ::handle<Adaptor3d_Curve>& GetCurve() const = 0;
0042 
0043   //! Set a transformation Matrix like the law M(t) become
0044   //! Mat * M(t)
0045   Standard_EXPORT virtual void SetTrsf(const gp_Mat& Transfo) = 0;
0046 
0047   Standard_EXPORT virtual occ::handle<GeomFill_LocationLaw> Copy() const = 0;
0048 
0049   //! compute Location
0050   Standard_EXPORT virtual bool D0(const double Param, gp_Mat& M, gp_Vec& V) = 0;
0051 
0052   //! compute Location and 2d points
0053   Standard_EXPORT virtual bool D0(const double                  Param,
0054                                   gp_Mat&                       M,
0055                                   gp_Vec&                       V,
0056                                   NCollection_Array1<gp_Pnt2d>& Poles2d) = 0;
0057 
0058   //! compute location 2d points and associated
0059   //! first derivatives.
0060   //! Warning: It used only for C1 or C2 approximation
0061   Standard_EXPORT virtual bool D1(const double                  Param,
0062                                   gp_Mat&                       M,
0063                                   gp_Vec&                       V,
0064                                   gp_Mat&                       DM,
0065                                   gp_Vec&                       DV,
0066                                   NCollection_Array1<gp_Pnt2d>& Poles2d,
0067                                   NCollection_Array1<gp_Vec2d>& DPoles2d);
0068 
0069   //! compute location 2d points and associated
0070   //! first and second derivatives.
0071   //! Warning: It used only for C2 approximation
0072   Standard_EXPORT virtual bool D2(const double                  Param,
0073                                   gp_Mat&                       M,
0074                                   gp_Vec&                       V,
0075                                   gp_Mat&                       DM,
0076                                   gp_Vec&                       DV,
0077                                   gp_Mat&                       D2M,
0078                                   gp_Vec&                       D2V,
0079                                   NCollection_Array1<gp_Pnt2d>& Poles2d,
0080                                   NCollection_Array1<gp_Vec2d>& DPoles2d,
0081                                   NCollection_Array1<gp_Vec2d>& D2Poles2d);
0082 
0083   //! get the number of 2d curves (Restrictions + Traces)
0084   //! to approximate.
0085   Standard_EXPORT int Nb2dCurves() const;
0086 
0087   //! Say if the first restriction is defined in this class.
0088   //! If it is true the first element of poles array in
0089   //! D0,D1,D2... Correspond to this restriction.
0090   //! Returns false (default implementation)
0091   Standard_EXPORT virtual bool HasFirstRestriction() const;
0092 
0093   //! Say if the last restriction is defined in this class.
0094   //! If it is true the last element of poles array in
0095   //! D0,D1,D2... Correspond to this restriction.
0096   //! Returns false (default implementation)
0097   Standard_EXPORT virtual bool HasLastRestriction() const;
0098 
0099   //! Give the number of trace (Curves 2d which are not restriction)
0100   //! Returns 0 (default implementation)
0101   Standard_EXPORT virtual int TraceNumber() const;
0102 
0103   //! Give a status to the Law
0104   //! Returns PipeOk (default implementation)
0105   Standard_EXPORT virtual GeomFill_PipeError ErrorStatus() const;
0106 
0107   //! Returns the number of intervals for continuity <S>.
0108   //! May be one if Continuity(me) >= <S>
0109   Standard_EXPORT virtual int NbIntervals(const GeomAbs_Shape S) const = 0;
0110 
0111   //! Stores in <T> the parameters bounding the intervals
0112   //! of continuity <S>.
0113   //!
0114   //! The array must provide enough room to accommodate
0115   //! for the parameters. i.e. T.Length() > NbIntervals()
0116   Standard_EXPORT virtual void Intervals(NCollection_Array1<double>& T,
0117                                          const GeomAbs_Shape         S) const = 0;
0118 
0119   //! Sets the bounds of the parametric interval on
0120   //! the function
0121   //! This determines the derivatives in these values if the
0122   //! function is not Cn.
0123   Standard_EXPORT virtual void SetInterval(const double First, const double Last) = 0;
0124 
0125   //! Gets the bounds of the parametric interval on
0126   //! the function
0127   Standard_EXPORT virtual void GetInterval(double& First, double& Last) const = 0;
0128 
0129   //! Gets the bounds of the function parametric domain.
0130   //! Warning: This domain it is not modified by the
0131   //! SetValue method
0132   Standard_EXPORT virtual void GetDomain(double& First, double& Last) const = 0;
0133 
0134   //! Returns the resolutions in the sub-space 2d <Index>
0135   //! This information is useful to find a good tolerance in
0136   //! 2d approximation.
0137   Standard_EXPORT virtual void Resolution(const int    Index,
0138                                           const double Tol,
0139                                           double&      TolU,
0140                                           double&      TolV) const;
0141 
0142   //! Is useful, if (me) have to run numerical
0143   //! algorithm to perform D0, D1 or D2
0144   //! The default implementation make nothing.
0145   Standard_EXPORT virtual void SetTolerance(const double Tol3d, const double Tol2d);
0146 
0147   //! Get the maximum Norm of the matrix-location part. It
0148   //! is usful to find a good Tolerance to approx M(t).
0149   Standard_EXPORT virtual double GetMaximalNorm() = 0;
0150 
0151   //! Get average value of M(t) and V(t) it is useful to
0152   //! make fast approximation of rational surfaces.
0153   Standard_EXPORT virtual void GetAverageLaw(gp_Mat& AM, gp_Vec& AV) = 0;
0154 
0155   //! Say if the Location Law, is an translation of Location
0156   //! The default implementation is " returns False ".
0157   Standard_EXPORT virtual bool IsTranslation(double& Error) const;
0158 
0159   //! Say if the Location Law, is a rotation of Location
0160   //! The default implementation is " returns False ".
0161   Standard_EXPORT virtual bool IsRotation(double& Error) const;
0162 
0163   Standard_EXPORT virtual void Rotation(gp_Pnt& Center) const;
0164 
0165   DEFINE_STANDARD_RTTIEXT(GeomFill_LocationLaw, Standard_Transient)
0166 };
0167 
0168 #endif // _GeomFill_LocationLaw_HeaderFile