proj home

Files   Classes   Functions   Hierarchy  

pointsgraph.h

Go to the documentation of this file.
00001 #ifndef POINTSGRAPH_H
00002 #define POINTSGRAPH_H
00003 
00004 #include <deque>
00005 #include <vector>
00006 using namespace std;
00007 
00008 #include <graphmisc.h>
00009 #include <gobj.h>
00010 #include <point.h>
00011 #include <windowscaleD2.h>
00012 
00013 
00018 class pointsgraph : public gobj
00019 {
00020 public:
00021 
00023   pointsgraph();
00024 
00026   pointsgraph
00027   (
00028     windowscaleD2 const & screen_,
00029     windowscaleD2 const & world_,
00030     boolc clipwindow_=false
00031   );
00032 
00034   deque< point2<double> > pts;
00035 
00038   windowscaleD2 screen;
00039 
00042   windowscaleD2 world;
00043 
00045   bool clipwindow;
00047   static bool isinside;
00048 
00050   void draw();
00051 
00054   template< typename FN >
00055   void samplefunction(FN & fn, uintc N)
00056   {
00057     double dx = (double)1.0;
00058     dx /= ((double)N-(double)1.0);
00059 
00060     double x;
00061     double y;
00062     for (uint i=0; i<N; ++i)
00063     {
00064       x = dx*i;
00065       screen.unitscaleInverse_x(x);
00066       fn(y,x);
00067     
00068       pts.push_back( point2<double>(x,y) ); 
00069     }
00070   }
00071 
00073   void domain(doublec x0, doublec x1);
00074 
00076   void screen_rescaley();
00077 
00079   void update();
00080 
00081 };
00082 
00088 class pointsgraphtime : public pointsgraph
00089 {
00091   uint N;
00093   double dx;
00094 public:
00095 
00097   pointsgraphtime(uintc N_);
00098 
00100   void push_front(double yval);
00102   void push_back(double yval);
00103 
00104 };
00105 
00106 
00107 
00108 // TODO - implement axes.
00109 /*
00110 class pointsgraph_tick
00111 {
00112 public:
00113 
00114   // Default enabled, major spacing 1.0, length .05
00115   //  minor spacing .2, length .02 
00116 
00117   double hairlength;
00118   double period;
00119   bool enabled;
00120   double offset;
00121 
00122   pointsgraph_tick
00123   (
00124     doublec hairlength_,
00125     doublec period_,
00126     boolc enabled_,
00127     doublec offset_
00128   );
00129 
00130 }; 
00131 
00132 class pointsgraph_axes : public gobj
00133 {
00134 public:
00135 
00136   pointsgraph & pg;
00137 
00138   pointsgraph_axes(pointsgraph & pg_);
00139 
00140   pointsgraph_tick xaxis1;
00141   pointsgraph_tick xaxis2;
00142   pointsgraph_tick yaxis1;
00143   pointsgraph_tick yaxis2;
00144 
00145   void draw();
00146 
00147 };
00148 */
00149 
00150 
00154 class pointsgraph_axes_circle : public gobj
00155 {
00156 public:
00157 
00159   gobjContainer* graphics;
00160 
00162   point3<double> origin;
00163 
00165   void push(gobj* g);
00166 
00167   pointsgraph_axes_circle();
00169   ~pointsgraph_axes_circle();
00170 
00171   gobjQuadric quadric;
00173   gobjglColor3d xaxiscolor;
00175   gobjglColor3d yaxiscolor;
00177   vector<double> xaxis;
00179   vector<double> yaxis;
00180   
00182   bool disablelighting;
00183 
00185   void update();
00187   void draw();
00188 
00189 };
00190 
00191 
00192 #endif
00193 

Generated on Fri Mar 4 00:49:27 2011 for Chelton Evans Source by  doxygen 1.5.8