Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-25 10:08:57

0001 // Created on: 1997-12-19
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_CorrectedFrenet_HeaderFile
0018 #define _GeomFill_CorrectedFrenet_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <NCollection_Array1.hxx>
0023 #include <NCollection_HArray1.hxx>
0024 #include <gp_Vec.hxx>
0025 #include <GeomFill_TrihedronLaw.hxx>
0026 #include <Standard_Real.hxx>
0027 #include <NCollection_Sequence.hxx>
0028 #include <Standard_Integer.hxx>
0029 #include <GeomAbs_Shape.hxx>
0030 #include <GeomFill_Trihedron.hxx>
0031 class GeomFill_Frenet;
0032 class Law_Function;
0033 
0034 //! Defined an Corrected Frenet Trihedron Law It is
0035 //! like Frenet with an Torsion's minimization
0036 class GeomFill_CorrectedFrenet : public GeomFill_TrihedronLaw
0037 {
0038 
0039 public:
0040   Standard_EXPORT GeomFill_CorrectedFrenet();
0041 
0042   Standard_EXPORT GeomFill_CorrectedFrenet(const bool ForEvaluation);
0043 
0044   Standard_EXPORT occ::handle<GeomFill_TrihedronLaw> Copy() const override;
0045 
0046   //! initialize curve of frenet law
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 void SetInterval(const double First, const double Last) override;
0051 
0052   //! compute Triedrhon on curve at parameter <Param>
0053   Standard_EXPORT bool D0(const double Param,
0054                           gp_Vec&      Tangent,
0055                           gp_Vec&      Normal,
0056                           gp_Vec&      BiNormal) override;
0057 
0058   //! compute Triedrhon and derivative Trihedron on curve
0059   //! at parameter <Param>
0060   //! Warning : It used only for C1 or C2 approximation
0061   Standard_EXPORT bool D1(const double Param,
0062                           gp_Vec&      Tangent,
0063                           gp_Vec&      DTangent,
0064                           gp_Vec&      Normal,
0065                           gp_Vec&      DNormal,
0066                           gp_Vec&      BiNormal,
0067                           gp_Vec&      DBiNormal) override;
0068 
0069   //! compute Trihedron on curve
0070   //! first and second derivatives.
0071   //! Warning : It used only for C2 approximation
0072   Standard_EXPORT bool D2(const double Param,
0073                           gp_Vec&      Tangent,
0074                           gp_Vec&      DTangent,
0075                           gp_Vec&      D2Tangent,
0076                           gp_Vec&      Normal,
0077                           gp_Vec&      DNormal,
0078                           gp_Vec&      D2Normal,
0079                           gp_Vec&      BiNormal,
0080                           gp_Vec&      DBiNormal,
0081                           gp_Vec&      D2BiNormal) override;
0082 
0083   //! Returns the number of intervals for continuity
0084   //! <S>.
0085   //! May be one if Continuity(me) >= <S>
0086   Standard_EXPORT int NbIntervals(const GeomAbs_Shape S) const override;
0087 
0088   //! Stores in <T> the parameters bounding the intervals
0089   //! of continuity <S>.
0090   //!
0091   //! The array must provide enough room to accommodate
0092   //! for the parameters. i.e. T.Length() > NbIntervals()
0093   Standard_EXPORT void Intervals(NCollection_Array1<double>& T,
0094                                  const GeomAbs_Shape         S) const override;
0095 
0096   //! Tries to define the best trihedron mode
0097   //! for the curve. It can be:
0098   //! - Frenet
0099   //! - CorrectedFrenet
0100   //! - DiscreteTrihedron
0101   //! Warning: the CorrectedFrenet must be constructed
0102   //! with option ForEvaluation = True,
0103   //! the curve must be set by method SetCurve.
0104   Standard_EXPORT GeomFill_Trihedron EvaluateBestMode();
0105 
0106   //! Get average value of Tangent(t) and Normal(t) it is useful to
0107   //! make fast approximation of rational surfaces.
0108   Standard_EXPORT void GetAverageLaw(gp_Vec& ATangent, gp_Vec& ANormal, gp_Vec& ABiNormal) override;
0109 
0110   //! Say if the law is Constant.
0111   Standard_EXPORT bool IsConstant() const override;
0112 
0113   //! Return True.
0114   Standard_EXPORT bool IsOnlyBy3dCurve() const override;
0115 
0116   DEFINE_STANDARD_RTTIEXT(GeomFill_CorrectedFrenet, GeomFill_TrihedronLaw)
0117 
0118 private:
0119   Standard_EXPORT void Init();
0120 
0121   //! Computes BSpline representation of Normal evolution at one
0122   //! interval of continuity of Frenet. Returns True if FuncInt = 0
0123   Standard_EXPORT bool InitInterval(const double                  First,
0124                                     const double                  Last,
0125                                     const double                  Step,
0126                                     double&                       startAng,
0127                                     gp_Vec&                       prevTangent,
0128                                     gp_Vec&                       prevNormal,
0129                                     gp_Vec&                       aT,
0130                                     gp_Vec&                       aN,
0131                                     occ::handle<Law_Function>&    FuncInt,
0132                                     NCollection_Sequence<double>& SeqPoles,
0133                                     NCollection_Sequence<double>& SeqAngle,
0134                                     NCollection_Sequence<gp_Vec>& SeqTangent,
0135                                     NCollection_Sequence<gp_Vec>& SeqNormal) const;
0136 
0137   //! Computes angle of Normal evolution of Frenet between any two points on the curve.
0138   Standard_EXPORT double CalcAngleAT(const gp_Vec& Tangent,
0139                                      const gp_Vec& Normal,
0140                                      const gp_Vec& prevTangent,
0141                                      const gp_Vec& prevNormal) const;
0142 
0143   //! Get corrected value of angle of Normal evolution of Frenet
0144   Standard_EXPORT double GetAngleAT(const double P) const;
0145 
0146   occ::handle<GeomFill_Frenet>             frenet;
0147   occ::handle<Law_Function>                EvolAroundT;
0148   occ::handle<Law_Function>                TLaw;
0149   gp_Vec                                   AT;
0150   gp_Vec                                   AN;
0151   bool                                     isFrenet;
0152   bool                                     myForEvaluation;
0153   occ::handle<NCollection_HArray1<double>> HArrPoles;
0154   occ::handle<NCollection_HArray1<double>> HArrAngle;
0155   occ::handle<NCollection_HArray1<gp_Vec>> HArrTangent;
0156   occ::handle<NCollection_HArray1<gp_Vec>> HArrNormal;
0157 };
0158 
0159 #endif // _GeomFill_CorrectedFrenet_HeaderFile