fixing drawing lines

This commit is contained in:
thepra 2017-08-28 13:21:41 +02:00
parent 2ba6957f93
commit b9d0a0a272

View File

@ -66,7 +66,11 @@ void RenderArea::paintEvent(QPaintEvent* event)
painter.drawRect(this->rect());
QPoint center{this->rect().center()};
QPointF prevPoint{Compute(0)};
QPoint center{this->rect().center()},prevPixel;
prevPixel.setX(prevPoint.x() * mScale + center.x());
prevPixel.setY(prevPoint.y() * mScale + center.y());
double step{ mIntervalLenght / mStepCount };
for(float t = 0; t < mIntervalLenght; t += step){
@ -76,7 +80,9 @@ void RenderArea::paintEvent(QPaintEvent* event)
pixel.setX(point.x() * mScale + center.x());
pixel.setY(point.y() * mScale + center.y());
painter.drawPoint(pixel);
painter.drawLine(pixel, prevPixel);
prevPixel=pixel;
}
}