summaryrefslogtreecommitdiffstats
path: root/lib/tqwtplot3d/examples/autoswitch/autoswitch.h
blob: f4a6745bd3cf85103b1f164423d0cd1becb609e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef AUTOSWITCH_H__
#define AUTOSWITCH_H__

#include <qtimer.h>
#include "qwt3d_surfaceplot.h"
#include "qwt3d_function.h"

typedef Qwt3D::SurfacePlot SurfacePlot; // VC6/moc issue
typedef Qwt3D::Function Function; // VC6/moc issue

class Saddle : public Function
{
public:
	Saddle(SurfacePlot& pw)
	:Function(pw)
	{
		setDomain(-2.5,2.5,-2.5,2.5);
		setMaxZ(1.5);
		setMinZ(-1.5);
		setMesh(31,31);
	}

	double operator()(double x, double y)
	{
		return x*y;
	}
};

class Hat : public Function
{
public:

	Hat(SurfacePlot& pw)
	:Function(pw)
	{
		setDomain(-1.5,1.5,-1.5,1.5);
		setMesh(41,41);
	}

	double operator()(double x, double y)
	{
		return 1.0 / (x*x+y*y+0.3);
	}
};

class Plot : public SurfacePlot
{
	Q_OBJECT

public:
    Plot(QWidget* pw, int updateinterval);

public slots:
	void rotate();

};

#endif