fix: remap coordinates to make Y up

This commit is contained in:
Cat Flynn 2024-08-21 13:30:21 +01:00
parent 11d5330c73
commit c4edf127e9
3 changed files with 11 additions and 1 deletions

View File

@ -99,7 +99,7 @@ int main()
// TODO: implement zoom
//orbit.setSemiMajorAxis(384748); // in km
orbit.setEccentricity(0.055);
orbit.setInclination(5.15); // degreees
orbit.setInclination(glm::radians(5.15)); // radians?
orbit.setArgumentOfPeriapsis(318.15); // in the case of the moon these last two values are
orbit.setLongitudeOfAscendingNode(60.0); // pretty much constantly changing so use whatever

View File

@ -29,6 +29,12 @@ void OrbitVisualizer::regenerateVertices()
{
float t = (float)i / (float)_vertexCount * 2.0 * _pi;
glm::vec3 pos = _orbit.getPosition(t);
// Vertices come out of the library with X and Y being in the 'flat' plane. Re-order them
// here such that Z is up.
float y = pos.z;
pos.z = pos.y;
pos.y = y;
pos.z *= -1;
_vertices.push_back(pos.x);
_vertices.push_back(pos.y);

View File

@ -11,6 +11,10 @@ void ParticleVisualizer::render(float time)
// TODO: get mean anomly from particle which has the mass!!
const float meanAnomaly = time;
glm::vec3 pos = _map.getParticlePosition(_particleId, meanAnomaly);
float y = pos.z;
pos.z = pos.y;
pos.y = y;
pos.z *= -1;
// TODO: extract widget to its own visualizer since we know it wants an orbit but we
// might not have one here