Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:14:30

0001 // Created on: 1998-12-14
0002 // Created by: Joelle CHAUVET
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_NSections_HeaderFile
0018 #define _GeomFill_NSections_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <Standard_Real.hxx>
0023 #include <Geom_Curve.hxx>
0024 #include <NCollection_Sequence.hxx>
0025 #include <gp_Trsf.hxx>
0026 #include <GeomFill_SectionLaw.hxx>
0027 #include <gp_Pnt.hxx>
0028 #include <NCollection_Array1.hxx>
0029 #include <gp_Vec.hxx>
0030 #include <Standard_Integer.hxx>
0031 #include <GeomAbs_Shape.hxx>
0032 class Geom_BSplineSurface;
0033 class gp_Pnt;
0034 class Geom_Curve;
0035 
0036 //! Define a Section Law by N Sections
0037 class GeomFill_NSections : public GeomFill_SectionLaw
0038 {
0039 
0040 public:
0041   //! Make a SectionLaw with N Curves.
0042   Standard_EXPORT GeomFill_NSections(const NCollection_Sequence<occ::handle<Geom_Curve>>& NC);
0043 
0044   //! Make a SectionLaw with N Curves and N associated parameters.
0045   Standard_EXPORT GeomFill_NSections(const NCollection_Sequence<occ::handle<Geom_Curve>>& NC,
0046                                      const NCollection_Sequence<double>&                  NP);
0047 
0048   //! Make a SectionLaw with N Curves and N associated parameters.
0049   //! UF and UL are the parametric bounds of the NSections
0050   Standard_EXPORT GeomFill_NSections(const NCollection_Sequence<occ::handle<Geom_Curve>>& NC,
0051                                      const NCollection_Sequence<double>&                  NP,
0052                                      const double                                         UF,
0053                                      const double                                         UL);
0054 
0055   //! Make a SectionLaw with N Curves and N associated parameters.
0056   //! UF and UL are the parametric bounds of the NSections
0057   //! VF and VL are the parametric bounds of the path
0058   Standard_EXPORT GeomFill_NSections(const NCollection_Sequence<occ::handle<Geom_Curve>>& NC,
0059                                      const NCollection_Sequence<double>&                  NP,
0060                                      const double                                         UF,
0061                                      const double                                         UL,
0062                                      const double                                         VF,
0063                                      const double                                         VL);
0064 
0065   //! Make a SectionLaw with N Curves and N associated parameters.
0066   //! UF and UL are the parametric bounds of the NSections
0067   //! VF and VL are the parametric bounds of the path
0068   //! UF and UL are the parametric bounds of the NSections
0069   //! Surf is a reference surface used by BRepFill_NSections
0070   Standard_EXPORT GeomFill_NSections(const NCollection_Sequence<occ::handle<Geom_Curve>>& NC,
0071                                      const NCollection_Sequence<gp_Trsf>&                 Trsfs,
0072                                      const NCollection_Sequence<double>&                  NP,
0073                                      const double                                         UF,
0074                                      const double                                         UL,
0075                                      const double                                         VF,
0076                                      const double                                         VL,
0077                                      const occ::handle<Geom_BSplineSurface>&              Surf);
0078 
0079   //! compute the section for v = param
0080   Standard_EXPORT bool D0(const double                Param,
0081                           NCollection_Array1<gp_Pnt>& Poles,
0082                           NCollection_Array1<double>& Weigths) override;
0083 
0084   //! compute the first derivative in v direction of the
0085   //! section for v = param
0086   //! Warning : It used only for C1 or C2 approximation
0087   Standard_EXPORT bool D1(const double                Param,
0088                           NCollection_Array1<gp_Pnt>& Poles,
0089                           NCollection_Array1<gp_Vec>& DPoles,
0090                           NCollection_Array1<double>& Weigths,
0091                           NCollection_Array1<double>& DWeigths) override;
0092 
0093   //! compute the second derivative in v direction of the
0094   //! section for v = param
0095   //! Warning : It used only for C2 approximation
0096   Standard_EXPORT bool D2(const double                Param,
0097                           NCollection_Array1<gp_Pnt>& Poles,
0098                           NCollection_Array1<gp_Vec>& DPoles,
0099                           NCollection_Array1<gp_Vec>& D2Poles,
0100                           NCollection_Array1<double>& Weigths,
0101                           NCollection_Array1<double>& DWeigths,
0102                           NCollection_Array1<double>& D2Weigths) override;
0103 
0104   //! Sets the reference surface
0105   Standard_EXPORT void SetSurface(const occ::handle<Geom_BSplineSurface>& RefSurf);
0106 
0107   //! Computes the surface
0108   Standard_EXPORT void ComputeSurface();
0109 
0110   //! give if possible an bspline Surface, like iso-v are the
0111   //! section. If it is not possible this methode have to
0112   //! get an Null Surface. Is it the default implementation.
0113   Standard_EXPORT occ::handle<Geom_BSplineSurface> BSplineSurface() const override;
0114 
0115   //! get the format of an section
0116   Standard_EXPORT void SectionShape(int& NbPoles, int& NbKnots, int& Degree) const override;
0117 
0118   //! get the Knots of the section
0119   Standard_EXPORT void Knots(NCollection_Array1<double>& TKnots) const override;
0120 
0121   //! get the Multplicities of the section
0122   Standard_EXPORT void Mults(NCollection_Array1<int>& TMults) const override;
0123 
0124   //! Returns if the sections are rational or not
0125   Standard_EXPORT bool IsRational() const override;
0126 
0127   //! Returns if the sections are periodic or not
0128   Standard_EXPORT bool IsUPeriodic() const override;
0129 
0130   //! Returns if the law isperiodic or not
0131   Standard_EXPORT bool IsVPeriodic() const override;
0132 
0133   //! Returns the number of intervals for continuity
0134   //! <S>.
0135   //! May be one if Continuity(me) >= <S>
0136   Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override;
0137 
0138   //! Stores in <T> the parameters bounding the intervals
0139   //! of continuity <S>.
0140   //!
0141   //! The array must provide enough room to accommodate
0142   //! for the parameters. i.e. T.Length() > NbIntervals()
0143   Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
0144                                  const GeomAbs_Shape         S) const override;
0145 
0146   //! Sets the bounds of the parametric interval on
0147   //! the function
0148   //! This determines the derivatives in these values if the
0149   //! function is not Cn.
0150   Standard_EXPORT void SetInterval(const double First, const double Last) override;
0151 
0152   //! Gets the bounds of the parametric interval on
0153   //! the function
0154   Standard_EXPORT void GetInterval(double& First, double& Last) const override;
0155 
0156   //! Gets the bounds of the function parametric domain.
0157   //! Warning: This domain it is not modified by the
0158   //! SetValue method
0159   Standard_EXPORT void GetDomain(double& First, double& Last) const override;
0160 
0161   //! Returns the tolerances associated at each poles to
0162   //! reach in approximation, to satisfy: BoundTol error
0163   //! at the Boundary AngleTol tangent error at the
0164   //! Boundary (in radian) SurfTol error inside the
0165   //! surface.
0166   Standard_EXPORT void GetTolerance(const double                BoundTol,
0167                                     const double                SurfTol,
0168                                     const double                AngleTol,
0169                                     NCollection_Array1<double>& Tol3d) const override;
0170 
0171   //! Get the barycentre of Surface.
0172   //! An very poor estimation is sufficient.
0173   //! This information is useful to perform well
0174   //! conditioned rational approximation.
0175   //! Warning: Used only if <me> IsRational
0176   Standard_EXPORT gp_Pnt BarycentreOfSurf() const override;
0177 
0178   //! Returns the length of the greater section. This
0179   //! information is useful to G1's control.
0180   //! Warning: With an little value, approximation can be slower.
0181   Standard_EXPORT double MaximalSection() const override;
0182 
0183   //! Compute the minimal value of weight for each poles
0184   //! in all sections.
0185   //! This information is useful to control error
0186   //! in rational approximation.
0187   //! Warning: Used only if <me> IsRational
0188   Standard_EXPORT void GetMinimalWeight(NCollection_Array1<double>& Weigths) const override;
0189 
0190   //! return True If the Law isConstant
0191   Standard_EXPORT bool IsConstant(double& Error) const override;
0192 
0193   //! Return the constant Section if <me> IsConstant.
0194   Standard_EXPORT occ::handle<Geom_Curve> ConstantSection() const override;
0195 
0196   //! Returns True if all section are circle, with same
0197   //! plane,same center and linear radius evolution
0198   //! Return False by Default.
0199   Standard_EXPORT bool IsConicalLaw(double& Error) const override;
0200 
0201   //! Return the circle section at parameter <Param>, if
0202   //! <me> a IsConicalLaw
0203   Standard_EXPORT occ::handle<Geom_Curve> CirclSection(const double Param) const override;
0204 
0205   DEFINE_STANDARD_RTTIEXT(GeomFill_NSections, GeomFill_SectionLaw)
0206 
0207 private:
0208   double                                        UFirst;
0209   double                                        ULast;
0210   double                                        VFirst;
0211   double                                        VLast;
0212   NCollection_Sequence<occ::handle<Geom_Curve>> mySections;
0213   NCollection_Sequence<gp_Trsf>                 myTrsfs;
0214   NCollection_Sequence<double>                  myParams;
0215   occ::handle<Geom_BSplineSurface>              mySurface;
0216   occ::handle<Geom_BSplineSurface>              myRefSurf;
0217 };
0218 
0219 #endif // _GeomFill_NSections_HeaderFile