0029948: Uninitialized variable in GeomEvaluator_OffsetSurface::CalculateD0(...)...
[occt.git] / src / GeomEvaluator / GeomEvaluator_SurfaceOfExtrusion.hxx
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 <GeomEvaluator_Surface.hxx>
19
20 #include <Geom_Curve.hxx>
21 #include <gp_Dir.hxx>
22
23 class Adaptor3d_HCurve;
24
25 //! Allows to calculate values and derivatives for surfaces of linear extrusion
26 class GeomEvaluator_SurfaceOfExtrusion : public GeomEvaluator_Surface
27 {
28 public:
29   //! Initialize evaluator by surface
30   Standard_EXPORT GeomEvaluator_SurfaceOfExtrusion(const Handle(Geom_Curve)& theBase,
31                                                    const gp_Dir& theExtrusionDir);
32   //! Initialize evaluator by surface adaptor
33   Standard_EXPORT GeomEvaluator_SurfaceOfExtrusion(const Handle(Adaptor3d_HCurve)& theBase,
34                                                    const gp_Dir& theExtrusionDir);
35
36   ///! Changes the direction of extrusion
37   void SetDirection(const gp_Dir& theDirection)
38   { myDirection = theDirection; }
39
40   //! Value of surface
41   Standard_EXPORT void D0(const Standard_Real theU, const Standard_Real theV,
42                           gp_Pnt& theValue) const Standard_OVERRIDE;
43   //! Value and first derivatives of surface
44   Standard_EXPORT void D1(const Standard_Real theU, const Standard_Real theV,
45                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const Standard_OVERRIDE;
46   //! Value, first and second derivatives of surface
47   Standard_EXPORT void D2(const Standard_Real theU, const Standard_Real theV,
48                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
49                           gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const Standard_OVERRIDE;
50   //! Value, first, second and third derivatives of surface
51   Standard_EXPORT void D3(const Standard_Real theU, const Standard_Real theV,
52                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
53                           gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
54                           gp_Vec& theD3U, gp_Vec& theD3V,
55                           gp_Vec& theD3UUV, gp_Vec& theD3UVV) const Standard_OVERRIDE;
56   //! Calculates N-th derivatives of surface, where N = theDerU + theDerV.
57   //!
58   //! Raises if N < 1 or theDerU < 0 or theDerV < 0
59   Standard_EXPORT gp_Vec DN(const Standard_Real theU,
60                             const Standard_Real theV,
61                             const Standard_Integer theDerU,
62                             const Standard_Integer theDerV) 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)
68   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_HCurve) myBaseAdaptor;
76
77   gp_Dir myDirection;
78 };
79
80 DEFINE_STANDARD_HANDLE(GeomEvaluator_SurfaceOfExtrusion, GeomEvaluator_Surface)
81
82
83 #endif // _GeomEvaluator_SurfaceOfExtrusion_HeaderFile