Go to the documentation of this file.00001
00010 #ifndef TOMGUI_TGPLOT2D
00011 #define TOMGUI_TGPLOT2D
00012
00013 #include <blort/TomGine/tgMathlib.h>
00014 #include <blort/TomGine/tgTimer.h>
00015 #include <blort/TomGine/tgFont.h>
00016
00017 #include <vector>
00018
00019 namespace TomGine{
00020
00021 class tgPlot2D
00022 {
00023 protected:
00024 int x,y;
00025 unsigned w,h;
00026
00027 std::vector<float> m_buffer_x;
00028 std::vector<float> m_buffer_y_1;
00029 std::vector<float> m_buffer_y_2;
00030 std::vector<float> m_buffer_y_3;
00031 std::vector<float> m_buffer_y_4;
00032 unsigned m_buffer_size;
00033
00034 float x_max, x_min, y_min, y_max;
00035 float x_scale, y_scale;
00036
00037 TomGine::tgFont font;
00038 TomGine::tgTimer m_timer;
00039
00040 float findmax(const std::vector<float> &x) const;
00041 float findmin(const std::vector<float> &x) const;
00042
00043 void updateBuffer(float y1, float y2=0.0f, float y3=0.0f, float y4=0.0f);
00044
00045
00046 public:
00047
00048 tgPlot2D(int x, int y, unsigned w, unsigned h);
00049 ~tgPlot2D();
00050
00051 void axis(float x_min, float x_max, float y_min, float y_max);
00052
00053 void setBufferSize(unsigned size){ m_buffer_size = size; }
00054
00055
00056 virtual void draw();
00057
00058 void plot(const std::vector<float> &x, const std::vector<float> &y) const;
00059
00060 void push(float y1);
00061 void push(float y1, float y2);
00062 void push(float y1, float y2, float y3);
00063 void push(float y1, float y2, float y3, float y4);
00064
00065 };
00066
00067 }
00068
00069 #endif
blort
Author(s): Michael Zillich,
Thomas Mörwald,
Johann Prankl,
Andreas Richtsfeld,
Bence Magyar (ROS version)
autogenerated on Thu Jan 2 2014 11:38:26