1 // Created on: 2015-09-21
2 // Copyright (c) 2015 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14 
15 #ifndef _GeomEvaluator_SurfaceOfExtrusion_HeaderFile
16 #define _GeomEvaluator_SurfaceOfExtrusion_HeaderFile
17 
18 #include <Adaptor3d_Curve.hxx>
19 #include <GeomEvaluator_Surface.hxx>
20 #include <Geom_Curve.hxx>
21 #include <gp_Dir.hxx>
22 
23 //! Allows to calculate values and derivatives for surfaces of linear extrusion
24 class GeomEvaluator_SurfaceOfExtrusion : public GeomEvaluator_Surface
25 {
26 public:
27   //! Initialize evaluator by surface
28   Standard_EXPORT GeomEvaluator_SurfaceOfExtrusion(const Handle(Geom_Curve)& theBase,
29                                                    const gp_Dir& theExtrusionDir);
30   //! Initialize evaluator by surface adaptor
31   Standard_EXPORT GeomEvaluator_SurfaceOfExtrusion(const Handle(Adaptor3d_Curve)& theBase,
32                                                    const gp_Dir& theExtrusionDir);
33 
34   ///! Changes the direction of extrusion
SetDirection(const gp_Dir & theDirection)35   void SetDirection(const gp_Dir& theDirection)
36   { myDirection = theDirection; }
37 
38   //! Value of surface
39   Standard_EXPORT void D0(const Standard_Real theU, const Standard_Real theV,
40                           gp_Pnt& theValue) const Standard_OVERRIDE;
41   //! Value and first derivatives of surface
42   Standard_EXPORT void D1(const Standard_Real theU, const Standard_Real theV,
43                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const Standard_OVERRIDE;
44   //! Value, first and second derivatives of surface
45   Standard_EXPORT void D2(const Standard_Real theU, const Standard_Real theV,
46                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
47                           gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const Standard_OVERRIDE;
48   //! Value, first, second and third derivatives of surface
49   Standard_EXPORT void D3(const Standard_Real theU, const Standard_Real theV,
50                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
51                           gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
52                           gp_Vec& theD3U, gp_Vec& theD3V,
53                           gp_Vec& theD3UUV, gp_Vec& theD3UVV) const Standard_OVERRIDE;
54   //! Calculates N-th derivatives of surface, where N = theDerU + theDerV.
55   //!
56   //! Raises if N < 1 or theDerU < 0 or theDerV < 0
57   Standard_EXPORT gp_Vec DN(const Standard_Real theU,
58                             const Standard_Real theV,
59                             const Standard_Integer theDerU,
60                             const Standard_Integer theDerV) const Standard_OVERRIDE;
61 
62   Standard_EXPORT Handle(GeomEvaluator_Surface) ShallowCopy() const Standard_OVERRIDE;
63 
64   DEFINE_STANDARD_RTTIEXT(GeomEvaluator_SurfaceOfExtrusion,GeomEvaluator_Surface)
65 
66 private:
67   //! Shift the point along direction to the given distance (theShift)
Shift(const Standard_Real theShift,gp_Pnt & thePoint) const68   void Shift(const Standard_Real theShift, gp_Pnt& thePoint) const
69   {
70     thePoint.ChangeCoord() += myDirection.XYZ() * theShift;
71   }
72 
73 private:
74   Handle(Geom_Curve)       myBaseCurve;
75   Handle(Adaptor3d_Curve) myBaseAdaptor;
76 
77   gp_Dir myDirection;
78 };
79 
80 DEFINE_STANDARD_HANDLE(GeomEvaluator_SurfaceOfExtrusion, GeomEvaluator_Surface)
81 
82 
83 #endif // _GeomEvaluator_SurfaceOfExtrusion_HeaderFile
84