Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-29 08:16:02

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