Skip to content

Commit

Permalink
[issue JdeRobot#713] Changed liner for points in laserWidget of kovbu…
Browse files Browse the repository at this point in the history
…kiViewer
  • Loading branch information
aitormf committed Mar 10, 2017
1 parent 7f41977 commit db6aecc
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/tools/kobukiViewer/gui/widget/laserwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void LaserWidget::paintEvent(QPaintEvent *)
int cx = _width/2;
int cy = _height/2;

float x0, y0, x1, y1, d, ang;
float x1, y1, d, ang;

int width = 2;
QPen pen;
Expand All @@ -57,21 +57,16 @@ void LaserWidget::paintEvent(QPaintEvent *)


ang = this->laserData.minAngle;
x0 = cx + (this->laserData.values[0] / d) * cos(ang);
y0 = cy - ((this->laserData.values[0] / d) * sin(ang));

for (int i = 1; i < this->laserData.values.size(); i++) {
for (int i = 0; i < this->laserData.values.size(); i++) {


ang = this->laserData.minAngle + i*step;
x1 = cx + (this->laserData.values[i] / d) * cos(ang);
y1 = cy - ((this->laserData.values[i] / d) * sin(ang));


painter.drawLine(QPointF(x0,y0), QPointF(x1,y1));

x0 = x1;
y0 = y1;
painter.drawPoint(QPointF(x1,y1));

}
}
Expand Down

0 comments on commit db6aecc

Please sign in to comment.