mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-07 20:21:24 -06:00
merge after rebase
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local shared = asset.require('../satellites_shared')
|
||||
local shared = asset.require('../debris_shared')
|
||||
|
||||
local group = {
|
||||
Title = "Indian ASAT test Debris",
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
local transforms = asset.require("scene/solarsystem/planets/earth/transforms")
|
||||
|
||||
local earthRadius = 2*10946320
|
||||
local maxApogee = 2 * 10946320;
|
||||
|
||||
local volume = {
|
||||
Identifier = "DebrisVolume",
|
||||
Parent = transforms.EarthInertial.Identifier,
|
||||
Renderable = {
|
||||
Type = "RenderableTimeVaryingVolume",
|
||||
SourceDirectory = asset.localResource("generated"),
|
||||
SourceDirectory = asset.localResource("generatedSequence"),
|
||||
TransferFunction = asset.localResource("transferfunction.txt"),
|
||||
StepSize = 0.01,
|
||||
MinValue = 0,
|
||||
@@ -29,7 +29,7 @@ local volume = {
|
||||
Transform = {
|
||||
Scale = {
|
||||
Type = "StaticScale",
|
||||
Scale = earthRadius -- do not multiply this. That will not show real representation.
|
||||
Scale = maxApogee -- do not multiply this. That will not show real representation.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
width 1024
|
||||
lower 0.0
|
||||
upper 1.0
|
||||
mappingkey 0.0 250 120 250 0
|
||||
mappingkey 1.0 200 200 200 255
|
||||
mappingkey 0.08 40 160 40 0
|
||||
mappingkey 0.14 40 40 240 50
|
||||
mappingkey 0.3 200 80 0 250
|
||||
|
||||
11
data/tasks/volume/debristasks/generate_all_debris.task
Normal file
11
data/tasks/volume/debristasks/generate_all_debris.task
Normal file
@@ -0,0 +1,11 @@
|
||||
return {{
|
||||
Type = "GenerateDebrisVolumeTask",
|
||||
Dimensions = {32, 32, 32},
|
||||
LowerDomainBound = {-0.5, -0.5, -0.5},
|
||||
UpperDomainBound = {0.5, 0.5, 0.5},
|
||||
InputPath = "D:/OpenSpace/sync/url/satellite_tle_data_DebrisAll/files/allDebrisInOneTLE.txt",
|
||||
StartTime = "2018-05-04T00:00:00",
|
||||
RawVolumeOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedAll/singleDebris.rawvolume",
|
||||
DictionaryOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedAll/singleDebris.dictionary"
|
||||
}}
|
||||
|
||||
16
data/tasks/volume/debristasks/generate_all_individual.task
Normal file
16
data/tasks/volume/debristasks/generate_all_individual.task
Normal file
@@ -0,0 +1,16 @@
|
||||
return {{
|
||||
Type = "GenerateDebrisVolumeTask",
|
||||
Dimensions = {32, 32, 32},
|
||||
LowerDomainBound = {-0.5, -0.5, -0.5},
|
||||
UpperDomainBound = {0.5, 0.5, 0.5},
|
||||
InputPath = "D:/OpenSpace/sync/url/satellite_tle_data_BreezeMBreakup(18391204735368316775)/files/2012-044.txt",
|
||||
InputPath1 = "D:/OpenSpace/sync/url/satellite_tle_data_FengyunDebris(17139759358359376863)/files/1999-025.txt",
|
||||
InputPath2 = "D:/OpenSpace/sync/url/satellite_tle_data_IndianASATtestDebris(10018654073589624780)/files/2019-006.txt",
|
||||
InputPath3 = "D:/OpenSpace/sync/url/satellite_tle_data_Iridium33Debris(10708435089634408069)/files/iridium-33-debris.txt",
|
||||
InputPath4 = "D:/OpenSpace/sync/url/satellite_tle_data_Kosmos2251Debris(14362705017065532804)/files/cosmos-2251-debris.txt",
|
||||
|
||||
StartTime = "2018-05-04T00:00:00",
|
||||
RawVolumeOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedAllInOne/debris.rawvolume",
|
||||
DictionaryOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedAllInOne/debris.dictionary"
|
||||
}}
|
||||
|
||||
@@ -1,33 +1,20 @@
|
||||
local length = 60
|
||||
local length = 10
|
||||
local tasks = {}
|
||||
|
||||
|
||||
for i=1,length do
|
||||
|
||||
local radius = 0.5 * (1 - i/length)
|
||||
local fn =
|
||||
"return function (x, y, z) " .. "\n" ..
|
||||
" local v = math.sqrt(x^2 + y^2 + z^2) - " .. radius .. "\n" ..
|
||||
" v = (-v - 0.1) / 0.2 " .. "\n" ..
|
||||
" v = math.min(math.max(v, 0), 1) " .. "\n" ..
|
||||
" v = 3*v^2 - 2*v^3 " .. "\n" ..
|
||||
" return v" .. "\n" ..
|
||||
"end"
|
||||
local step = string.format("%02d", i-1)
|
||||
local fn =
|
||||
"return function (x, y, z)" ..
|
||||
"return 1.0" ..
|
||||
"end"
|
||||
|
||||
tasks[#tasks+1] = {
|
||||
Type = "GenerateRawVolumeTask", -- fix name
|
||||
Dimensions = {32, 32, 32},
|
||||
Type = "GenerateDebrisVolumeTask",
|
||||
Dimensions = {256, 256, 256},
|
||||
LowerDomainBound = {-0.5, -0.5, -0.5},
|
||||
UpperDomainBound = {0.5, 0.5, 0.5},
|
||||
ValueFunction = fn,
|
||||
Time = "2018-05-04T00:00:00" .. step,
|
||||
RawVolumeOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/" .. step .. ".rawvolume",
|
||||
DictionaryOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generated/" .. step .. ".dictionary"
|
||||
InputPath = "D:/OpenSpace/sync/url/satellite_tle_data_DebrisAll/files/allDebrisInOneTLE.txt",
|
||||
StartTime = "2019-05-21T00:00" .. step .. ":00",
|
||||
RawVolumeOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedSequence/" .. step .. ".rawvolume",
|
||||
DictionaryOutput = "${DATA}/assets/scene/solarsystem/planets/earth/satellites/debris/volume/generatedSequence/" .. step .. ".dictionary"
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
return {{
|
||||
Type = "GenerateDebrisVolumeTask",
|
||||
Dimensions = {64, 64, 64},
|
||||
|
||||
@@ -18,7 +18,7 @@ for i=1,length do
|
||||
LowerDomainBound = {-0.5, -0.5, -0.5},
|
||||
UpperDomainBound = {0.5, 0.5, 0.5},
|
||||
ValueFunction = fn,
|
||||
Time = "2018-05-04T00:00:" .. step,
|
||||
Time = "2018-05-04T00:00:01" .. step,
|
||||
RawVolumeOutput = "${DATA}/assets/examples/volume/generated/cartesiansequence/" .. step .. ".rawvolume",
|
||||
DictionaryOutput = "${DATA}/assets/examples/volume/generated/cartesiansequence/" .. step .. ".dictionary"
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
****************************************************************************************/
|
||||
#include <fstream>
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
#include <vector>
|
||||
|
||||
#include <modules/space/rendering/renderablesatellites.h>
|
||||
#include <modules/space/translation/keplertranslation.h>
|
||||
@@ -476,7 +476,7 @@ RenderableSatellites::~RenderableSatellites() {
|
||||
|
||||
void RenderableSatellites::initialize() {
|
||||
|
||||
updateBuffers();
|
||||
// updateBuffers();
|
||||
|
||||
//_path.onChange([this]() {
|
||||
// readTLEFile(_path);
|
||||
@@ -534,9 +534,8 @@ void RenderableSatellites::deinitializeGL() {
|
||||
SpaceModule::ProgramObjectManager.release(ProgramName);
|
||||
|
||||
glDeleteBuffers(1, &_vertexBuffer);
|
||||
glDeleteBuffers(1, &_indexBuffer);
|
||||
//glDeleteBuffers(1, &_indexBuffer);
|
||||
glDeleteVertexArrays(1, &_vertexArray);
|
||||
_vertexArray = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -576,8 +575,7 @@ void RenderableSatellites::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
_programObject->setUniform(_uniformCache.numberOfSegments, static_cast<int>(_nSegments));
|
||||
|
||||
//glEnableVertexAttribArray(0); // We like submitting vertices on stream 0 for no special reason
|
||||
//glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(TrailVBOLayout), 0);
|
||||
glLineWidth(_appearance.lineWidth);
|
||||
|
||||
const size_t nrOrbits = _TLEData.size();
|
||||
gl::GLint vertices = 0;
|
||||
@@ -599,7 +597,6 @@ void RenderableSatellites::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
void RenderableSatellites::updateBuffers() {
|
||||
_TLEData = readTLEFile(_path);
|
||||
LINFO(fmt::format("Pathpath: {} ", _path));
|
||||
|
||||
const size_t nVerticesPerOrbit = _nSegments + 1;
|
||||
_vertexBufferData.resize(_TLEData.size() * nVerticesPerOrbit);
|
||||
|
||||
@@ -32,7 +32,6 @@ uniform float lineFade;
|
||||
// uniform int numberOfSegments;
|
||||
|
||||
in vec4 viewSpacePosition;
|
||||
|
||||
in vec4 vs_position;
|
||||
|
||||
in float periodFraction_f;
|
||||
|
||||
@@ -28,9 +28,9 @@ layout(location = 0) in vec4 vertexData;
|
||||
|
||||
uniform dmat4 modelViewTransform;
|
||||
uniform mat4 projectionTransform;
|
||||
uniform bool useLineFade;
|
||||
uniform float lineFade;
|
||||
uniform int vertexSortingMethod;
|
||||
// uniform bool useLineFade;
|
||||
// uniform float lineFade;
|
||||
// uniform int vertexSortingMethod;
|
||||
uniform int pointSize;
|
||||
|
||||
out vec4 viewSpacePosition;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
#include <ghoul/misc/dictionaryluaformatter.h>
|
||||
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/filesystem/file.h>
|
||||
@@ -49,11 +50,17 @@ namespace {
|
||||
constexpr const char* KeyDictionaryOutput = "DictionaryOutput";
|
||||
constexpr const char* KeyDimensions = "Dimensions";
|
||||
constexpr const char* KeyStartTime = "StartTime";
|
||||
// constexpr const char* KeyEndTime = "EndTime";
|
||||
//constexpr const char* KeyEndTime = "EndTime";
|
||||
constexpr const char* KeyInputPath = "InputPath";
|
||||
// constexpr const char* KeyLowerDomainBound = "LowerDomainBound";
|
||||
// constexpr const char* KeyUpperDomainBound = "UpperDomainBound";
|
||||
constexpr const char* _loggerCat = "SpaceDebris";
|
||||
|
||||
// constexpr const char* KeyInputPath1 = "InputPath1";
|
||||
// constexpr const char* KeyInputPath2 = "InputPath2";
|
||||
// constexpr const char* KeyInputPath3 = "InputPath3";
|
||||
// constexpr const char* KeyInputPath4 = "InputPath4";
|
||||
|
||||
|
||||
constexpr const char* KeyLowerDomainBound = "LowerDomainBound";
|
||||
constexpr const char* KeyUpperDomainBound = "UpperDomainBound";
|
||||
|
||||
}
|
||||
|
||||
@@ -396,14 +403,14 @@ std::vector<glm::dvec3> generatePositions(int numberOfPositions) {
|
||||
float radius = 700000; // meter
|
||||
float degreeStep = 360 / numberOfPositions;
|
||||
|
||||
for(int i=0 ; i<= 360 ; i == degreeStep){
|
||||
for(int i=0 ; i<= 360 ; i += degreeStep){
|
||||
glm::dvec3 singlePosition = glm::dvec3(radius* sin(i), radius*cos(i), 0.0);
|
||||
positions.push_back(singlePosition);
|
||||
}
|
||||
return positions;
|
||||
}
|
||||
|
||||
float getDensityAt(glm::uvec3 cell) {
|
||||
float getDensityAt(glm::uvec3 cell, int* densityArray, RawVolume<float>& raw) {
|
||||
float value;
|
||||
// return value at position cell from _densityPerVoxel
|
||||
size_t index = raw.coordsToIndex(cell);
|
||||
@@ -463,7 +470,6 @@ GenerateDebrisVolumeTask::GenerateDebrisVolumeTask(const ghoul::Dictionary& dict
|
||||
_dimensions = dictionary.value<glm::vec3>(KeyDimensions);
|
||||
_startTime = dictionary.value<std::string>(KeyStartTime);
|
||||
//_endTime = dictionary.value<std::string>(KeyEndTime);
|
||||
|
||||
// since _inputPath is past from task,
|
||||
// there will have to be either one task per dataset,
|
||||
// or you need to combine the datasets into one file.
|
||||
@@ -473,8 +479,6 @@ GenerateDebrisVolumeTask::GenerateDebrisVolumeTask(const ghoul::Dictionary& dict
|
||||
|
||||
|
||||
_TLEDataVector = {};
|
||||
_lowerDomainBound = dictionary.value<glm::vec3>(KeyLowerDomainBound);
|
||||
_upperDomainBound = dictionary.value<glm::vec3>(KeyUpperDomainBound);
|
||||
}
|
||||
|
||||
std::string GenerateDebrisVolumeTask::description() {
|
||||
@@ -489,26 +493,39 @@ void GenerateDebrisVolumeTask::perform(const Task::ProgressCallback& progressCal
|
||||
SpiceManager::ref().unloadKernel(kernel);
|
||||
};
|
||||
|
||||
//////////
|
||||
//1. read TLE-data and position of debris elements.
|
||||
// std::vector<KeplerParameters>TLEDataVector = readTLEFile(_inputPath);
|
||||
// std::vector<KeplerParameters>TLEDataVector1 = readTLEFile(_inputPath1);
|
||||
// std::vector<KeplerParameters>TLEDataVector2 = readTLEFile(_inputPath2);
|
||||
// std::vector<KeplerParameters>TLEDataVector3 = readTLEFile(_inputPath3);
|
||||
// std::vector<KeplerParameters>TLEDataVector4 = readTLEFile(_inputPath4);
|
||||
|
||||
// _TLEDataVector.reserve( TLEDataVector.size() + TLEDataVector1.size() + TLEDataVector2.size() + TLEDataVector3.size() + TLEDataVector4.size());
|
||||
// _TLEDataVector.insert(_TLEDataVector.end(), TLEDataVector.begin(), TLEDataVector.end());
|
||||
// _TLEDataVector.insert(_TLEDataVector.end(), TLEDataVector1.begin(), TLEDataVector1.end());
|
||||
// _TLEDataVector.insert(_TLEDataVector.end(), TLEDataVector2.begin(), TLEDataVector2.end());
|
||||
// _TLEDataVector.insert(_TLEDataVector.end(), TLEDataVector3.begin(), TLEDataVector3.end());
|
||||
// _TLEDataVector.insert(_TLEDataVector.end(), TLEDataVector4.begin(), TLEDataVector4.end());
|
||||
// ----- or ----- if only one
|
||||
_TLEDataVector = readTLEFile(_inputPath);
|
||||
//////////
|
||||
|
||||
|
||||
std::vector<glm::dvec3> startPositionBuffer = getPositionBuffer(_TLEDataVector, _startTime);
|
||||
// if we deside to integrate the density over time
|
||||
// std::vector<glm::dvec3> endPositionBuffer = getPositionBuffer(_TLEDataVector, _endTime);
|
||||
|
||||
int numberOfPoints = 40;
|
||||
//int numberOfPoints = 40;
|
||||
//Needs to be looked at, caused my computer to crash...
|
||||
//std::vector<glm::dvec3> generatedPositions = generatePositions(numberOfPoints);
|
||||
|
||||
const int size = _dimensions.x *_dimensions.y *_dimensions.z;
|
||||
int *densityArrayp = new int[size];
|
||||
for (int i = 0; i < size; ++i) {
|
||||
densityArrayp[i] = 0;
|
||||
}
|
||||
LINFO(fmt::format("densityArray: {} ", densityArrayp[0]));
|
||||
|
||||
|
||||
float maxApogee = getMaxApogee(_TLEDataVector);
|
||||
LINFO(fmt::format("Max Apogee: {} ", maxApogee));
|
||||
|
||||
const int size = _dimensions.x *_dimensions.y *_dimensions.z;
|
||||
int *densityArrayp = new int[size]();
|
||||
//densityArrayp = mapDensityToVoxels(densityArrayp, generatedPositions, _dimensions, maxApogee);
|
||||
densityArrayp = mapDensityToVoxels(densityArrayp, startPositionBuffer, _dimensions, maxApogee);
|
||||
|
||||
@@ -539,44 +556,14 @@ void GenerateDebrisVolumeTask::perform(const Task::ProgressCallback& progressCal
|
||||
LINFO(fmt::format("max: {} ", maxVal));*/
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// indexed grid with cooresponding xyz: gridIndex
|
||||
// int array with number of slots = number of voxels: densityArray = {0,0,0,0,0,0}
|
||||
for(const glm::dvec3& debris : startPositionBuffer) {
|
||||
// call function to increment densityArray where debris position ~= voxel position
|
||||
ghoul::filesystem::File file(_rawVolumeOutputPath);
|
||||
const std::string directory = file.directoryName();
|
||||
if (!FileSys.directoryExists(directory)) {
|
||||
FileSys.createDirectory(directory, ghoul::filesystem::FileSystem::Recursive::Yes);
|
||||
}
|
||||
// make raw volume of densityArray.
|
||||
|
||||
//2. create a grid using dimensions and other .task-parameters.
|
||||
|
||||
//3. calculate what voxel each debris is within for each time step.
|
||||
// and increment density with one for each debris in that voxel.
|
||||
|
||||
glm::vec3 domainSize = _upperDomainBound - _lowerDomainBound;
|
||||
|
||||
rawVolume.forEachVoxel([&](glm::uvec3 cell, float) {
|
||||
glm::vec3 coord = _lowerDomainBound +
|
||||
glm::vec3(cell) / glm::vec3(_dimensions) * domainSize;
|
||||
|
||||
// TODO: coord is relative to the dimensions of the volume
|
||||
// and the points from getPositionBuffer is relative
|
||||
// to the earth (i think) so we need to convert them to be in the same
|
||||
// coordinate system to be able to compare them
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
//4.
|
||||
|
||||
volume::RawVolumeWriter<float> writer(_rawVolumeOutputPath);
|
||||
writer.write(rawVolume);
|
||||
|
||||
RawVolumeMetadata metadata;
|
||||
// alternatively metadata.hasTime = false;
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2019 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
#ifndef __OPENSPACE_MODULE_SPACE___GENERATERDEBRISVOLUMETASK___H__
|
||||
#define __OPENSPACE_MODULE_SPACE___GENERATERDEBRISVOLUMETASK___H__
|
||||
|
||||
#include <openspace/util/task.h>
|
||||
#include <openspace/util/time.h>
|
||||
|
||||
#include <modules/space/rendering/renderablesatellites.h>
|
||||
#include <modules/space/translation/keplertranslation.h>
|
||||
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
namespace volume {
|
||||
|
||||
|
||||
class GenerateDebrisVolumeTask : public Task {
|
||||
public:
|
||||
GenerateDebrisVolumeTask(const ghoul::Dictionary& dictionary);
|
||||
std::string description() override;
|
||||
void perform(const Task::ProgressCallback& progressCallback) override;
|
||||
static documentation::Documentation documentation();
|
||||
|
||||
private:
|
||||
std::string _rawVolumeOutputPath;
|
||||
std::string _dictionaryOutputPath;
|
||||
std::string _startTime;
|
||||
std::string _endTime;
|
||||
std::string _inputPath;
|
||||
|
||||
// std::string _inputPath1;
|
||||
// std::string _inputPath2;
|
||||
// std::string _inputPath3;
|
||||
// std::string _inputPath4;
|
||||
|
||||
glm::uvec3 _dimensions;
|
||||
glm::vec3 _lowerDomainBound;
|
||||
glm::vec3 _upperDomainBound;
|
||||
|
||||
std::vector<KeplerParameters> _TLEDataVector;
|
||||
|
||||
// not sure if it should be local function or hidden function.
|
||||
//std::vector<KeplerParameters> readTLEFile(const std::string& filename);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace volume
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_SPACE___GENERATEDEBRISVOLUMETASK___H__
|
||||
@@ -324,27 +324,6 @@ glm::dvec3 KeplerTranslation::debrisPos(const double& time) const {
|
||||
return _orbitPlaneRotation * p;
|
||||
}
|
||||
|
||||
// Is only used in renderableDebris so far.
|
||||
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;
|
||||
}
|
||||
|
||||
void KeplerTranslation::computeOrbitPlane() const {
|
||||
// We assume the following coordinate system:
|
||||
// z = axis of rotation
|
||||
|
||||
@@ -155,12 +155,6 @@ public:
|
||||
protected:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user