HOG2
Plot2D.cpp
Go to the documentation of this file.
1 /*
2  * Plot2D.cpp
3  * hog2
4  *
5  * Created by Nathan Sturtevant on 4/18/07.
6  * Copyright 2007 Nathan Sturtevant, University of Alberta. All rights reserved.
7  *
8  */
9 
10 #include "Plot2D.h"
11 #include <math.h>
12 #include <cstring>
13 #include <assert.h>
14 #include <stdio.h>
15 
16 namespace Plotting {
17 
18 Line::Line(const char *label, tPlotType ptype)
19 :plotType(ptype)
20 {
21  width = 1.0;
22  ClearColor();
23  strncpy(name,label,1024);
24  xMin = DBL_MAX;
25  xMax = -DBL_MAX;
26  yMin = DBL_MAX;
27  yMax = -DBL_MAX;
28  hidden = false;
29  changedLine = false;
30 }
31 
33 {
34  x.resize(0);
35  y.resize(0);
36  xMin = DBL_MAX;
37  xMax = -DBL_MAX;
38  yMin = DBL_MAX;
39  yMax = -DBL_MAX;
40 }
41 
42 void Line::AddPoint(double _y)
43 {
44  changedLine = true;
45  if (x.size() == 0)
46  AddPoint(0, _y);
47  else
48  AddPoint(x.back()+1, _y);
49 }
50 
51 void Line::AddPoint(double _x, double _y)
52 {
53  changedLine = true;
54  if (_x < xMin)
55  xMin = _x;
56  if (_x > xMax)
57  xMax = _x;
58  if (_y < yMin)
59  yMin = _y;
60  if (_y > yMax)
61  yMax = _y;
62  x.push_back(_x);
63  y.push_back(_y);
64 
65  //printf("New %s bounds (%1.2f, %1.2f, %1.2f, %1.2f)\n", name, xMin, yMax, xMax, yMin);
66 
67 }
68 
69 double Line::DistanceToLine(double xp, double yp)
70 {
71  double bestDist = (y[0]-yp)*(y[0]-yp)+(x[0]-xp)*(x[0]-xp);
72  // Linear search? - can be sped up with binary search if needed
73  for (unsigned int m = 1; m < x.size()-1; m++)
74  {
75  if (fless((y[m]-yp)*(y[m]-yp)+(x[m]-xp)*(x[m]-xp), bestDist))
76  {
77  bestDist = (y[m]-yp)*(y[m]-yp)+(x[m]-xp)*(x[m]-xp);
78  }
79  }
80  return sqrt(bestDist);
81 }
82 
83 double Line::VerticalDistanceToLine(double xp, double yp)
84 {
85  double horizDist = fabs(y[0]-yp);
86  int horizIndex = 0;
87  // Linear search? - can be sped up with binary search if needed
88  for (unsigned int m = 1; m < x.size()-1; m++)
89  {
90  if (fabs(y[m]-yp) < horizDist)
91  {
92  horizDist = fabs(y[m]-yp);
93  horizIndex = m;
94  }
95  }
96  return fabs(x[horizIndex]-xp);
97 }
98 
99 void Line::Smooth(unsigned int windowSize)
100 {
101  double sum=0;
102  // setup initial window
103  for (unsigned int m = 0; (m < x.size()) && (m < windowSize); m++)
104  {
105  sum += y[m];
106  y[m/2] = sum/(double)(m+1);
107  }
108  for (unsigned int m = windowSize/2; m < x.size()-windowSize/2-1; m++)
109  {
110  y[m] = sum/(double)windowSize;
111  sum-=y[m-windowSize/2];
112  sum+=y[m+windowSize/2];
113  }
114  for (unsigned int m = x.size()-windowSize/2-1; m < x.size(); m++)
115  {
116  y[m] = sum/(double)(windowSize/2+x.size()-1-m);
117  sum-=y[m-windowSize/2];
118  }
119 }
120 
122 {
123  r = -1;
124 }
125 
126 void Line::SetColor(const rgbColor &c)
127 {
128  r = c.r;
129  g = c.g;
130  b = c.b;
131 }
132 
133 void Line::SetColor(double _r, double _g, double _b)
134 {
135  r = _r; g = _g; b = _b;
136 }
137 
138 void Line::OpenGLDraw() const
139 {
140  if (hidden)
141  return;
142  switch (plotType)
143  {
144  case kLinePlot:
145  {
146  glBegin(GL_LINE_STRIP);
147  if (r != -1)
148  {
149  glColor3f(r, g, b);
150  }
151  for (unsigned int t = 0; t < x.size(); t++)
152  glVertex2d(x[t], y[t]);
153  glEnd();
154  }
155  break;
156  case kImpulsePlot:
157  {
158  glBegin(GL_LINES);
159  if (r != -1)
160  {
161  glColor3f(r, g, b);
162  }
163  for (unsigned int t = 0; t < x.size(); t++)
164  {
165  glVertex2d(x[t], 0);
166  glVertex2d(x[t], y[t]);
167  }
168  glEnd();
169  }
170  break;
171  }
172 }
173 
174 void Line::Draw(Graphics::Display &display, double xOff, double yOff, double xScale, double yScale) const
175 {
176  if (x.size() == 0 || hidden)
177  return;
178 
179  // Only does line plots right now
180  std::vector<Graphics::point> points;
181  for (unsigned int t = 0; t < x.size(); t++)
182  {
183  points.push_back({
184  (float)((x[t]+xOff)*xScale),
185  -(float)((y[t]+yOff)*yScale)
186  });
187  }
188  // printf("(%f, %f) -> (%f, %f)",
189  // (float)((x[0]+xOff)*xScale), (float)-((y[0]+yOff)*yScale),
190  // (float)((x[x.size()-1]+xOff)*xScale), (float)-((y[x.size()-1]+yOff)*yScale)
191  // );
192  float baseLineSize = 1.0/150.0;
193  display.DrawLineSegments(points, width*baseLineSize, rgbColor(r, g, b));
194 // display.DrawLineSegments(points, width*xScale, rgbColor(r, g, b));
195 }
196 
197 void Point::Draw(Graphics::Display &display, double xOff, double yOff, double xScale, double yScale) const
198 {
199  double xLoc = (x+xOff)*xScale;
200  double yLoc = -(y+yOff)*yScale;
201  display.FillCircle({(float)xLoc, (float)yLoc}, std::min(xScale, yScale)*r, c);
202 }
203 
205 {
206  ResetAxis();
207  drawMouse = true;
208  lastSelectedLine = -1;
209  recomputeBorders = true;
210 }
211 
213 {
214  lines.clear();
215  points.clear();
216  ResetAxis();
217 }
218 
219 void Plot2D::SetXAxisLabel(const char *l)
220 {
221  xLabel = l;
222 }
223 
224 void Plot2D::SetYAxisLabel(const char *l)
225 {
226  yLabel = l;
227 
228 }
229 
230 
232 {
233  lines.push_back(l);
234 
235  if (l->GetMaxX() > xMax)
236  xMax = l->GetMaxX();
237  if (l->GetMaxY() > yMax)
238  yMax = l->GetMaxY();
239  if (l->GetMinX() < xMin)
240  xMin = l->GetMinX();
241  if (l->GetMinY() < yMin)
242  yMin = l->GetMinY();
243 
244  if (!forceAxis)
245  ResetAxis();
246 
247  dLeft = xMin;
248  dRight = xMax;
249  dTop = yMax;
250  dBottom = yMin;
251 
252 }
253 
254 void Plot2D::AddPoint(const Point &p)
255 {
256  points.push_back(p);
257 
258  if (p.x > xMax)
259  xMax = p.x;
260  if (p.y > yMax)
261  yMax = p.y;
262  if (p.x < xMin)
263  xMin = p.x;
264  if (p.y < yMin)
265  yMin = p.y;
266 
267  xMax = std::max(xMax, yMax);
268  yMax = xMax;
269  xMin = std::min(xMin, yMin);
270  yMin = xMin;
271 
272  dLeft = xMin;
273  dRight = xMax;
274  dTop = yMax;
275  dBottom = yMin;
276 
277  int val = 1;
278  while (true)
279  {
280  val *= 2;
281  if (val > xMax)
282  {
283  dRight = val;
284  dTop = val;
285  break;
286  }
287  }
288 
289 }
290 
291 
292 void Plot2D::Zoom(double amt)
293 {
294  printf("Got amt %1.2f\n", amt);
295  double cx, cy;
296  amt = 1-0.01*amt;
297  cx = xMin+(xMax-xMin)/2;
298  cy = yMin+(yMax-yMin)/2;
299  double width = (xMax-xMin)*amt;
300  double height = (yMax-yMin)*amt;
301 
302  xMin = cx - width/2;
303  xMax = cx + width/2;
304  yMin = cy - height/2;
305  yMax = cy + height/2;
306 
307  dLeft = xMin;
308  dRight = xMax;
309  dTop = yMax;
310  dBottom = yMin;
311 }
312 
313 void Plot2D::SetAxis(double minx, double miny, double maxx, double maxy)
314 {
315  forceAxis = true;
316  xMax = maxx;
317  xMin = minx;
318  yMax = maxy;
319  yMin = miny;
320 }
321 
323 {
324  forceAxis = false;
325  recomputeBorders = false;
326  xMin = DBL_MAX;
327  xMax = -DBL_MAX;
328  yMin = DBL_MAX;
329  yMax = -DBL_MAX;
330 
331  // recompute max/min stuff
332  for (unsigned int x = 0; x < lines.size(); x++)
333  {
334  Line *l = lines[x];
335 
336  if (l->GetMaxX() > xMax)
337  xMax = l->GetMaxX();
338  if (l->GetMaxY() > yMax)
339  yMax = l->GetMaxY();
340  if (l->GetMinX() < xMin)
341  xMin = l->GetMinX();
342  if (l->GetMinY() < yMin)
343  yMin = l->GetMinY();
344  }
345 
346  for (const auto &p : points)
347  {
348  if (p.x > xMax)
349  xMax = p.x;
350  if (p.y > yMax)
351  yMax = p.y;
352  if (p.x < xMin)
353  xMin = p.x;
354  if (p.y < yMin)
355  yMin = p.y;
356  }
357 
358  if (xMin > xMax) // valid points
359  {
360  xMin = 0;
361  xMax = 10;
362  yMin = 0;
363  yMax = 10;
364  }
365 
366  dLeft = xMin;
367  dRight = xMax;
368  dTop = yMax;
369  dBottom = yMin;
370 }
371 
372 void Plot2D::OffsetCurrMouse(double deltaX, double deltaY)
373 {
374  mouseXLoc += deltaX;
375  mouseYLoc += deltaY;
376 
377  if (lines.size() == 0)
378  return;
379 
380  double minDist = lines[0]->DistanceToLine(mouseXLoc, mouseYLoc);
381  int minIndex = 0;
382  for (unsigned int x = 1; x < lines.size(); x++)
383  {
384  if (lines[x]->IsHidden())
385  continue;
386 
387  if (fless(lines[x]->DistanceToLine(mouseXLoc, mouseYLoc), minDist))
388  {
389  minIndex = x;
390  minDist = lines[x]->DistanceToLine(mouseXLoc, mouseYLoc);
391  }
392  // if (lines[x]->pointOnLine(mouseXLoc, mouseYLoc))
393  // printf("Near: %s\n", lines[x]->getLabel());
394  }
395  if (minIndex != lastSelectedLine)
396  {
397  // set colors here instead
398  // if (lastSelectedLine != -1)
399  // lines[lastSelectedLine]->unselect();
400  // lines[minIndex]->select();
401  lastSelectedLine = minIndex;
402  // printf("Near: %s\n", lines[minIndex]->getLabel());
403  // submitMessage(lines[minIndex]->getLabel());
404  }
405 }
406 
407 // void Plot2D::SetCurrMouse(double lastX, double lastY, Rect &winRect)
408 // {
409 // double tpW = (dRight-dLeft)*.05;
410 // double tpH = (dTop-dBottom)*.05;
411 // mouseXLoc = dLeft-tpW+(dRight+2*tpW - dLeft)*(lastX/winRect.right);
412 // mouseYLoc = dBottom-tpH+(dTop+2*tpH - dBottom)*(1-(lastY/winRect.bottom));
413 //
414 // if (lines.size() == 0)
415 // return;
416 //
417 // double minDist = lines[0]->DistanceToLine(mouseXLoc, mouseYLoc);
418 // int minIndex = 0;
419 // for (unsigned int x = 1; x < lines.size(); x++)
420 // {
421 // if (fless(lines[x]->DistanceToLine(mouseXLoc, mouseYLoc), minDist))
422 // {
423 // minIndex = x;
424 // minDist = lines[x]->DistanceToLine(mouseXLoc, mouseYLoc);
425 // }
426 // // if (lines[x]->pointOnLine(mouseXLoc, mouseYLoc))
427 // // printf("Near: %s\n", lines[x]->getLabel());
428 // }
429 // if (minIndex != lastSelectedLine)
430 // {
434 // lastSelectedLine = minIndex;
435 // //printf("Near: %s\n", lines[minIndex]->getLabel());
436 // //submitMessage(lines[minIndex]->getLabel());
437 // }
438 // }
439 //
440 // void Plot2D::Recenter(double lastX, double lastY, Rect &winRect)
441 // {
442 // double tpW = (dRight-dLeft)*.05;
443 // double tpH = (dTop-dBottom)*.05;
444 // double XLoc = dLeft-tpW+(dRight+2*tpW - dLeft)*(lastX/winRect.right);
445 // double YLoc = dBottom-tpH+(dTop+2*tpH - dBottom)*(1-(lastY/winRect.bottom));
446 //
447 // xMin = XLoc - (dRight-dLeft)/2;
448 // xMax = XLoc + (dRight-dLeft)/2;
449 // yMin = YLoc - (dTop-dBottom)/2;
450 // yMax = YLoc + (dTop-dBottom)/2;
451 //
452 // dLeft = xMin;
453 // dRight = xMax;
454 // dTop = yMax;
455 // dBottom = yMin;
456 //
457 // }
458 
459 
461 {
462  for (unsigned int x = 0; x < lines.size(); x++)
463  lines[x]->Smooth(50);
464  ResetAxis();
465 }
466 
468 {
469  xMax = std::max(xMax, yMax);
470  yMax = xMax;
471  xMin = std::min(xMin, yMin);
472  yMin = xMin;
473 
474  dLeft = xMin;
475  dRight = xMax;
476  dTop = yMax;
477  dBottom = yMin;
478 }
479 
480 void Plot2D::OpenGLDraw() const
481 {
482  GLint matrixMode;
483 
484  if (recomputeBorders)
485  assert(false);
486  // ResetAxis();
487 
488  glGetIntegerv(GL_MATRIX_MODE, &matrixMode);
489 
490  glEnable(GL_BLEND); // for text fading
491  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // ditto
492 
493  // set orthograhic 1:1 pixel transform in local view coords
494  glDisable(GL_DEPTH_TEST);
495 
496  glMatrixMode(GL_PROJECTION);
497  glPushMatrix();
498  glLoadIdentity();
499  glMatrixMode(GL_MODELVIEW);
500  glPushMatrix();
501  glLoadIdentity();
502  glColor3f(0, 1, 0);
503 
504  // left, right, bottom, top, near, far
505  double tpW = (dRight-dLeft)*.05;
506  double tpH = (dTop-dBottom)*.05;
507  glOrtho(dLeft-tpW, dRight+tpW, dBottom-tpH, dTop+tpH, -1, 1);
508  //printf("Drawing axis (%1.2f, %1.2f, %1.2f, %1.2f)\n", dLeft, dTop, dRight, dBottom);
509 
510  glColor3f(1, 1, 1); // draw axis
511  glBegin(GL_LINES);
512  glVertex2d(dLeft-tpW, 0); glVertex2d(dRight+tpW, 0);
513  glVertex2d(0, dBottom-tpH); glVertex2d(0, dTop+tpH);
514  glEnd();
515 
516  for (unsigned int x = 0; x < lines.size(); x++)
517  {
518  if (lines[x]->GetChanged())
519  assert(false);
520  //recomputeBorders = true;
521  lines[x]->OpenGLDraw();
522  }
523 
524  glLineWidth(3.0);
525  if (lastSelectedLine != -1)
526  lines[lastSelectedLine]->OpenGLDraw();
527  glLineWidth(1.0);
528 
529  // draw mouse - temporary hack
530  if (drawMouse)
531  {
532  glColor4f(0, 1, 0, .5); // draw axis
533  glBegin(GL_LINES);
534  glVertex2d(mouseXLoc, dBottom-tpH); glVertex2d(mouseXLoc, dTop+tpH);
535  glVertex2d(dLeft-tpW, mouseYLoc); glVertex2d(dRight+tpW, mouseYLoc);
536  glEnd();
537  }
538 
539  glPopMatrix(); // GL_MODELVIEW
540  glMatrixMode(GL_PROJECTION);
541  glPopMatrix();
542  glMatrixMode(matrixMode);
543 
544  glEnable(GL_DEPTH_TEST);
545 }
546 
547 point3d Plot2D::MakeHOG(double x, double y) const
548 {
549  return point3d((x+xOffset)*xScale, -(y+yOffset)*yScale, 0);
550 }
551 
552 double Plot2D::MakeHOGWidth(double w) const
553 {
554  // If we scale the lines as above, they can get really large. The lines
555  // need to always stay the same (relative) size.
556  float baseLineSize = 1.0f/150.0f;
557  return w*baseLineSize;
558 // return w*xScale;
559 }
560 
561 void Plot2D::Draw(Graphics::Display &display) const
562 {
563  xOffset = (dRight-dLeft)/2.0-dRight;
564  yOffset = (dTop-dBottom)/2.0-dTop;
565  xScale = 0.9*2.0/(dRight-dLeft);
566  yScale = 0.9*2.0/(dTop-dBottom);
567 
568  float lineAxisWeight = 2;//*baseLineSize;
569  float lineTicWeight = 1;//*baseLineSize;
570 
571  display.FillRect({-1, -1, 1, 1}, Colors::white);
572  display.DrawLine(MakeHOG(dLeft, 0), MakeHOG(dRight, 0), MakeHOGWidth(lineAxisWeight), Colors::black); // x-axis
573  display.DrawLine(MakeHOG(0, dTop), MakeHOG(0, dBottom), MakeHOGWidth(lineAxisWeight), Colors::black); // y-axis
574 
575  double fontSize = MakeHOGWidth(10);//4;//*MakeHOGWidth((dTop-dBottom)/100);
577 
579 
580  for (double x = 0; x < dRight; x+=dRight/10)
581  {
582  display.DrawLine(MakeHOG(x, 0)+point3d(0, fontSize/3), MakeHOG(x, 0)-point3d(0, fontSize/3), MakeHOGWidth(lineTicWeight), Colors::black); // x-axis
583 // display.DrawLine(MakeHOG(x, (dTop-dBottom)/100), MakeHOG(x, -(dTop-dBottom)/100), MakeHOGWidth(lineTicWeight), Colors::black); // x-axis
584  }
585  for (double y = 0; y < dTop; y+=dTop/10)
586  {
587  display.DrawLine(MakeHOG(0, y)+point3d(fontSize/3,0), MakeHOG(0, y)-point3d(fontSize/3,0), MakeHOGWidth(lineTicWeight), Colors::black); // y-axis
588 // display.DrawLine(MakeHOG((dRight-dLeft)/100, y), MakeHOG(-(dRight-dLeft)/100, y), MakeHOGWidth(lineTicWeight), Colors::black); // x-axis
589  }
590 
591  for (unsigned int x = 0; x < lines.size(); x++)
592  {
593  lines[x]->Draw(display, xOffset, yOffset, xScale, yScale);
594  }
595 
596  for (const auto i : points)
597  i.Draw(display, xOffset, yOffset, xScale, yScale);
598 }
599 
600 }
Graphics::Display::DrawLine
void DrawLine(point start, point end, float lineWidth, rgbColor c)
Definition: Graphics.cpp:184
Plotting::Line::xMin
double xMin
Definition: Plot2D.h:55
rgbColor::b
float b
Definition: Colors.h:71
rgbColor
A color; r/g/b are between 0...1.
Definition: Colors.h:17
min
double min(double a, double b)
Definition: FPUtil.h:35
Plotting::Plot2D::yScale
double yScale
Definition: Plot2D.h:106
Plotting::Plot2D::Clear
void Clear()
Definition: Plot2D.cpp:212
Plotting::Line::Clear
void Clear()
Definition: Plot2D.cpp:32
Plotting::Plot2D::lines
std::vector< Line * > lines
Definition: Plot2D.h:101
Plotting::Line::GetMinY
double GetMinY()
Definition: Plot2D.h:48
Plotting::Line::DistanceToLine
double DistanceToLine(double xp, double yp)
Definition: Plot2D.cpp:69
Plotting::Line::y
std::vector< double > y
Definition: Plot2D.h:58
Plotting
Definition: Plot2D.cpp:16
Plotting::Line::b
double b
Definition: Plot2D.h:56
Plotting::Line::r
double r
Definition: Plot2D.h:56
Plotting::Plot2D::dBottom
double dBottom
Definition: Plot2D.h:96
Plotting::Line::OpenGLDraw
void OpenGLDraw() const
Definition: Plot2D.cpp:138
Plotting::Line::Smooth
void Smooth(unsigned int windowSize)
Definition: Plot2D.cpp:99
Plotting::Plot2D::points
std::vector< Point > points
Definition: Plot2D.h:100
Plotting::Line::plotType
tPlotType plotType
Definition: Plot2D.h:54
Plotting::Plot2D::mouseYLoc
double mouseYLoc
Definition: Plot2D.h:95
Plotting::Plot2D::yOffset
double yOffset
Definition: Plot2D.h:104
Plotting::Line::GetMaxY
double GetMaxY()
Definition: Plot2D.h:46
Plotting::Plot2D::xScale
double xScale
Definition: Plot2D.h:105
Plotting::Line::Draw
void Draw(Graphics::Display &display, double xOff, double yOff, double xScale, double yScale) const
Definition: Plot2D.cpp:174
width
int width
Definition: SFML_HOG.cpp:54
Plotting::Plot2D::dLeft
double dLeft
Definition: Plot2D.h:96
Plotting::Plot2D::drawMouse
bool drawMouse
Definition: Plot2D.h:98
Plotting::Plot2D::recomputeBorders
bool recomputeBorders
Definition: Plot2D.h:98
rgbColor::g
float g
Definition: Colors.h:71
Plotting::Line::GetMinX
double GetMinX()
Definition: Plot2D.h:47
Plotting::Line::name
char name[1024]
Definition: Plot2D.h:60
Plotting::Plot2D::Draw
void Draw(Graphics::Display &display) const
Definition: Plot2D.cpp:561
Plotting::Point::y
double y
Definition: Plot2D.h:65
Plotting::Plot2D::xLabel
std::string xLabel
Definition: Plot2D.h:102
Graphics::textBaselineMiddle
@ textBaselineMiddle
Definition: Graphics.h:27
Plotting::Plot2D::lastSelectedLine
int lastSelectedLine
Definition: Plot2D.h:99
Plotting::Line::changedLine
bool changedLine
Definition: Plot2D.h:53
Plotting::Line::xMax
double xMax
Definition: Plot2D.h:55
Plotting::Plot2D::NormalizeAxes
void NormalizeAxes()
Definition: Plot2D.cpp:467
Plotting::kLinePlot
@ kLinePlot
Definition: Plot2D.h:21
Plotting::Plot2D::MakeHOG
point3d MakeHOG(double x, double y) const
Definition: Plot2D.cpp:547
Plotting::Plot2D::xMin
double xMin
Definition: Plot2D.h:97
Colors::black
const rgbColor black
Definition: Colors.h:119
Plotting::Plot2D::mouseXLoc
double mouseXLoc
Definition: Plot2D.h:95
Plotting::Point::c
rgbColor c
Definition: Plot2D.h:66
point3d
#define point3d
Definition: GLUtil.h:123
Plotting::Plot2D::OpenGLDraw
void OpenGLDraw() const
Definition: Plot2D.cpp:480
Graphics::Display
Definition: Graphics.h:146
Plotting::Plot2D::OffsetCurrMouse
void OffsetCurrMouse(double deltaX, double deltaY)
Definition: Plot2D.cpp:372
Plotting::Line::Line
Line(const char *label, tPlotType=kLinePlot)
Definition: Plot2D.cpp:18
Plotting::Plot2D::Plot2D
Plot2D()
Definition: Plot2D.cpp:204
fless
bool fless(double a, double b)
Definition: FPUtil.h:28
Plotting::Line::SetColor
void SetColor(double, double, double)
Definition: Plot2D.cpp:133
Plotting::Point::Draw
void Draw(Graphics::Display &display, double xOff, double yOff, double xScale, double yScale) const
Definition: Plot2D.cpp:197
Plotting::Plot2D::yMin
double yMin
Definition: Plot2D.h:97
Plotting::Plot2D::SetAxis
void SetAxis(double, double, double, double)
Definition: Plot2D.cpp:313
Plotting::tPlotType
tPlotType
Definition: Plot2D.h:20
Plotting::Plot2D::MakeHOGWidth
double MakeHOGWidth(double w) const
Definition: Plot2D.cpp:552
Plotting::Plot2D::SetYAxisLabel
void SetYAxisLabel(const char *)
Definition: Plot2D.cpp:224
Plotting::Line::ClearColor
void ClearColor()
Definition: Plot2D.cpp:121
height
int height
Definition: SFML_HOG.cpp:54
Plotting::Plot2D::SmoothLines
void SmoothLines()
Definition: Plot2D.cpp:460
Plotting::Plot2D::ResetAxis
void ResetAxis()
Definition: Plot2D.cpp:322
Plotting::kImpulsePlot
@ kImpulsePlot
Definition: Plot2D.h:22
Plotting::Line::x
std::vector< double > x
Definition: Plot2D.h:57
Plotting::Line::width
float width
Definition: Plot2D.h:61
Plotting::Point::x
double x
Definition: Plot2D.h:65
max
#define max(a, b)
Definition: MinimalSectorAbstraction.cpp:40
Plotting::Line::yMin
double yMin
Definition: Plot2D.h:55
Graphics::textAlignCenter
@ textAlignCenter
Definition: Graphics.h:20
rgbColor::r
float r
Definition: Colors.h:71
Plotting::Line::VerticalDistanceToLine
double VerticalDistanceToLine(double xp, double yp)
Definition: Plot2D.cpp:83
Plotting::Point
Definition: Plot2D.h:64
Plotting::Plot2D::yMax
double yMax
Definition: Plot2D.h:97
Plotting::Line::yMax
double yMax
Definition: Plot2D.h:55
Graphics::Display::FillCircle
void FillCircle(rect r, rgbColor c)
Definition: Graphics.cpp:128
Plotting::Plot2D::forceAxis
bool forceAxis
Definition: Plot2D.h:98
Plotting::Plot2D::yLabel
std::string yLabel
Definition: Plot2D.h:102
Plotting::Plot2D::AddPoint
void AddPoint(const Point &p)
Definition: Plot2D.cpp:254
Plotting::Line
Definition: Plot2D.h:25
Graphics::textAlignLeft
@ textAlignLeft
Definition: Graphics.h:21
Colors::white
const rgbColor white
Definition: Colors.h:120
Graphics::Display::DrawLineSegments
void DrawLineSegments(const std::vector< point > &points, float lineWidth, rgbColor c)
Definition: Graphics.cpp:230
Graphics::textBaselineBottom
@ textBaselineBottom
Definition: Graphics.h:28
Plotting::Plot2D::AddLine
void AddLine(Line *)
Definition: Plot2D.cpp:231
Plot2D.h
Plotting::Line::g
double g
Definition: Plot2D.h:56
Graphics::Display::DrawText
void DrawText(const char *text, point location, rgbColor c, float height, const char *typeface=0)
Definition: Graphics.cpp:221
Plotting::Plot2D::xOffset
double xOffset
Definition: Plot2D.h:103
Graphics::Display::FillRect
void FillRect(rect r, rgbColor c)
Definition: Graphics.cpp:101
Plotting::Plot2D::Zoom
void Zoom(double)
Definition: Plot2D.cpp:292
Plotting::Line::GetMaxX
double GetMaxX()
Definition: Plot2D.h:45
Plotting::Plot2D::SetXAxisLabel
void SetXAxisLabel(const char *)
Definition: Plot2D.cpp:219
Plotting::Line::AddPoint
void AddPoint(double x, double y)
Definition: Plot2D.cpp:51
Plotting::Plot2D::xMax
double xMax
Definition: Plot2D.h:97
Plotting::Plot2D::dTop
double dTop
Definition: Plot2D.h:96
Plotting::Line::hidden
bool hidden
Definition: Plot2D.h:59
Plotting::Plot2D::dRight
double dRight
Definition: Plot2D.h:96
Plotting::Point::r
double r
Definition: Plot2D.h:65