0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / AppCont / AppCont_Function.hxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 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 AppCont_Function_HeaderFile
16 #define AppCont_Function_HeaderFile
17
18 #include <gp_Pnt.hxx>
19 #include <gp_Pnt2d.hxx>
20 #include <gp_Vec.hxx>
21 #include <gp_Vec2d.hxx>
22 #include <NCollection_Array1.hxx>
23 #include <Standard_Integer.hxx>
24
25 //! Class describing a continous 3d and/or function f(u).
26 //! This class must be provided by the user to use the approximation algorithm FittingCurve.
27 class AppCont_Function
28 {
29 public:
30
31   AppCont_Function()
32   {
33     myNbPnt = -1;
34     myNbPnt2d = -1;
35   }
36
37   //! Get number of 3d and 2d points returned by "Value" and "D1" functions.
38   void GetNumberOfPoints(Standard_Integer& theNbPnt, Standard_Integer& theNbPnt2d) const
39   {
40     theNbPnt = myNbPnt;
41     theNbPnt2d = myNbPnt2d;
42   }
43
44   //! Get number of 3d points returned by "Value" and "D1" functions.
45   Standard_Integer GetNbOf3dPoints() const
46   {
47     return myNbPnt;
48   }
49
50   //! Get number of 2d points returned by "Value" and "D1" functions.
51   Standard_Integer GetNbOf2dPoints() const
52   {
53     return myNbPnt2d;
54   }
55
56   //! Destructor
57   virtual ~AppCont_Function() {}
58
59   //! Returns the first parameter of the function.
60   virtual Standard_Real FirstParameter() const = 0;
61
62   //! Returns the last parameter of the function.
63   virtual Standard_Real LastParameter() const = 0;
64
65   //! Returns the point at parameter <theU>.
66   virtual Standard_Boolean Value (const Standard_Real   theU,
67                                   NCollection_Array1<gp_Pnt2d>& thePnt2d,
68                                   NCollection_Array1<gp_Pnt>&   thePnt) const = 0;
69
70   //! Returns the derivative at parameter <theU>.
71   virtual Standard_Boolean D1 (const Standard_Real   theU,
72                                NCollection_Array1<gp_Vec2d>& theVec2d,
73                                NCollection_Array1<gp_Vec>&   theVec) const = 0;
74
75   //! Return information about peridicity in output paramateters space. 
76   //! @param theDimIdx Defines index in output parameters space. 1 <= theDimIdx <= 3 * myNbPnt + 2 * myNbPnt2d.
77   virtual void PeriodInformation (const Standard_Integer /*theDimIdx*/,
78                                   Standard_Boolean&      IsPeriodic,
79                                   Standard_Real&         thePeriod) const
80   {
81     IsPeriodic = Standard_False;
82     thePeriod = 0.0;
83   };
84
85
86 protected:
87   Standard_Integer myNbPnt;
88   Standard_Integer myNbPnt2d;
89 };
90
91 #endif