Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:34

0001 // Created on: 2015-09-21
0002 // Copyright (c) 2015 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _Geom2dEvaluator_OffsetCurve_HeaderFile
0016 #define _Geom2dEvaluator_OffsetCurve_HeaderFile
0017 
0018 #include <Geom2dAdaptor_Curve.hxx>
0019 #include <Geom2dEvaluator_Curve.hxx>
0020 
0021 //! Allows to calculate values and derivatives for offset curves in 2D
0022 class Geom2dEvaluator_OffsetCurve : public Geom2dEvaluator_Curve
0023 {
0024 public:
0025   //! Initialize evaluator by curve
0026   Standard_EXPORT Geom2dEvaluator_OffsetCurve(
0027       const Handle(Geom2d_Curve)& theBase,
0028       const Standard_Real theOffset);
0029   //! Initialize evaluator by curve adaptor
0030   Standard_EXPORT Geom2dEvaluator_OffsetCurve(
0031       const Handle(Geom2dAdaptor_Curve)& theBase,
0032       const Standard_Real theOffset);
0033 
0034   //! Change the offset value
0035   void SetOffsetValue(Standard_Real theOffset)
0036   { myOffset = theOffset; }
0037 
0038   //! Value of curve
0039   Standard_EXPORT void D0(const Standard_Real theU,
0040                           gp_Pnt2d& theValue) const Standard_OVERRIDE;
0041   //! Value and first derivatives of curve
0042   Standard_EXPORT void D1(const Standard_Real theU,
0043                           gp_Pnt2d& theValue, gp_Vec2d& theD1) const Standard_OVERRIDE;
0044   //! Value, first and second derivatives of curve
0045   Standard_EXPORT void D2(const Standard_Real theU,
0046                           gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2) const Standard_OVERRIDE;
0047   //! Value, first, second and third derivatives of curve
0048   Standard_EXPORT void D3(const Standard_Real theU,
0049                           gp_Pnt2d& theValue, gp_Vec2d& theD1,
0050                           gp_Vec2d& theD2, gp_Vec2d& theD3) const Standard_OVERRIDE;
0051   //! Calculates N-th derivatives of curve, where N = theDeriv. Raises if N < 1
0052   Standard_EXPORT gp_Vec2d DN(const Standard_Real theU,
0053                               const Standard_Integer theDeriv) const Standard_OVERRIDE;
0054 
0055   Standard_EXPORT Handle(Geom2dEvaluator_Curve) ShallowCopy() const Standard_OVERRIDE;
0056 
0057   DEFINE_STANDARD_RTTIEXT(Geom2dEvaluator_OffsetCurve,Geom2dEvaluator_Curve)
0058 
0059 private:
0060   //! Calculate value of base curve/adaptor
0061   void BaseD0(const Standard_Real theU, gp_Pnt2d& theValue) const;
0062   //! Calculate value and first derivatives of base curve/adaptor
0063   void BaseD1(const Standard_Real theU,
0064               gp_Pnt2d& theValue, gp_Vec2d& theD1) const;
0065   //! Calculate value, first and second derivatives of base curve/adaptor
0066   void BaseD2(const Standard_Real theU,
0067               gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2) const;
0068   //! Calculate value, first, second and third derivatives of base curve/adaptor
0069   void BaseD3(const Standard_Real theU,
0070               gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2, gp_Vec2d& theD3) const;
0071   //! Calculate value and derivatives till 4th of base curve/adaptor
0072   void BaseD4(const Standard_Real theU,
0073               gp_Pnt2d& theValue, gp_Vec2d& theD1, gp_Vec2d& theD2, gp_Vec2d& theD3, gp_Vec2d& theD4) const;
0074   //! Calculate N-th derivative of base curve/adaptor
0075   gp_Vec2d BaseDN(const Standard_Real theU, const Standard_Integer theDeriv) const;
0076 
0077   // Recalculate derivatives in the singular point
0078   // Returns true if the direction of derivatives is changed
0079   Standard_Boolean AdjustDerivative(const Standard_Integer theMaxDerivative,
0080                                     const Standard_Real theU,
0081                                           gp_Vec2d& theD1,
0082                                           gp_Vec2d& theD2,
0083                                           gp_Vec2d& theD3,
0084                                           gp_Vec2d& theD4) const;
0085 
0086 private:
0087   Handle(Geom2d_Curve)         myBaseCurve;
0088   Handle(Geom2dAdaptor_Curve) myBaseAdaptor;
0089 
0090   Standard_Real myOffset;    ///< offset value
0091 };
0092 
0093 DEFINE_STANDARD_HANDLE(Geom2dEvaluator_OffsetCurve, Geom2dEvaluator_Curve)
0094 
0095 
0096 #endif // _Geom2dEvaluator_OffsetCurve_HeaderFile