aboutsummaryrefslogtreecommitdiff
path: root/samples/OpenGL/qt_terr/terrain.h
blob: 3382a4c5db17295b152b00bc44d58427d5882b0b (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
#ifndef TERRAIN_H
#define TERRAIN_H

#include "quad.h"

#include <vector>
#include <math.h>

class Terrain : public Quad
{
public:
	double z_mean_;
	double z_mean() {
		if( isnan(z_mean_) ) {
			return z_mean_ = 
				( z[0][0] + z[0][1] +
				  z[1][0] + z[1][1] ) / 4.;
		}
		return z_mean_;
	};
	double z[2][2];

public:
	Terrain(std::vector<double>* V_) : Quad(V_) { z_mean_ = NAN; }

	virtual void split();
	virtual void track_down(double x, double y, double nz, int levels);

/*protected:
	virtual void set_range(double nx1, double nx2, double ny1, double ny2);*/
};

#endif/*TERRAIN_H*/