ref #110 Added recent changes to the rotation matrix.

This commit is contained in:
IgorekLoschinin 2021-10-08 20:40:17 +03:00
parent 5674d686cf
commit a9c85d2a99
2 changed files with 11 additions and 11 deletions

View File

@ -54,25 +54,25 @@ void GroupObject::updateRotation(int id, const QQuaternion &roatation) {
const QVector3D GroupObject::reCalcPos(const QVector3D& pos, const QVector3D &eulerAngles) const
{
float alha = eulerAngles[0];
float beta = eulerAngles[1];
float gamma = eulerAngles[2];
float alha = eulerAngles.z();
float beta = eulerAngles.y();
float gamma = eulerAngles.x();
float x = pos.x();
float y = pos.y();
float z = pos.z();
float newX = x*(qCos(beta)*qCos(gamma)) +
y*(qCos(gamma)*qSin(alha)*qSin(beta) - qSin(gamma)*qCos(alha)) +
float newX = x*(qCos(alha)*qCos(beta)) +
y*(qCos(alha)*qSin(beta)*qSin(gamma) - qSin(alha)*qCos(gamma)) +
z*(qCos(alha)*qSin(beta)*qCos(gamma) + qSin(alha)*qSin(gamma));
float newY = x*(qSin(gamma)*qCos(beta)) +
float newY = x*(qSin(alha)*qCos(beta)) +
y*(qSin(alha)*qSin(beta)*qSin(gamma) + qCos(alha)*qCos(gamma)) +
z*(qSin(gamma)*qSin(beta)*qCos(alha) - qCos(gamma)*qSin(gamma));
z*(qSin(alha)*qSin(beta)*qCos(gamma) - qCos(alha)*qSin(gamma));
float newZ = x*(-qSin(beta)) +
y*(qCos(beta)*qSin(alha)) +
z*(qCos(alha)*qCos(beta));
y*(qCos(beta)*qSin(gamma)) +
z*(qCos(beta)*qCos(gamma));
return QVector3D({newX, newY, newZ});
}

View File

@ -13,13 +13,13 @@ namespace AbstractLvl {
GroupObstacleRed::GroupObstacleRed(): CRAWL::IWorldItem(AUTO_CLASS_NAME) {
QQuaternion rotation =
QQuaternion::fromEulerAngles(QVector3D(0,0,-90));
QQuaternion::fromEulerAngles(QVector3D(0,0,90));
setDistance(7);
setRotation(rotation);
changeLayout(CRAWL::LayoutType::LINE);
for(int i(0); i < 4; i++) {
for(int i(0); i < 10; i++) {
add(new ObstacleRebItem);
}