Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:15:40

0001 // Created on: 1998-07-08
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_LocationGuide_HeaderFile
0018 #define _GeomFill_LocationGuide_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <gp_Pnt2d.hxx>
0023 #include <NCollection_Array2.hxx>
0024 #include <NCollection_HArray2.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Standard_Real.hxx>
0027 #include <gp_Mat.hxx>
0028 #include <math_Vector.hxx>
0029 #include <GeomFill_LocationLaw.hxx>
0030 #include <NCollection_Array1.hxx>
0031 #include <gp_Vec2d.hxx>
0032 #include <GeomAbs_Shape.hxx>
0033 #include <NCollection_HArray1.hxx>
0034 class GeomFill_TrihedronWithGuide;
0035 class GeomFill_SectionLaw;
0036 class gp_Vec;
0037 class gp_Pnt;
0038 class Geom_Curve;
0039 
0040 class GeomFill_LocationGuide : public GeomFill_LocationLaw
0041 {
0042 
0043 public:
0044   Standard_EXPORT GeomFill_LocationGuide(const occ::handle<GeomFill_TrihedronWithGuide>& Triedre);
0045 
0046   Standard_EXPORT void Set(const occ::handle<GeomFill_SectionLaw>& Section,
0047                            const bool                              rotat,
0048                            const double                            SFirst,
0049                            const double                            SLast,
0050                            const double                            PrecAngle,
0051                            double&                                 LastAngle);
0052 
0053   Standard_EXPORT void EraseRotation();
0054 
0055   //! calculating poles on a surface (courbe guide / the surface of rotation in points myNbPts)
0056   //! @return true
0057   Standard_EXPORT bool SetCurve(const occ::handle<Adaptor3d_Curve>& C) override;
0058 
0059   Standard_EXPORT const occ::handle<Adaptor3d_Curve>& GetCurve() const override;
0060 
0061   Standard_EXPORT void SetTrsf(const gp_Mat& Transfo) override;
0062 
0063   Standard_EXPORT occ::handle<GeomFill_LocationLaw> Copy() const override;
0064 
0065   //! compute Location
0066   Standard_EXPORT bool D0(const double Param, gp_Mat& M, gp_Vec& V) override;
0067 
0068   //! compute Location and 2d points
0069   Standard_EXPORT bool D0(const double                  Param,
0070                           gp_Mat&                       M,
0071                           gp_Vec&                       V,
0072                           NCollection_Array1<gp_Pnt2d>& Poles2d) override;
0073 
0074   //! compute location 2d points and associated
0075   //! first derivatives.
0076   //! Warning : It used only for C1 or C2 approximation
0077   Standard_EXPORT bool D1(const double                  Param,
0078                           gp_Mat&                       M,
0079                           gp_Vec&                       V,
0080                           gp_Mat&                       DM,
0081                           gp_Vec&                       DV,
0082                           NCollection_Array1<gp_Pnt2d>& Poles2d,
0083                           NCollection_Array1<gp_Vec2d>& DPoles2d) override;
0084 
0085   //! compute location 2d points and associated
0086   //! first and second derivatives.
0087   //! Warning : It used only for C2 approximation
0088   Standard_EXPORT bool D2(const double                  Param,
0089                           gp_Mat&                       M,
0090                           gp_Vec&                       V,
0091                           gp_Mat&                       DM,
0092                           gp_Vec&                       DV,
0093                           gp_Mat&                       D2M,
0094                           gp_Vec&                       D2V,
0095                           NCollection_Array1<gp_Pnt2d>& Poles2d,
0096                           NCollection_Array1<gp_Vec2d>& DPoles2d,
0097                           NCollection_Array1<gp_Vec2d>& D2Poles2d) override;
0098 
0099   //! Say if the first restriction is defined in this class.
0100   //! If it is true the first element of poles array in
0101   //! D0,D1,D2... Correspond to this restriction.
0102   //! Returns false (default implementation)
0103   Standard_EXPORT bool HasFirstRestriction() const override;
0104 
0105   //! Say if the last restriction is defined in this class.
0106   //! If it is true the last element of poles array in
0107   //! D0,D1,D2... Correspond to this restriction.
0108   //! Returns false (default implementation)
0109   Standard_EXPORT bool HasLastRestriction() const override;
0110 
0111   //! Give the number of trace (Curves 2d which are not restriction)
0112   //! Returns 1 (default implementation)
0113   Standard_EXPORT int TraceNumber() const override;
0114 
0115   //! Give a status to the Law
0116   //! Returns PipeOk (default implementation)
0117   Standard_EXPORT GeomFill_PipeError ErrorStatus() const override;
0118 
0119   //! Returns the number of intervals for continuity <S>.
0120   //! May be one if Continuity(me) >= <S>
0121   Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override;
0122 
0123   //! Stores in <T> the parameters bounding the intervals
0124   //! of continuity <S>.
0125   //!
0126   //! The array must provide enough room to accommodate
0127   //! for the parameters. i.e. T.Length() > NbIntervals()
0128   Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
0129                                  const GeomAbs_Shape         S) const override;
0130 
0131   //! Sets the bounds of the parametric interval on
0132   //! the function
0133   //! This determines the derivatives in these values if the
0134   //! function is not Cn.
0135   Standard_EXPORT void SetInterval(const double First, const double Last) override;
0136 
0137   //! Gets the bounds of the parametric interval on
0138   //! the function
0139   Standard_EXPORT void GetInterval(double& First, double& Last) const override;
0140 
0141   //! Gets the bounds of the function parametric domain.
0142   //! Warning: This domain it is not modified by the
0143   //! SetValue method
0144   Standard_EXPORT void GetDomain(double& First, double& Last) const override;
0145 
0146   //! Is useful, if (me) have to run numerical
0147   //! algorithm to perform D0, D1 or D2
0148   //! The default implementation make nothing.
0149   Standard_EXPORT void SetTolerance(const double Tol3d, const double Tol2d) override;
0150 
0151   //! Returns the resolutions in the sub-space 2d <Index>
0152   //! This information is useful to find a good tolerance in
0153   //! 2d approximation.
0154   //! Warning: Used only if Nb2dCurve > 0
0155   Standard_EXPORT void Resolution(const int    Index,
0156                                   const double Tol,
0157                                   double&      TolU,
0158                                   double&      TolV) const override;
0159 
0160   //! Get the maximum Norm of the matrix-location part. It
0161   //! is usful to find a good Tolerance to approx M(t).
0162   Standard_EXPORT double GetMaximalNorm() override;
0163 
0164   //! Get average value of M(t) and V(t) it is useful to
0165   //! make fast approximation of rational surfaces.
0166   Standard_EXPORT void GetAverageLaw(gp_Mat& AM, gp_Vec& AV) override;
0167 
0168   //! Say if the Location Law, is an translation of Location
0169   //! The default implementation is " returns False ".
0170   Standard_EXPORT bool IsTranslation(double& Error) const override;
0171 
0172   //! Say if the Location Law, is a rotation of Location
0173   //! The default implementation is " returns False ".
0174   Standard_EXPORT bool IsRotation(double& Error) const override;
0175 
0176   Standard_EXPORT void Rotation(gp_Pnt& Center) const override;
0177 
0178   Standard_EXPORT occ::handle<Geom_Curve> Section() const;
0179 
0180   Standard_EXPORT occ::handle<Adaptor3d_Curve> Guide() const;
0181 
0182   Standard_EXPORT void SetOrigine(const double Param1, const double Param2);
0183 
0184   Standard_EXPORT GeomFill_PipeError
0185     ComputeAutomaticLaw(occ::handle<NCollection_HArray1<gp_Pnt2d>>& ParAndRad) const;
0186 
0187   DEFINE_STANDARD_RTTIEXT(GeomFill_LocationGuide, GeomFill_LocationLaw)
0188 
0189 protected:
0190   occ::handle<NCollection_HArray2<gp_Pnt2d>> myPoles2d;
0191 
0192 private:
0193   Standard_EXPORT void SetRotation(const double PrecAngle, double& LastAngle);
0194 
0195   Standard_EXPORT void InitX(const double Param);
0196 
0197   occ::handle<GeomFill_TrihedronWithGuide> myLaw;
0198   occ::handle<GeomFill_SectionLaw>         mySec;
0199   occ::handle<Adaptor3d_Curve>             myCurve;
0200   occ::handle<Adaptor3d_Curve>             myGuide;
0201   occ::handle<Adaptor3d_Curve>             myTrimmed;
0202   int                                      myNbPts;
0203   bool                                     rotation;
0204   double                                   OrigParam1;
0205   double                                   OrigParam2;
0206   double                                   Uf;
0207   double                                   Ul;
0208   double                                   myFirstS;
0209   double                                   myLastS;
0210   double                                   ratio;
0211   bool                                     WithTrans;
0212   gp_Mat                                   Trans;
0213   math_Vector                              TolRes;
0214   math_Vector                              Inf;
0215   math_Vector                              Sup;
0216   math_Vector                              X;
0217   math_Vector                              R;
0218   GeomFill_PipeError                       myStatus;
0219 };
0220 
0221 #endif // _GeomFill_LocationGuide_HeaderFile