YES BABY! HOLESSSSSSSS~ Fixed the realised that the coordinate system for the simulation cannot be skewed. Now keeping the proper proportions in diagonal world coordinates

This commit is contained in:
Maximilian Giller 2023-07-05 11:36:28 +02:00
parent b457c33a72
commit 762b163655
3 changed files with 5 additions and 4 deletions

View file

@ -2,6 +2,7 @@
#include "../config.h"
#include "../logging/easylogging++.h"
#include "../utilities/vector_utils.hpp"
#include <cmath>
// Initialize matrix
const Eigen::Matrix<float, 3, 3> CoordinateTransformer::worldToIsometricMatrix =
@ -12,9 +13,10 @@ const Eigen::Matrix<float, 3, 3> CoordinateTransformer::worldToIsometricMatrix =
).finished();
// Same as above, but with SKEW = 0 and height positive
const auto rotateFactor = cos(M_PI / 4);
const Eigen::Matrix<float, 3, 3> CoordinateTransformer::worldToDiagonalMatrix =
(Eigen::Matrix<float, 3, 3>() <<
WORLD_TO_ISO_SCALE, -WORLD_TO_ISO_SCALE, 0,
rotateFactor, -rotateFactor, 0,
0, 0, 1,
1, 1, 0
).finished();

View file

@ -33,11 +33,10 @@ struct HoleDescription
}
float chordLength = 2.f * std::sqrt(radius * radius - distance * distance);
float chordLengthInDiagonal = chordLength * WORLD_TO_ISO_SCALE;
auto diagonalWorldCoords = CoordinateTransformer::worldToDiagonal(WorldCoordinates{worldPosition});
return {playerId, diagonalWorldCoords.horizontal, chordLengthInDiagonal};
return {playerId, diagonalWorldCoords.horizontal, chordLength};
}
};

View file

@ -22,7 +22,7 @@ std::map<std::string, LevelConfig> const all_levels = {
CollectableInLevel("box", {6, 7}),
CollectableInLevel("box", {5, 5}),
CollectableInLevel("box", {9, 5}),
CollectableInLevel("box", {7, 4})
CollectableInLevel("box", {0, 1})
},
{
// Blues