nuclear@12: /* nuclear@12: glviewvol is an OpenGL 3D volume data viewer nuclear@12: Copyright (C) 2014 John Tsiombikas nuclear@12: nuclear@12: This program is free software: you can redistribute it and/or modify nuclear@12: it under the terms of the GNU General Public License as published by nuclear@12: the Free Software Foundation, either version 3 of the License, or nuclear@12: (at your option) any later version. nuclear@12: nuclear@12: This program is distributed in the hope that it will be useful, nuclear@12: but WITHOUT ANY WARRANTY; without even the implied warranty of nuclear@12: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nuclear@12: GNU General Public License for more details. nuclear@12: nuclear@12: You should have received a copy of the GNU General Public License nuclear@12: along with this program. If not, see . nuclear@12: */ nuclear@4: #ifndef CURVE_H_ nuclear@4: #define CURVE_H_ nuclear@4: nuclear@4: #include nuclear@4: #include nuclear@4: nuclear@4: struct CurvePoint { nuclear@4: uint16_t t_int; // save time as an integer to allow exact lookup and change nuclear@4: float value; nuclear@4: }; nuclear@4: nuclear@4: class Curve { nuclear@4: private: nuclear@4: std::vector cp; nuclear@4: nuclear@4: public: nuclear@4: void set_point(float t, float val); nuclear@4: void set_point_int(uint16_t ti, float val); nuclear@4: nuclear@4: bool delete_point(uint16_t ti); nuclear@4: nuclear@4: CurvePoint *get_point(int idx); nuclear@4: const CurvePoint *get_point(int idx) const; nuclear@4: int get_num_points() const; nuclear@4: nuclear@4: CurvePoint *get_point_at(uint16_t ti); nuclear@4: const CurvePoint *get_point_at(uint16_t ti) const; nuclear@4: nuclear@4: float value(float t) const; nuclear@4: float value_int(uint16_t ti) const; nuclear@4: }; nuclear@4: nuclear@4: #endif // CURVE_H_