glviewvol

diff src/curve.h @ 4:04330eb80b36

lots of stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 29 Dec 2014 05:41:36 +0200
parents
children 773f89037a35
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/curve.h	Mon Dec 29 05:41:36 2014 +0200
     1.3 @@ -0,0 +1,33 @@
     1.4 +#ifndef CURVE_H_
     1.5 +#define CURVE_H_
     1.6 +
     1.7 +#include <vector>
     1.8 +#include <inttypes.h>
     1.9 +
    1.10 +struct CurvePoint {
    1.11 +	uint16_t t_int;	// save time as an integer to allow exact lookup and change
    1.12 +	float value;
    1.13 +};
    1.14 +
    1.15 +class Curve {
    1.16 +private:
    1.17 +	std::vector<CurvePoint> cp;
    1.18 +
    1.19 +public:
    1.20 +	void set_point(float t, float val);
    1.21 +	void set_point_int(uint16_t ti, float val);
    1.22 +
    1.23 +	bool delete_point(uint16_t ti);
    1.24 +
    1.25 +	CurvePoint *get_point(int idx);
    1.26 +	const CurvePoint *get_point(int idx) const;
    1.27 +	int get_num_points() const;
    1.28 +
    1.29 +	CurvePoint *get_point_at(uint16_t ti);
    1.30 +	const CurvePoint *get_point_at(uint16_t ti) const;
    1.31 +
    1.32 +	float value(float t) const;
    1.33 +	float value_int(uint16_t ti) const;
    1.34 +};
    1.35 +
    1.36 +#endif	// CURVE_H_