Back to home page

EIC code displayed by LXR

 
 

    


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

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 _GeomEvaluator_OffsetSurface_HeaderFile
0016 #define _GeomEvaluator_OffsetSurface_HeaderFile
0017 
0018 #include <GeomAdaptor_Surface.hxx>
0019 #include <GeomEvaluator_Surface.hxx>
0020 #include <Geom_OsculatingSurface.hxx>
0021 #include <Geom_Surface.hxx>
0022 
0023 //! Allows to calculate values and derivatives for offset surfaces
0024 class GeomEvaluator_OffsetSurface : public GeomEvaluator_Surface
0025 {
0026 public:
0027   //! Initialize evaluator by surface
0028   Standard_EXPORT GeomEvaluator_OffsetSurface(
0029       const Handle(Geom_Surface)& theBase,
0030       const Standard_Real theOffset,
0031       const Handle(Geom_OsculatingSurface)& theOscSurf = Handle(Geom_OsculatingSurface)());
0032   //! Initialize evaluator by surface adaptor
0033   Standard_EXPORT GeomEvaluator_OffsetSurface(
0034       const Handle(GeomAdaptor_Surface)& theBase,
0035       const Standard_Real theOffset,
0036       const Handle(Geom_OsculatingSurface)& theOscSurf = Handle(Geom_OsculatingSurface)());
0037 
0038   //! Change the offset value
0039   void SetOffsetValue(Standard_Real theOffset)
0040   { myOffset = theOffset; }
0041 
0042   //! Value of surface
0043   Standard_EXPORT void D0(const Standard_Real theU, const Standard_Real theV,
0044                           gp_Pnt& theValue) const Standard_OVERRIDE;
0045   //! Value and first derivatives of surface
0046   Standard_EXPORT void D1(const Standard_Real theU, const Standard_Real theV,
0047                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const Standard_OVERRIDE;
0048   //! Value, first and second derivatives of surface
0049   Standard_EXPORT void D2(const Standard_Real theU, const Standard_Real theV,
0050                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
0051                           gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const Standard_OVERRIDE;
0052   //! Value, first, second and third derivatives of surface
0053   Standard_EXPORT void D3(const Standard_Real theU, const Standard_Real theV,
0054                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
0055                           gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
0056                           gp_Vec& theD3U, gp_Vec& theD3V,
0057                           gp_Vec& theD3UUV, gp_Vec& theD3UVV) const Standard_OVERRIDE;
0058   //! Calculates N-th derivatives of surface, where N = theDerU + theDerV.
0059   //!
0060   //! Raises if N < 1 or theDerU < 0 or theDerV < 0
0061   Standard_EXPORT gp_Vec DN(const Standard_Real theU,
0062                             const Standard_Real theV,
0063                             const Standard_Integer theDerU,
0064                             const Standard_Integer theDerV) const Standard_OVERRIDE;
0065 
0066   Standard_EXPORT Handle(GeomEvaluator_Surface) ShallowCopy() const Standard_OVERRIDE;
0067 
0068   DEFINE_STANDARD_RTTIEXT(GeomEvaluator_OffsetSurface,GeomEvaluator_Surface)
0069 
0070 private:
0071   //! Returns bounds of a base surface
0072   void Bounds(Standard_Real& theUMin, Standard_Real& theUMax,
0073               Standard_Real& theVMin, Standard_Real& theVMax) const;
0074 
0075   //! Recalculate D1 values of base surface into D0 value of offset surface
0076   void CalculateD0(const Standard_Real theU, const Standard_Real theV,
0077                    gp_Pnt& theValue,
0078                    const gp_Vec& theD1U, const gp_Vec& theD1V) const;
0079   //! Recalculate D2 values of base surface into D1 values of offset surface
0080   void CalculateD1(const Standard_Real theU, const Standard_Real theV,
0081                    gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
0082                    const gp_Vec& theD2U, const gp_Vec& theD2V, const gp_Vec& theD2UV) const;
0083   //! Recalculate D3 values of base surface into D2 values of offset surface
0084   void CalculateD2(const Standard_Real theU, const Standard_Real theV,
0085                    gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
0086                    gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
0087                    const gp_Vec& theD3U, const gp_Vec& theD3V,
0088                    const gp_Vec& theD3UUV, const gp_Vec& theD3UVV) const;
0089   //! Recalculate D3 values of base surface into D3 values of offset surface
0090   void CalculateD3(const Standard_Real theU, const Standard_Real theV,
0091                    gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
0092                    gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
0093                    gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const;
0094   //! Calculate DN of offset surface based on derivatives of base surface
0095   gp_Vec CalculateDN(const Standard_Real theU, const Standard_Real theV,
0096                      const Standard_Integer theNu, const Standard_Integer theNv,
0097                      const gp_Vec& theD1U, const gp_Vec& theD1V) const;
0098 
0099   //! Calculate value of base surface/adaptor
0100   void BaseD0(const Standard_Real theU, const Standard_Real theV, gp_Pnt& theValue) const;
0101   //! Calculate value and first derivatives of base surface/adaptor
0102   void BaseD1(const Standard_Real theU, const Standard_Real theV,
0103               gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const;
0104   //! Calculate value, first and second derivatives of base surface/adaptor
0105   void BaseD2(const Standard_Real theU, const Standard_Real theV,
0106               gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
0107               gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const;
0108   //! Calculate value, first, second and third derivatives of base surface/adaptor
0109   void BaseD3(const Standard_Real theU, const Standard_Real theV,
0110               gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
0111               gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
0112               gp_Vec& theD3U, gp_Vec& theD3V, gp_Vec& theD3UUV, gp_Vec& theD3UVV) const;
0113 
0114   //! Replace zero derivative by the corresponding derivative in a near point.
0115   //! Return true, if the derivative was replaced.
0116   Standard_Boolean ReplaceDerivative(const Standard_Real theU, const Standard_Real theV,
0117                                      gp_Vec& theDU, gp_Vec& theDV,
0118                                      const Standard_Real theSquareTol) const;
0119 
0120 private:
0121   Handle(Geom_Surface)       myBaseSurf;
0122   Handle(GeomAdaptor_Surface) myBaseAdaptor;
0123 
0124   Standard_Real myOffset; ///< offset value
0125   Handle(Geom_OsculatingSurface) myOscSurf; ///< auxiliary osculating surface
0126 };
0127 
0128 DEFINE_STANDARD_HANDLE(GeomEvaluator_OffsetSurface, GeomEvaluator_Surface)
0129 
0130 
0131 #endif // _GeomEvaluator_OffsetSurface_HeaderFile