Включил мозг и разобрался =) грубо говоря, найти эти точки можно так:
// псевдокод
frontPoint.x = cos ( body->rotation * PI / 180 ) * body->centerX() + body->width() / 2;
frontPoint.y = sin ( body->rotation * PI / 180 ) * body->centerY() + body->height() / 2;
rearPoint.x = cos ( body->rotation * PI / 180 ) * body->centerX() - body->width() / 2;
rearPoint.y = sin ( body->rotation * PI / 180 ) * body->centerY() - body->height() / 2;
Если учесть все "опасные" углы, то получится так:
// реализация на Qt
qint16 angle = qRound(body->rotation());
qint16 newFrontY, newRearY, newFrontX, newRearX;
if(angle == 0 || qAbs(angle) == 180) {
newFrontY = qFloor((newY - body->height()/2.1) / mCellSize);
newRearY = qFloor((newY + body->height()/2.1) / mCellSize);
}
else {
newFrontY = qAbs(qSin(angle * PI_DIFF_180) * newY - body->height()/2.1) / mCellSize;
newRearY = qAbs(qSin(angle * PI_DIFF_180) * newY + body->height()/2.1) / mCellSize;
}
if(qAbs(angle) == 90 || qAbs(angle) == 270) {
newFrontX = qFloor((newX - body->width()/2.1) / mCellSize);
newRearX = qFloor((newX + body->width()/2.1) / mCellSize);
}
else {
newFrontX = qAbs(qCos(angle * PI_DIFF_180) * newX - body->width()/2.1) / mCellSize;
newRearX = qAbs(qCos(angle * PI_DIFF_180) * newX + body->width()/2.1) / mCellSize;
}