Skip to content

Commit

Permalink
worthless
Browse files Browse the repository at this point in the history
  • Loading branch information
Kate Wells committed Apr 8, 2013
1 parent 729a0a5 commit d37c71f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,28 @@ void Robot::paint(QPainter *painter,
if (pixmap.isNull()) {
painter->setBrush(Qt::transparent);
painter->setPen(Qt::black);
qreal x = this->pos().x() - ROBOT_WIDTH/2;
qreal y = this->pos().y() - ROBOT_HEIGHT/2;
qDebug() << "TOP LEFT:" << x << "," << y;
//qreal x = this->pos().x() - ROBOT_WIDTH/2;
//qreal y = this->pos().y() - ROBOT_HEIGHT/2;
//qDebug() << "TOP LEFT:" << x << "," << y;
//painter->drawRect(x, y, ROBOT_WIDTH, ROBOT_HEIGHT);
double theta = PI/2 - asin((getWheel(LEFT)->getLoc().y()-getWheel(RIGHT)->getLoc().y())/ROBOT_WIDTH);
QPointF frontLeft = QPointF(getWheel(LEFT)->getLoc().x()+ROBOT_HEIGHT*cos(theta),(getWheel(LEFT)->getLoc().y()+ROBOT_HEIGHT*sin(theta)));
QPointF frontRight = QPointF(getWheel(RIGHT)->getLoc().x()+ROBOT_HEIGHT*cos(theta),(getWheel(RIGHT)->getLoc().y()+ROBOT_HEIGHT*sin(theta)));
QPointF points[4] = {getWheel(LEFT)->getLoc(),
/* QPointF points[4] = {getWheel(LEFT)->getLoc(),
frontLeft,
frontRight,
getWheel(RIGHT)->getLoc()
};
};*/
QPointF points[4] = {frontRight, frontLeft, getWheel(LEFT)->getLoc(), getWheel(RIGHT)->getLoc());
frontLeft,
frontRight,
getWheel(RIGHT)->getLoc()
};
painter->drawPolygon(points,4);
for (int i = 0; i < 4; i++)
{
qDebug() << "POINT" << i << points[i].x() << points[i].y();
}
} else {
painter->scale(.2272, .2824);
painter->drawPixmap(QPointF(-15 * 4.4, -50 * 3.54), pixmap);
Expand Down

0 comments on commit d37c71f

Please sign in to comment.