Cleanup for coding style

Add strict mode to check_style_guide script
This commit is contained in:
Alexander Bock
2017-11-08 10:35:39 -06:00
parent d94408224c
commit b50b52d351
387 changed files with 1907 additions and 2132 deletions
@@ -103,12 +103,12 @@ private:
/// Determines the color of the constellation lines
properties::Vec3Property _color;
std::unique_ptr<ghoul::opengl::ProgramObject> _program;
/// The list of all loaded constellation bounds
std::vector<ConstellationBound> _constellationBounds;
using Vertex = std::array<float, 3>;
std::vector<Vertex> _vertexValues; ///< A list of all vertices of all bounds
+6 -8
View File
@@ -55,7 +55,7 @@ namespace {
const char* keyShadowGroup = "Shadow_Group";
const char* keyShadowSource = "Source";
const char* keyShadowCaster = "Caster";
static const openspace::properties::Property::PropertyInfo ColorTextureInfo = {
"ColorTexture",
"Color Base Texture",
@@ -411,7 +411,7 @@ void RenderablePlanet::render(const RenderData& data, RendererTasks&) {
// scale the planet to appropriate size since the planet is a unit sphere
//glm::mat4 transform = glm::mat4(1);
//earth needs to be rotated for that to work.
glm::dmat4 rot = glm::rotate(glm::dmat4(1.0), glm::half_pi<double>(), glm::dvec3(1, 0, 0));
glm::dmat4 roty = glm::rotate(glm::dmat4(1.0), glm::half_pi<double>(), glm::dvec3(0, -1, 0));
@@ -435,9 +435,9 @@ void RenderablePlanet::render(const RenderData& data, RendererTasks&) {
// glm::mat4 ModelViewTrans = data.camera.viewMatrix() * scaleCamTrans *
// translateCamTrans * translateObjTrans * glm::mat4(modelTransform);
setPscUniforms(*_programObject.get(), data.camera, data.position);
_programObject->setUniform("_performShading", _performShading);
_programObject->setUniform("_hasHeightMap", _hasHeightTexture);
@@ -448,7 +448,6 @@ void RenderablePlanet::render(const RenderData& data, RendererTasks&) {
ghoul::opengl::TextureUnit nightUnit;
ghoul::opengl::TextureUnit heightUnit;
dayUnit.activate();
_texture->bind();
_programObject->setUniform("texture1", dayUnit);
@@ -486,7 +485,6 @@ void RenderablePlanet::render(const RenderData& data, RendererTasks&) {
casterPos *= 1000.0; // converting to meters
psc caster_pos = PowerScaledCoordinate::CreatePowerScaledCoordinate(casterPos.x, casterPos.y, casterPos.z);
// First we determine if the caster is shadowing the current planet (all calculations in World Coordinates):
glm::vec3 planetCasterVec = (caster_pos - data.position).vec3();
glm::vec3 sourceCasterVec = glm::vec3(casterPos - sourcePos);
@@ -495,7 +493,7 @@ void RenderablePlanet::render(const RenderData& data, RendererTasks&) {
float d_test = glm::length(planetCasterVec - planetCaster_proj);
float xp_test = shadowConf.caster.second * sc_length / (shadowConf.source.second + shadowConf.caster.second);
float rp_test = shadowConf.caster.second * (glm::length(planetCaster_proj) + xp_test) / xp_test;
double casterDistSun = glm::length(casterPos);
float planetDistSun = glm::length(data.position.vec3());
@@ -607,4 +605,4 @@ void RenderablePlanet::loadTexture() {
}
}
} // namespace openspace
} // namespace openspace
+3 -3
View File
@@ -84,13 +84,13 @@ private:
properties::StringProperty _colorTexturePath;
properties::StringProperty _nightTexturePath;
properties::StringProperty _heightMapTexturePath;
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
std::unique_ptr<ghoul::opengl::Texture> _texture;
std::unique_ptr<ghoul::opengl::Texture> _nightTexture;
std::unique_ptr<ghoul::opengl::Texture> _heightMapTexture;
properties::FloatProperty _heightExaggeration;
std::unique_ptr<planetgeometry::PlanetGeometry> _geometry;
+7 -8
View File
@@ -44,7 +44,7 @@ namespace {
"This value is the path to a texture on disk that contains a one-dimensional "
"texture which is used for these rings."
};
static const openspace::properties::Property::PropertyInfo SizeInfo = {
"Size",
"Size",
@@ -158,13 +158,12 @@ RenderableRings::RenderableRings(const ghoul::Dictionary& dictionary)
_offset = dictionary.value<glm::vec2>(OffsetInfo.identifier);
}
addProperty(_offset);
_texturePath.onChange([&]() { loadTexture(); });
addProperty(_texturePath);
_textureFile->setCallback([&](const File&) { _textureIsDirty = true; });
if (dictionary.hasKey(NightFactorInfo.identifier)) {
_nightFactor = static_cast<float>(
dictionary.value<double>(NightFactorInfo.identifier)
@@ -223,7 +222,7 @@ void RenderableRings::render(const RenderData& data, RendererTasks&) {
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
glm::dmat4(data.modelTransform.rotation) *
glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale));
glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() * modelTransform;
_shader->setUniform(
@@ -232,20 +231,20 @@ void RenderableRings::render(const RenderData& data, RendererTasks&) {
);
_shader->setUniform("textureOffset", _offset);
_shader->setUniform("transparency", _transparency);
_shader->setUniform("_nightFactor", _nightFactor);
_shader->setUniform(
"sunPosition",
_sunPosition
);
setPscUniforms(*_shader, data.camera, data.position);
ghoul::opengl::TextureUnit unit;
unit.activate();
_texture->bind();
_shader->setUniform("texture1", unit);
glDisable(GL_CULL_FACE);
glBindVertexArray(_quad);
@@ -306,7 +305,7 @@ void RenderableRings::createPlane() {
GLfloat s;
GLfloat t;
};
VertexData data[] = {
{ -size, -size, 0.f, 0.f },
{ size, size, 1.f, 1.f },
+5 -9
View File
@@ -183,7 +183,6 @@ documentation::Documentation RenderableStars::Documentation() {
};
}
RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _pointSpreadFunctionTexturePath(PsfTextureInfo)
@@ -244,7 +243,6 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
}
_colorOption.onChange([&] { _dataIsDirty = true; });
addProperty(_colorOption);
_pointSpreadFunctionTexturePath.onChange(
[&]{ _pointSpreadFunctionTextureIsDirty = true; }
@@ -342,7 +340,7 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) {
_program->setUniform("scaleFactor", _scaleFactor);
_program->setUniform("minBillboardSize", _minBillboardSize);
_program->setUniform("screenSize", glm::vec2(OsEng.renderEngine().renderingResolution()));
setPscUniforms(*_program.get(), data.camera, data.position);
_program->setUniform("scaling", scaling);
@@ -364,7 +362,7 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) {
using IgnoreError = ghoul::opengl::ProgramObject::IgnoreError;
_program->setIgnoreUniformLocationError(IgnoreError::No);
_program->deactivate();
glDepthMask(true);
}
@@ -423,7 +421,7 @@ void RenderableStars::update(const UpdateData&) {
stride,
reinterpret_cast<void*>(offsetof(ColorVBOLayout, bvColor))
);
break;
case ColorOption::Velocity:
{
@@ -493,7 +491,7 @@ void RenderableStars::update(const UpdateData&) {
glBindVertexArray(0);
_dataIsDirty = false;
}
}
if (_pointSpreadFunctionTextureIsDirty) {
LDEBUG("Reloading Point Spread Function texture");
@@ -502,7 +500,7 @@ void RenderableStars::update(const UpdateData&) {
_pointSpreadFunctionTexture = ghoul::io::TextureReader::ref().loadTexture(
absPath(_pointSpreadFunctionTexturePath)
);
if (_pointSpreadFunctionTexture) {
LDEBUG("Loaded texture from '" <<
absPath(_pointSpreadFunctionTexturePath) << "'"
@@ -752,8 +750,6 @@ void RenderableStars::createDataSlice(ColorOption option) {
layout.value.position = { {
position[0], position[1], position[2], position[3]
} };
#ifdef USING_STELLAR_TEST_GRID
layout.value.bvColor = _fullData[i + 3];
+2 -2
View File
@@ -50,7 +50,7 @@ namespace {
} // namespace
namespace openspace {
documentation::Documentation SpiceRotation::Documentation() {
using namespace openspace::documentation;
return {
@@ -120,7 +120,7 @@ SpiceRotation::SpiceRotation(const ghoul::Dictionary& dictionary)
addProperty(_sourceFrame);
addProperty(_destinationFrame);
}
void SpiceRotation::update(const UpdateData& data) {
try {
_matrix = SpiceManager::ref().positionTransformMatrix(
+3 -3
View File
@@ -29,9 +29,9 @@
#include <openspace/properties/stringproperty.h>
namespace openspace {
namespace documentation { struct Documentation; }
class SpiceRotation : public Rotation {
public:
SpiceRotation(const ghoul::Dictionary& dictionary);
@@ -44,7 +44,7 @@ private:
properties::StringProperty _sourceFrame;
properties::StringProperty _destinationFrame;
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_SPACE___SPICEROTATION___H__
+13 -15
View File
@@ -109,12 +109,10 @@ T solveIteration(Func function, T x0, const T& err = 0.0, int maxIterations = 10
"Orbit period",
"Specifies the orbital period (in seconds)."
};
} // namespace
namespace openspace {
KeplerTranslation::RangeError::RangeError(std::string off)
: ghoul::RuntimeError("Value '" + off + "' out of range", "KeplerTranslation")
, offender(std::move(off))
@@ -122,7 +120,7 @@ KeplerTranslation::RangeError::RangeError(std::string off)
documentation::Documentation KeplerTranslation::Documentation() {
using namespace openspace::documentation;
return{
return {
"Kepler Translation",
"space_transform_kepler",
{
@@ -251,7 +249,7 @@ double KeplerTranslation::eccentricAnomaly(double meanAnomaly) const {
// Compute the eccentric anomaly (the location of the spacecraft taking the
// eccentricity of the orbit into account) using different solves for the regimes in
// which they are most efficient
if (_eccentricity == 0.0) {
// In a circular orbit, the eccentric anomaly = mean anomaly
return meanAnomaly;
@@ -319,17 +317,17 @@ void KeplerTranslation::computeOrbitPlane() {
// z = axis of rotation
// x = pointing towards the first point of Aries
// y completes the righthanded coordinate system
// Perform three rotations:
// 1. Around the z axis to place the location of the ascending node
// 2. Around the x axis (now aligned with the ascending node) to get the correct
// inclination
// 3. Around the new z axis to place the closest approach to the correct location
const glm::vec3 ascendingNodeAxisRot = { 0.f, 0.f, 1.f };
const glm::vec3 inclinationAxisRot = { 1.f, 0.f, 0.f };
const glm::vec3 argPeriapsisAxisRot = { 0.f, 0.f, 1.f };
const double asc = glm::radians(_ascendingNode.value());
const double inc = glm::radians(_inclination.value());
const double per = glm::radians(_argumentOfPeriapsis.value());
@@ -370,23 +368,23 @@ void KeplerTranslation::setKeplerElements(double eccentricity, double semiMajorA
auto isInRange = [](double val, double min, double max) -> bool {
return val >= min && val <= max;
};
if (isInRange(eccentricity, 0.0, 1.0)) {
_eccentricity = eccentricity;
}
else {
throw RangeError("Eccentricity");
}
_semiMajorAxis = semiMajorAxis;
if (isInRange(inclination, 0.0, 360.0)) {
_inclination = inclination;
}
else {
throw RangeError("Inclination");
}
if (isInRange(_ascendingNode, 0.0, 360.0)) {
_ascendingNode = ascendingNode;
}
@@ -399,17 +397,17 @@ void KeplerTranslation::setKeplerElements(double eccentricity, double semiMajorA
else {
throw RangeError("Argument of Periapsis");
}
if (isInRange(_meanAnomalyAtEpoch, 0.0, 360.0)) {
_meanAnomalyAtEpoch = meanAnomalyAtEpoch;
}
else {
throw RangeError("Mean anomaly at epoch");
}
_period = orbitalPeriod;
_epoch = epoch;
computeOrbitPlane();
}
+11 -11
View File
@@ -33,7 +33,7 @@
#include <ghoul/misc/exception.h>
namespace openspace {
/**
* The KeplerTranslation is a concrete Translation implementation that uses the 6
* Keplerian elements (eccentricity, semi-major axis, inclination, right ascension of the
@@ -44,10 +44,10 @@ class KeplerTranslation : public Translation {
public:
struct RangeError : public ghoul::RuntimeError {
explicit RangeError(std::string offender);
std::string offender;
};
/**
* The constructor that retrieves the required Keplerian elements from the passed
* \p dictionary. These values are then apssed to the setKeplerElements method for
@@ -57,10 +57,10 @@ public:
* Keplerian elements (see Documentation)
*/
KeplerTranslation(const ghoul::Dictionary& dictionary);
/// Default destructor
virtual ~KeplerTranslation() = default;
/**
* This method returns the position of the object at the time that was passed to the
* last call of the #update method. The KeplerTranslation caches its position, thus
@@ -68,7 +68,7 @@ public:
* \return The position of the object at the time of last call to the #update method
*/
virtual glm::dvec3 position() const override;
/**
* Updates the cached position of the object to correspond to the time passed in the
* \p data.
@@ -76,7 +76,7 @@ public:
* this Translation
*/
void update(const UpdateData& data) override;
/**
* Method returning the openspace::Documentation that describes the ghoul::Dictinoary
* that can be passed to the constructor.
@@ -84,11 +84,11 @@ public:
* be passed to the constructor
*/
static documentation::Documentation Documentation();
protected:
/// Default construct that initializes all the properties and member variables
KeplerTranslation();
/**
* Sets the internal values for the Keplerian elements and the epoch as a string of
* the form YYYY MM DD HH:mm:ss.
@@ -109,7 +109,7 @@ protected:
double ascendingNode, double argumentOfPeriapsis, double meanAnomalyAtEpoch,
double orbitalPeriod, const std::string& epoch
);
/**
* Sets the internal values for the Keplerian elements and the epoch as seconds past
* J2000 epoch.
@@ -171,7 +171,7 @@ private:
/// The cached position for the last time with which the update method was called
glm::dvec3 _position;
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_SPACE___KEPLERTRANSLATION___H__
@@ -62,7 +62,7 @@ namespace {
} // namespace
namespace openspace {
documentation::Documentation SpiceTranslation::Documentation() {
using namespace openspace::documentation;
@@ -167,11 +167,11 @@ SpiceTranslation::SpiceTranslation(const ghoul::Dictionary& dictionary)
_observer.onChange(update);
addProperty(_observer);
_frame.onChange(update);
addProperty(_frame);
}
glm::dvec3 SpiceTranslation::position() const {
return _position;
}
+3 -3
View File
@@ -30,11 +30,11 @@
#include <openspace/properties/stringproperty.h>
namespace openspace {
class SpiceTranslation : public Translation {
public:
SpiceTranslation(const ghoul::Dictionary& dictionary);
glm::dvec3 position() const override;
void update(const UpdateData& data) override;
@@ -47,7 +47,7 @@ private:
glm::dvec3 _position;
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_SPACE___SPICETRANSLATION___H__
+58 -59
View File
@@ -36,7 +36,7 @@
namespace {
const char* KeyFile = "File";
const char* KeyLineNum = "LineNum";
// The list of leap years only goes until 2056 as we need to touch this file then
// again anyway ;)
static const std::vector<int> LeapYears = {
@@ -44,7 +44,7 @@ namespace {
2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036, 2040,
2044, 2048, 2052, 2056
};
// Count the number of full days since the beginning of 2000 to the beginning of
// the parameter 'year'
int countDays(int year) {
@@ -54,28 +54,28 @@ namespace {
const int Epoch = 2000;
const int DaysRegularYear = 365;
const int DaysLeapYear = 366;
if (year == Epoch) {
return 0;
}
// Get the position of the most recent leap year
auto lb = std::lower_bound(LeapYears.begin(), LeapYears.end(), year);
// Get the position of the epoch
auto y2000 = std::find(LeapYears.begin(), LeapYears.end(), Epoch);
// The distance between the two iterators gives us the number of leap years
int nLeapYears = static_cast<int>(std::abs(std::distance(y2000, lb)));
int nYears = std::abs(year - Epoch);
int nRegularYears = nYears - nLeapYears;
// Get the total number of days as the sum of leap years + non leap years
int result = nRegularYears * DaysRegularYear + nLeapYears * DaysLeapYear;
return result;
}
// Returns the number of leap seconds that lie between the {year, dayOfYear}
// time point and { 2000, 1 }
int countLeapSeconds(int year, int dayOfYear) {
@@ -89,9 +89,9 @@ namespace {
std::tie(year, dayOfYear) < std::tie(rhs.year, rhs.dayOfYear);
}
};
const LeapSecond Epoch = { 2000, 1};
// List taken from: https://www.ietf.org/timezones/data/leap-seconds.list
static const std::vector<LeapSecond> LeapSeconds = {
{ 1972, 1 },
@@ -123,25 +123,25 @@ namespace {
{ 2015, 182 },
{ 2017, 1 }
};
// Get the position of the last leap second before the desired date
LeapSecond date { year, dayOfYear };
auto it = std::lower_bound(LeapSeconds.begin(), LeapSeconds.end(), date);
// Get the position of the Epoch
auto y2000 = std::lower_bound(LeapSeconds.begin(), LeapSeconds.end(), Epoch);
// The distance between the two iterators gives us the number of leap years
int nLeapSeconds = static_cast<int>(std::abs(std::distance(y2000, it)));
return nLeapSeconds;
}
double epochFromSubstring(const std::string& epochString) {
// The epochString is in the form:
// YYDDD.DDDDDDDD
// With YY being the last two years of the launch epoch, the first DDD the day
// of the year and the remaning a fractional part of the day
// The main overview of this function:
// 1. Reconstruct the full year from the YY part
// 2. Calculate the number of seconds since the beginning of the year
@@ -151,13 +151,13 @@ namespace {
// 4. Get the number of leap seconds since January 1st, 2000 and remove them
// 5. Adjust for the fact the epoch starts on 1st Januaray at 12:00:00, not
// midnight
// According to https://celestrak.com/columns/v04n03/
// Apparently, US Space Command sees no need to change the two-line element
// set format yet since no artificial earth satellites existed prior to 1957.
// By their reasoning, two-digit years from 57-99 correspond to 1957-1999 and
// those from 00-56 correspond to 2000-2056. We'll see each other again in 2057!
// 1. Get the full year
std::string yearPrefix = [y = epochString.substr(0, 2)](){
int year = std::atoi(y.c_str());
@@ -169,7 +169,7 @@ namespace {
// 2.
// 2.a
double daysInYear = std::atof(epochString.substr(2).c_str());
// 2.b
bool isInLeapYear = std::find(
LeapYears.begin(),
@@ -181,13 +181,13 @@ namespace {
// beyond the end of february (= 31+29 days)
--daysInYear;
}
// 3
using namespace std::chrono;
int SecondsPerDay = static_cast<int>(seconds(hours(24)).count());
//Need to subtract 1 from daysInYear since it is not a zero-based count
double nSecondsSince2000 = (daysSince2000 + daysInYear - 1) * SecondsPerDay;
// 4
// We need to remove additionbal leap seconds past 2000 and add them prior to
// 2000 to sync up the time zones
@@ -198,18 +198,18 @@ namespace {
// 5
double nSecondsEpochOffset = static_cast<double>(seconds(hours(12)).count());
// Combine all of the values
double epoch = nSecondsSince2000 + nLeapSecondsOffset - nSecondsEpochOffset;
return epoch;
}
double calculateSemiMajorAxis(double meanMotion) {
using namespace std::chrono;
const double GravitationalConstant = 6.6740831e-11;
const double MassEarth = 5.9721986e24;
const double muEarth = GravitationalConstant * MassEarth;
// Use Kepler's 3rd law to calculate semimajor axis
// a^3 / P^2 = mu / (2pi)^2
// <=> a = ((mu * P^2) / (2pi^2))^(1/3)
@@ -218,10 +218,10 @@ namespace {
// mu = G*M_earth
using namespace std::chrono;
double period = seconds(hours(24)).count() / meanMotion;
const double pisq = glm::pi<double>() * glm::pi<double>();
double semiMajorAxis = pow((muEarth * period*period) / (4 * pisq), 1.0 / 3.0);
// We need the semi major axis in km instead of m
return semiMajorAxis / 1000.0;
}
@@ -258,7 +258,6 @@ documentation::Documentation TLETranslation::Documentation() {
};
}
TLETranslation::TLETranslation(const ghoul::Dictionary& dictionary)
: KeplerTranslation()
{
@@ -267,7 +266,7 @@ TLETranslation::TLETranslation(const ghoul::Dictionary& dictionary)
dictionary,
"TLETranslation"
);
std::string file = dictionary.value<std::string>(KeyFile);
int lineNum = static_cast<int>(dictionary.value<double>(KeyLineNum));
readTLEFile(file, lineNum);
@@ -275,7 +274,7 @@ TLETranslation::TLETranslation(const ghoul::Dictionary& dictionary)
void TLETranslation::readTLEFile(const std::string& filename, int lineNum) {
ghoul_assert(FileSys.fileExists(filename), "The filename must exist");
std::ifstream file;
file.exceptions(std::ofstream::failbit | std::ofstream::badbit);
file.open(filename);
@@ -291,7 +290,7 @@ void TLETranslation::readTLEFile(const std::string& filename, int lineNum) {
double meanMotion = 0.0;
double epoch = 0.0;
} keplerElements;
std::string line;
// Loop through and throw out lines until getting to the linNum of interest
for (int i = 1; i < lineNum; ++i) {
@@ -302,21 +301,21 @@ void TLETranslation::readTLEFile(const std::string& filename, int lineNum) {
std::getline(file, line); // Get line 1 of TLE format
if (line[0] == '1') {
// First line
// Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 08-08 Classification (U = Unclassified)
// 4 10-11 International Designator (Last two digits of launch year)
// 5 12-14 International Designator (Launch number of the year)
// 6 15-17 International Designator(piece of the launch) A
// 7 19-20 Epoch Year(last two digits of year)
// 8 21-32 Epoch(day of the year and fractional portion of the day)
// 9 34-43 First Time Derivative of the Mean Motion divided by two
// 10 45-52 Second Time Derivative of Mean Motion divided by six
// 11 54-61 BSTAR drag term(decimal point assumed)[10] - 11606 - 4
// 12 63-63 The "Ephemeris type"
// 13 65-68 Element set number.Incremented when a new TLE is generated
// 14 69-69 Checksum (modulo 10)
// Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 08-08 Classification (U = Unclassified)
// 4 10-11 International Designator (Last two digits of launch year)
// 5 12-14 International Designator (Launch number of the year)
// 6 15-17 International Designator(piece of the launch) A
// 7 19-20 Epoch Year(last two digits of year)
// 8 21-32 Epoch(day of the year and fractional portion of the day)
// 9 34-43 First Time Derivative of the Mean Motion divided by two
// 10 45-52 Second Time Derivative of Mean Motion divided by six
// 11 54-61 BSTAR drag term(decimal point assumed)[10] - 11606 - 4
// 12 63-63 The "Ephemeris type"
// 13 65-68 Element set number.Incremented when a new TLE is generated
// 14 69-69 Checksum (modulo 10)
keplerElements.epoch = epochFromSubstring(line.substr(18, 14));
} else {
throw ghoul::RuntimeError("File " + filename + " @ line "
@@ -326,17 +325,17 @@ void TLETranslation::readTLEFile(const std::string& filename, int lineNum) {
std::getline(file, line); // Get line 2 of TLE format
if (line[0] == '2') {
// Second line
//Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 09-16 Inclination (degrees)
// 4 18-25 Right ascension of the ascending node (degrees)
// 5 27-33 Eccentricity (decimal point assumed)
// 6 35-42 Argument of perigee (degrees)
// 7 44-51 Mean Anomaly (degrees)
// 8 53-63 Mean Motion (revolutions per day)
// 9 64-68 Revolution number at epoch (revolutions)
// 10 69-69 Checksum (modulo 10)
// Field Columns Content
// 1 01-01 Line number
// 2 03-07 Satellite number
// 3 09-16 Inclination (degrees)
// 4 18-25 Right ascension of the ascending node (degrees)
// 5 27-33 Eccentricity (decimal point assumed)
// 6 35-42 Argument of perigee (degrees)
// 7 44-51 Mean Anomaly (degrees)
// 8 53-63 Mean Motion (revolutions per day)
// 9 64-68 Revolution number at epoch (revolutions)
// 10 69-69 Checksum (modulo 10)
std::stringstream stream;
stream.exceptions(std::ios::failbit);
@@ -374,10 +373,10 @@ void TLETranslation::readTLEFile(const std::string& filename, int lineNum) {
+ std::to_string(lineNum + 2) + " doesn't have '2' header");
}
file.close();
// Calculate the semi major axis based on the mean motion using kepler's laws
keplerElements.semiMajorAxis = calculateSemiMajorAxis(keplerElements.meanMotion);
// Converting the mean motion (revolutions per day) to period (seconds per revolution)
using namespace std::chrono;
double period = seconds(hours(24)).count() / keplerElements.meanMotion;
@@ -393,5 +392,5 @@ void TLETranslation::readTLEFile(const std::string& filename, int lineNum) {
keplerElements.epoch
);
}
} // namespace openspace
+3 -3
View File
@@ -28,7 +28,7 @@
#include <modules/space/translation/keplertranslation.h>
namespace openspace {
/**
* A specialization of the KeplerTranslation that extracts the Keplerian elements from a
* two-line element as described by the US Space Command
@@ -50,7 +50,7 @@ public:
* \param The ghoul::Dictionary that contains the information for this TLETranslation
(*/
TLETranslation(const ghoul::Dictionary& dictionary = ghoul::Dictionary());
/**
* Method returning the openspace::Documentation that describes the ghoul::Dictinoary
* that can be passed to the constructor.
@@ -75,7 +75,7 @@ private:
*/
void readTLEFile(const std::string& filename, int lineNum);
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_SPACE___TLETRANSLATION___H__