Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:17:38

0001 // Created on: 1998-04-21
0002 // Created by: Stephanie HUMEAU
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 _GeomFill_LocationDraft_HeaderFile
0018 #define _GeomFill_LocationDraft_HeaderFile
0019 
0020 #include <Adaptor3d_Surface.hxx>
0021 #include <gp_Mat.hxx>
0022 #include <gp_Dir.hxx>
0023 #include <Standard_Real.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <gp_Pnt2d.hxx>
0026 #include <NCollection_Array1.hxx>
0027 #include <NCollection_HArray1.hxx>
0028 #include <Standard_Boolean.hxx>
0029 #include <GeomFill_LocationLaw.hxx>
0030 #include <gp_Vec2d.hxx>
0031 #include <GeomAbs_Shape.hxx>
0032 
0033 class GeomFill_DraftTrihedron;
0034 
0035 class GeomFill_LocationDraft : public GeomFill_LocationLaw
0036 {
0037 
0038 public:
0039   Standard_EXPORT GeomFill_LocationDraft(const gp_Dir& Direction, const double Angle);
0040 
0041   Standard_EXPORT void SetStopSurf(const occ::handle<Adaptor3d_Surface>& Surf);
0042 
0043   Standard_EXPORT void SetAngle(const double Angle);
0044 
0045   //! calculation of poles on locking surfaces (the intersection between the generatrixand the
0046   //! surface at the cross - section points myNbPts)
0047   //! @return true in case if execution end correctly
0048   Standard_EXPORT bool SetCurve(const occ::handle<Adaptor3d_Curve>& C) override;
0049 
0050   Standard_EXPORT const occ::handle<Adaptor3d_Curve>& GetCurve() const override;
0051 
0052   Standard_EXPORT void SetTrsf(const gp_Mat& Transfo) override;
0053 
0054   Standard_EXPORT occ::handle<GeomFill_LocationLaw> Copy() const override;
0055 
0056   //! compute Location
0057   Standard_EXPORT bool D0(const double Param, gp_Mat& M, gp_Vec& V) override;
0058 
0059   //! compute Location and 2d points
0060   Standard_EXPORT bool D0(const double                  Param,
0061                           gp_Mat&                       M,
0062                           gp_Vec&                       V,
0063                           NCollection_Array1<gp_Pnt2d>& Poles2d) override;
0064 
0065   //! compute location 2d points and associated
0066   //! first derivatives.
0067   //! Warning : It used only for C1 or C2 approximation
0068   Standard_EXPORT bool D1(const double                  Param,
0069                           gp_Mat&                       M,
0070                           gp_Vec&                       V,
0071                           gp_Mat&                       DM,
0072                           gp_Vec&                       DV,
0073                           NCollection_Array1<gp_Pnt2d>& Poles2d,
0074                           NCollection_Array1<gp_Vec2d>& DPoles2d) override;
0075 
0076   //! compute location 2d points and associated
0077   //! first and second derivatives.
0078   //! Warning : It used only for C2 approximation
0079   Standard_EXPORT bool D2(const double                  Param,
0080                           gp_Mat&                       M,
0081                           gp_Vec&                       V,
0082                           gp_Mat&                       DM,
0083                           gp_Vec&                       DV,
0084                           gp_Mat&                       D2M,
0085                           gp_Vec&                       D2V,
0086                           NCollection_Array1<gp_Pnt2d>& Poles2d,
0087                           NCollection_Array1<gp_Vec2d>& DPoles2d,
0088                           NCollection_Array1<gp_Vec2d>& D2Poles2d) override;
0089 
0090   //! Say if the first restriction is defined in this class.
0091   //! If it is true the first element of poles array in
0092   //! D0,D1,D2... Correspond to this restriction.
0093   //! Returns false (default implementation)
0094   Standard_EXPORT bool HasFirstRestriction() const override;
0095 
0096   //! Say if the last restriction is defined in this class.
0097   //! If it is true the last element of poles array in
0098   //! D0,D1,D2... Correspond to this restriction.
0099   //! Returns false (default implementation)
0100   Standard_EXPORT bool HasLastRestriction() const override;
0101 
0102   //! Give the number of trace (Curves 2d which are not restriction)
0103   //! Returns 1 (default implementation)
0104   Standard_EXPORT int TraceNumber() const override;
0105 
0106   //! Returnsthe number of intervals for continuity <S>.
0107   //! May be one if Continuity(me) >= <S>
0108   Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override;
0109 
0110   //! Stores in <T> the parameters bounding the intervals
0111   //! of continuity <S>.
0112   //!
0113   //! The array must provide enough room to accommodate
0114   //! for the parameters. i.e. T.Length() > NbIntervals()
0115   Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
0116                                  const GeomAbs_Shape         S) const override;
0117 
0118   //! Sets the bounds of the parametric interval on
0119   //! the function
0120   //! This determines the derivatives in these values if the
0121   //! function is not Cn.
0122   Standard_EXPORT void SetInterval(const double First, const double Last) override;
0123 
0124   //! Gets the bounds of the parametric interval on
0125   //! the function
0126   Standard_EXPORT void GetInterval(double& First, double& Last) const override;
0127 
0128   //! Gets the bounds of the function parametric domain.
0129   //! Warning: This domain it is not modified by the
0130   //! SetValue method
0131   Standard_EXPORT void GetDomain(double& First, double& Last) const override;
0132 
0133   //! Returns the resolutions in the sub-space 2d <Index>
0134   //! This information is useful to find a good tolerance in
0135   //! 2d approximation.
0136   //! Warning: Used only if Nb2dCurve > 0
0137   Standard_EXPORT void Resolution(const int    Index,
0138                                   const double Tol,
0139                                   double&      TolU,
0140                                   double&      TolV) const override;
0141 
0142   //! Get the maximum Norm of the matrix-location part. It
0143   //! is usful to find a good Tolerance to approx M(t).
0144   Standard_EXPORT double GetMaximalNorm() override;
0145 
0146   //! Get average value of M(t) and V(t) it is useful to
0147   //! make fast approximation of rational surfaces.
0148   Standard_EXPORT void GetAverageLaw(gp_Mat& AM, gp_Vec& AV) override;
0149 
0150   //! Say if the Location Law, is an translation of Location
0151   //! The default implementation is " returns False ".
0152   Standard_EXPORT bool IsTranslation(double& Error) const override;
0153 
0154   //! Say if the Location Law, is a rotation of Location
0155   //! The default implementation is " returns False ".
0156   Standard_EXPORT bool IsRotation(double& Error) const override;
0157 
0158   Standard_EXPORT void Rotation(gp_Pnt& Center) const override;
0159 
0160   //! Say if the generatrice interset the surface
0161   Standard_EXPORT bool IsIntersec() const;
0162 
0163   Standard_EXPORT gp_Dir Direction() const;
0164 
0165   DEFINE_STANDARD_RTTIEXT(GeomFill_LocationDraft, GeomFill_LocationLaw)
0166 
0167 protected:
0168   occ::handle<NCollection_HArray1<gp_Pnt2d>> myPoles2d;
0169 
0170 private:
0171   Standard_EXPORT void Prepare();
0172 
0173   gp_Mat                               Trans;
0174   occ::handle<GeomFill_DraftTrihedron> myLaw;
0175   occ::handle<Adaptor3d_Surface>       mySurf;
0176   occ::handle<Adaptor3d_Curve>         myCurve;
0177   occ::handle<Adaptor3d_Curve>         myTrimmed;
0178   gp_Dir                               myDir;
0179   double                               myAngle;
0180   int                                  myNbPts;
0181   bool                                 Intersec;
0182   bool                                 WithTrans;
0183 };
0184 
0185 #endif // _GeomFill_LocationDraft_HeaderFile