a try to correct position error in orbits

This commit is contained in:
Elon
2019-05-31 10:40:00 -06:00
parent 9a4d41871b
commit 793c25200c
2 changed files with 22 additions and 6 deletions
@@ -624,15 +624,31 @@ void RenderableSatellites::updateBuffers() {
glm::dvec3 position = _keplerTranslator.debrisPos(timeOffset + orbit.epoch);
_vertexBufferData[index].x = static_cast<float>(_keplerTranslator.debrisPos(timeOffset + orbit.epoch).x);
_vertexBufferData[index].y = static_cast<float>(position.y);
_vertexBufferData[index].z = static_cast<float>(position.z);
double positionX = position.x / 10000000; // 10 miljon
double positionY = position.y / 10000000; // 10 miljon
double positionZ = position.z / 10000000; // 10 miljon
LINFO(fmt::format(" real/ :{}", positionX));
LINFO(fmt::format(" float :{}", static_cast<float>(positionX)));
LINFO(fmt::format(" diff :{}", positionX-static_cast<float>(positionX)));
_vertexBufferData[index].x = static_cast<float>(positionX);
_vertexBufferData[index].y = static_cast<float>(positionY);
_vertexBufferData[index].z = static_cast<float>(positionZ);
_vertexBufferData[index].time = static_cast<float>(timeOffset);
_vertexBufferData[index].epoch = static_cast<float>(orbit.epoch);
_vertexBufferData[index].period = static_cast<float>(orbit.period);
// The difference in the print below resulted in large differences, up to 0.23.
// The difference in the print below resulted in large differences, up to 0.35.
//LINFO(fmt::format("diff : {} ", position.x - _vertexBufferData[index].x));
// auto utskrift = positionX-(static_cast<float>(positionX) / 10000000);
// LINFO(fmt::format(" vafan!? :{}", utskrift));
// LINFO(fmt::format(" x-positions float :{}", static_cast<float>(position.x)));
// LINFO(fmt::format(" x-positions float * 10000 :{}", static_cast<float>(position.x * 10000)));
// LINFO(fmt::format(" x-positions float * 10000 /10000 :{}", static_cast<float>(position.x * 10000)/10000));
}
+2 -2
View File
@@ -70,8 +70,8 @@ void main() {
// offsetPeriods can also be calculated by passing the vertexID as a float
// to the fragment shader and deviding it by nrOfSegments.
// vertexID_f = float(gl_VertexID);
dvec4 vertexPosition = dvec4(vertex_data.xyz, 1);
dvec3 positions = dvec3(vertex_data.x*10000000, vertex_data.y*10000000, vertex_data.z*10000000);
dvec4 vertexPosition = dvec4(positions, 1);
viewSpacePosition = vec4(modelViewTransform * vertexPosition);
vs_position = z_normalization( projectionTransform * viewSpacePosition);
gl_Position = vs_position;