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_SurfaceOfRevolution_HeaderFile
16 #define _GeomEvaluator_SurfaceOfRevolution_HeaderFile
17 
18 #include <Adaptor3d_Curve.hxx>
19 #include <GeomEvaluator_Surface.hxx>
20 #include <Geom_Curve.hxx>
21 #include <gp_Dir.hxx>
22 #include <gp_Pnt.hxx>
23 #include <gp_Ax1.hxx>
24 
25 //! Allows to calculate values and derivatives for surfaces of revolution
26 class GeomEvaluator_SurfaceOfRevolution : public GeomEvaluator_Surface
27 {
28 public:
29   //! Initialize evaluator by revolved curve, the axis of revolution and the location
30   Standard_EXPORT GeomEvaluator_SurfaceOfRevolution(const Handle(Geom_Curve)& theBase,
31                                                     const gp_Dir& theRevolDir,
32                                                     const gp_Pnt& theRevolLoc);
33   //! Initialize evaluator by adaptor of the revolved curve, the axis of revolution and the location
34   Standard_EXPORT GeomEvaluator_SurfaceOfRevolution(const Handle(Adaptor3d_Curve)& theBase,
35                                                     const gp_Dir& theRevolDir,
36                                                     const gp_Pnt& theRevolLoc);
37 
38   //! Change direction of the axis of revolution
SetDirection(const gp_Dir & theDirection)39   void SetDirection(const gp_Dir& theDirection)
40   { myRotAxis.SetDirection(theDirection); }
41 
42   //! Change location of the axis of revolution
SetLocation(const gp_Pnt & theLocation)43   void SetLocation(const gp_Pnt& theLocation)
44   { myRotAxis.SetLocation(theLocation); }
45 
46   //! Change the axis of revolution
SetAxis(const gp_Ax1 & theAxis)47   void SetAxis(const gp_Ax1& theAxis)
48   { myRotAxis = theAxis; }
49 
50   //! Value of surface
51   Standard_EXPORT void D0(const Standard_Real theU, const Standard_Real theV,
52                           gp_Pnt& theValue) const Standard_OVERRIDE;
53   //! Value and first derivatives of surface
54   Standard_EXPORT void D1(const Standard_Real theU, const Standard_Real theV,
55                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V) const Standard_OVERRIDE;
56   //! Value, first and second derivatives of surface
57   Standard_EXPORT void D2(const Standard_Real theU, const Standard_Real theV,
58                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
59                           gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV) const Standard_OVERRIDE;
60   //! Value, first, second and third derivatives of surface
61   Standard_EXPORT void D3(const Standard_Real theU, const Standard_Real theV,
62                           gp_Pnt& theValue, gp_Vec& theD1U, gp_Vec& theD1V,
63                           gp_Vec& theD2U, gp_Vec& theD2V, gp_Vec& theD2UV,
64                           gp_Vec& theD3U, gp_Vec& theD3V,
65                           gp_Vec& theD3UUV, gp_Vec& theD3UVV) const Standard_OVERRIDE;
66   //! Calculates N-th derivatives of surface, where N = theDerU + theDerV.
67   //!
68   //! Raises if N < 1 or theDerU < 0 or theDerV < 0
69   Standard_EXPORT gp_Vec DN(const Standard_Real theU,
70                             const Standard_Real theV,
71                             const Standard_Integer theDerU,
72                             const Standard_Integer theDerV) const Standard_OVERRIDE;
73 
74   Standard_EXPORT Handle(GeomEvaluator_Surface) ShallowCopy() const Standard_OVERRIDE;
75 
76   DEFINE_STANDARD_RTTIEXT(GeomEvaluator_SurfaceOfRevolution,GeomEvaluator_Surface)
77 
78 private:
79   Handle(Geom_Curve)       myBaseCurve;
80   Handle(Adaptor3d_Curve) myBaseAdaptor;
81   gp_Ax1 myRotAxis;
82 };
83 
84 DEFINE_STANDARD_HANDLE(GeomEvaluator_SurfaceOfRevolution, GeomEvaluator_Surface)
85 
86 
87 #endif // _GeomEvaluator_SurfaceOfRevolution_HeaderFile
88