glviewvol

view src/curve.h @ 5:5417c25cb238

moving to a simpler transfer function
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 29 Dec 2014 15:59:55 +0200
parents
children 773f89037a35
line source
1 #ifndef CURVE_H_
2 #define CURVE_H_
4 #include <vector>
5 #include <inttypes.h>
7 struct CurvePoint {
8 uint16_t t_int; // save time as an integer to allow exact lookup and change
9 float value;
10 };
12 class Curve {
13 private:
14 std::vector<CurvePoint> cp;
16 public:
17 void set_point(float t, float val);
18 void set_point_int(uint16_t ti, float val);
20 bool delete_point(uint16_t ti);
22 CurvePoint *get_point(int idx);
23 const CurvePoint *get_point(int idx) const;
24 int get_num_points() const;
26 CurvePoint *get_point_at(uint16_t ti);
27 const CurvePoint *get_point_at(uint16_t ti) const;
29 float value(float t) const;
30 float value_int(uint16_t ti) const;
31 };
33 #endif // CURVE_H_