mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-25 13:38:34 -06:00
use an alternative position function from keplerTranslation
This commit is contained in:
@@ -421,6 +421,7 @@ namespace openspace {
|
||||
// addProperty(_semiMajorAxisUnit);
|
||||
// addPropertySubOwner(_appearance);
|
||||
|
||||
KeplerTranslation _keplerTranslator;
|
||||
|
||||
const std::string& file = dictionary.value<std::string>(KeyFile);
|
||||
readTLEFile(file);
|
||||
@@ -442,13 +443,11 @@ namespace openspace {
|
||||
// int numberOfObjects = numberOfLines/3;
|
||||
// LINFO("Number of data elements: " + numberOfObjects);
|
||||
|
||||
std::string line;
|
||||
while(true) {
|
||||
|
||||
if(file.eof())
|
||||
break;
|
||||
std::string line = "notEmpty";
|
||||
while(true) {
|
||||
|
||||
std::getline(file, line); // get rid of title
|
||||
std::getline(file, line); // get rid of title
|
||||
|
||||
KeplerParameters keplerElements;
|
||||
|
||||
std::getline(file, line);
|
||||
@@ -636,7 +635,7 @@ namespace openspace {
|
||||
|
||||
// positionAtTime.time = Time(orbit.epoch + timeOffset);
|
||||
|
||||
glm::vec3 position = calculatePosition(Time(orbit.epoch + timeOffset), orbit.epoch);
|
||||
glm::vec3 position = _keplerTranslator.position(Time(orbit.epoch + timeOffset));
|
||||
|
||||
_vertexBufferData[index].x = position.x;
|
||||
_vertexBufferData[index].y = position.y;
|
||||
@@ -671,15 +670,6 @@ namespace openspace {
|
||||
|
||||
|
||||
}
|
||||
|
||||
glm::dvec3 ElonsTest::calculatePosition(const Time& time, double epoch) const {
|
||||
if (_orbitPlaneDirty) {
|
||||
_keplerTranslator.computeOrbitPlane();
|
||||
_orbitPlaneDirty = false;
|
||||
}
|
||||
const double t = time.j2000Seconds() - epoch;
|
||||
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -283,6 +283,25 @@ double KeplerTranslation::eccentricAnomaly(double meanAnomaly) const {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
glm::dvec3 KeplerTranslation::position(const Time& time) const {
|
||||
if (_orbitPlaneDirty) {
|
||||
computeOrbitPlane();
|
||||
_orbitPlaneDirty = false;
|
||||
}
|
||||
|
||||
const double t = time.j2000Seconds() - _epoch;
|
||||
const double meanMotion = glm::two_pi<double>() / _period;
|
||||
const double meanAnomaly = glm::radians(_meanAnomalyAtEpoch.value()) + t * meanMotion;
|
||||
const double e = eccentricAnomaly(meanAnomaly);
|
||||
|
||||
// Use the eccentric anomaly to compute the actual location
|
||||
const glm::dvec3 p = {
|
||||
_semiMajorAxis * 1000.0 * (cos(e) - _eccentricity),
|
||||
_semiMajorAxis * 1000.0 * sin(e) * sqrt(1.0 - _eccentricity * _eccentricity),
|
||||
0.0
|
||||
};
|
||||
return _orbitPlaneRotation * p;
|
||||
}
|
||||
|
||||
glm::dvec3 KeplerTranslation::position(const UpdateData& data) const {
|
||||
if (_orbitPlaneDirty) {
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <openspace/properties/scalar/doubleproperty.h>
|
||||
#include <ghoul/glm.h>
|
||||
#include <ghoul/misc/exception.h>
|
||||
#include <openspace/util/time.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -87,6 +88,7 @@ public:
|
||||
*
|
||||
* \param time The time to use when doing the position lookup
|
||||
*/
|
||||
glm::dvec3 position(const Time& time) const ;
|
||||
glm::dvec3 position(const UpdateData& data) const override;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user