Go to the documentation of this file.
23 strncpy(
name,label,1024);
71 double bestDist = (
y[0]-yp)*(
y[0]-yp)+(
x[0]-xp)*(
x[0]-xp);
73 for (
unsigned int m = 1; m <
x.size()-1; m++)
75 if (
fless((
y[m]-yp)*(
y[m]-yp)+(
x[m]-xp)*(
x[m]-xp), bestDist))
77 bestDist = (
y[m]-yp)*(
y[m]-yp)+(
x[m]-xp)*(
x[m]-xp);
80 return sqrt(bestDist);
85 double horizDist = fabs(
y[0]-yp);
88 for (
unsigned int m = 1; m <
x.size()-1; m++)
90 if (fabs(
y[m]-yp) < horizDist)
92 horizDist = fabs(
y[m]-yp);
96 return fabs(
x[horizIndex]-xp);
103 for (
unsigned int m = 0; (m <
x.size()) && (m < windowSize); m++)
106 y[m/2] = sum/(double)(m+1);
108 for (
unsigned int m = windowSize/2; m <
x.size()-windowSize/2-1; m++)
110 y[m] = sum/(double)windowSize;
111 sum-=
y[m-windowSize/2];
112 sum+=
y[m+windowSize/2];
114 for (
unsigned int m =
x.size()-windowSize/2-1; m <
x.size(); m++)
116 y[m] = sum/(double)(windowSize/2+
x.size()-1-m);
117 sum-=
y[m-windowSize/2];
135 r = _r;
g = _g;
b = _b;
146 glBegin(GL_LINE_STRIP);
151 for (
unsigned int t = 0; t <
x.size(); t++)
152 glVertex2d(
x[t],
y[t]);
163 for (
unsigned int t = 0; t <
x.size(); t++)
166 glVertex2d(
x[t],
y[t]);
180 std::vector<Graphics::point> points;
181 for (
unsigned int t = 0; t <
x.size(); t++)
184 (float)((
x[t]+xOff)*xScale),
185 -(float)((
y[t]+yOff)*yScale)
192 float baseLineSize = 1.0/150.0;
199 double xLoc = (
x+xOff)*xScale;
200 double yLoc = -(
y+yOff)*yScale;
294 printf(
"Got amt %1.2f\n", amt);
332 for (
unsigned int x = 0; x <
lines.size(); x++)
346 for (
const auto &p :
points)
377 if (
lines.size() == 0)
382 for (
unsigned int x = 1; x <
lines.size(); x++)
384 if (
lines[x]->IsHidden())
462 for (
unsigned int x = 0; x <
lines.size(); x++)
463 lines[x]->Smooth(50);
488 glGetIntegerv(GL_MATRIX_MODE, &matrixMode);
491 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
494 glDisable(GL_DEPTH_TEST);
496 glMatrixMode(GL_PROJECTION);
499 glMatrixMode(GL_MODELVIEW);
512 glVertex2d(
dLeft-tpW, 0); glVertex2d(
dRight+tpW, 0);
513 glVertex2d(0,
dBottom-tpH); glVertex2d(0,
dTop+tpH);
516 for (
unsigned int x = 0; x <
lines.size(); x++)
518 if (
lines[x]->GetChanged())
521 lines[x]->OpenGLDraw();
532 glColor4f(0, 1, 0, .5);
540 glMatrixMode(GL_PROJECTION);
542 glMatrixMode(matrixMode);
544 glEnable(GL_DEPTH_TEST);
556 float baseLineSize = 1.0f/150.0f;
557 return w*baseLineSize;
568 float lineAxisWeight = 2;
569 float lineTicWeight = 1;
585 for (
double y = 0; y <
dTop; y+=
dTop/10)
591 for (
unsigned int x = 0; x <
lines.size(); x++)
596 for (
const auto i :
points)
void DrawLine(point start, point end, float lineWidth, rgbColor c)
A color; r/g/b are between 0...1.
double min(double a, double b)
std::vector< Line * > lines
double DistanceToLine(double xp, double yp)
void Smooth(unsigned int windowSize)
std::vector< Point > points
void Draw(Graphics::Display &display, double xOff, double yOff, double xScale, double yScale) const
void Draw(Graphics::Display &display) const
point3d MakeHOG(double x, double y) const
void OffsetCurrMouse(double deltaX, double deltaY)
Line(const char *label, tPlotType=kLinePlot)
bool fless(double a, double b)
void SetColor(double, double, double)
void Draw(Graphics::Display &display, double xOff, double yOff, double xScale, double yScale) const
void SetAxis(double, double, double, double)
double MakeHOGWidth(double w) const
void SetYAxisLabel(const char *)
double VerticalDistanceToLine(double xp, double yp)
void FillCircle(rect r, rgbColor c)
void AddPoint(const Point &p)
void DrawLineSegments(const std::vector< point > &points, float lineWidth, rgbColor c)
void DrawText(const char *text, point location, rgbColor c, float height, const char *typeface=0)
void FillRect(rect r, rgbColor c)
void SetXAxisLabel(const char *)
void AddPoint(double x, double y)