mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-02 17:51:35 -06:00
KameleonTransformationMatrix() in Transformation manager
This commit is contained in:
@@ -42,18 +42,18 @@ return {
|
||||
},
|
||||
Modules = {
|
||||
"sun",
|
||||
"mercury",
|
||||
"venus",
|
||||
--"mercury",
|
||||
--"venus",
|
||||
"earth",
|
||||
"mars",
|
||||
"jupiter",
|
||||
"saturn",
|
||||
"uranus",
|
||||
"neptune",
|
||||
"stars",
|
||||
--"mars",
|
||||
--"jupiter",
|
||||
--"saturn",
|
||||
--"uranus",
|
||||
--"neptune",
|
||||
--"stars",
|
||||
--"stars-denver",
|
||||
"milkyway",
|
||||
"milkyway-eso",
|
||||
--"milkyway-eso",
|
||||
--"constellationbounds",
|
||||
--"io",
|
||||
--"europa",
|
||||
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
glm::dmat3 frameTransformationMatrix(std::string from, std::string to, double ephemerisTime) const;
|
||||
|
||||
private:
|
||||
glm::dmat3 kameleonTransformationMatrix(std::string from, std::string to, double ephemerisTime) const;
|
||||
|
||||
std::shared_ptr<ccmc::Kameleon> _kameleon;
|
||||
std::set<std::string> _kameleonFrames;
|
||||
std::set<std::string> _dipoleFrames;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <modules/iswa/util/dataprocessortext.h>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/iostreams/device/mapped_file.hpp>
|
||||
namespace {
|
||||
const std::string _loggerCat = "DataProcessorText";
|
||||
}
|
||||
@@ -102,7 +102,7 @@ void DataProcessorText::addDataValues(std::string data, properties::SelectionPro
|
||||
back_inserter(values)
|
||||
);
|
||||
|
||||
if(values.size() <= 0) continue;
|
||||
if(values.size() <= 0) continue;
|
||||
|
||||
for(int i=0; i<numOptions; i++){
|
||||
value = values[i+3];
|
||||
|
||||
@@ -70,21 +70,21 @@ void GuiIswaComponent::render() {
|
||||
bool iondatavalue = _iondata;
|
||||
|
||||
ImGui::Begin("ISWA", &_isEnabled, size, 0.5f);
|
||||
// ImGui::Text("Global Magnetosphere");
|
||||
// ImGui::Checkbox("Gm From Data", &_gmdata); ImGui::SameLine();
|
||||
// ImGui::Checkbox("Gm From Images", &_gmimage);
|
||||
ImGui::Text("Global Magnetosphere");
|
||||
ImGui::Checkbox("Gm From Data", &_gmdata); ImGui::SameLine();
|
||||
ImGui::Checkbox("Gm From Images", &_gmimage);
|
||||
|
||||
// ImGui::Text("Ionosphere");
|
||||
// ImGui::Checkbox("Ion From Data", &_iondata);
|
||||
ImGui::Text("Ionosphere");
|
||||
ImGui::Checkbox("Ion From Data", &_iondata);
|
||||
|
||||
|
||||
// ImGui::Spacing();
|
||||
// static const int addCygnetBufferSize = 256;
|
||||
// static char addCygnetBuffer[addCygnetBufferSize];
|
||||
// ImGui::InputText("addCynget", addCygnetBuffer, addCygnetBufferSize);
|
||||
ImGui::Spacing();
|
||||
static const int addCygnetBufferSize = 256;
|
||||
static char addCygnetBuffer[addCygnetBufferSize];
|
||||
ImGui::InputText("addCynget", addCygnetBuffer, addCygnetBufferSize);
|
||||
|
||||
// if(ImGui::SmallButton("Add Cygnet"))
|
||||
// OsEng.scriptEngine().queueScript("openspace.iswa.addCygnet("+std::string(addCygnetBuffer)+");");
|
||||
if(ImGui::SmallButton("Add Cygnet"))
|
||||
OsEng.scriptEngine().queueScript("openspace.iswa.addCygnet("+std::string(addCygnetBuffer)+");");
|
||||
|
||||
if(_gmdata != gmdatavalue){
|
||||
if(_gmdata){
|
||||
|
||||
@@ -48,6 +48,29 @@
|
||||
_kameleon = nullptr;
|
||||
}
|
||||
|
||||
glm::dmat3 TransformationManager::kameleonTransformationMatrix( std::string from,
|
||||
std::string to,
|
||||
double ephemerisTime) const
|
||||
{
|
||||
ccmc::Position in0 = {1.f, 0.f, 0.f};
|
||||
ccmc::Position in1 = {0.f, 1.f, 0.f};
|
||||
ccmc::Position in2 = {0.f, 0.f, 1.f};
|
||||
|
||||
ccmc::Position out0;
|
||||
ccmc::Position out1;
|
||||
ccmc::Position out2;
|
||||
|
||||
_kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in0, &out0);
|
||||
_kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in1, &out1);
|
||||
_kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in2, &out2);
|
||||
|
||||
return glm::dmat3(
|
||||
out0.c0 , out0.c1 , out0.c2,
|
||||
out1.c0 , out1.c1 , out1.c2,
|
||||
out2.c0 , out2.c1 , out2.c2
|
||||
);
|
||||
}
|
||||
|
||||
glm::dmat3 TransformationManager::frameTransformationMatrix(std::string from,
|
||||
std::string to,
|
||||
double ephemerisTime) const
|
||||
@@ -67,7 +90,13 @@
|
||||
|
||||
ccmc::Position in0 = {1.f, 0.f, 0.f};
|
||||
ccmc::Position in1 = {0.f, 1.f, 0.f};
|
||||
ccmc::Position in2 = {0.f, 0.f , 1.f};
|
||||
ccmc::Position in2 = {0.f, 0.f, 1.f};
|
||||
|
||||
glm::dmat3 in(
|
||||
in0.c0, in0.c1, in0.c2,
|
||||
in1.c0, in1.c1, in1.c2,
|
||||
in2.c0, in2.c1, in2.c2
|
||||
);
|
||||
|
||||
ccmc::Position out0;
|
||||
ccmc::Position out1;
|
||||
@@ -79,43 +108,17 @@
|
||||
|
||||
#ifdef OPENSPACE_MODULE_KAMELEON_ENABLED
|
||||
if(fromKameleon && toKameleon){
|
||||
_kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in0, &out0);
|
||||
_kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in1, &out1);
|
||||
_kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in2, &out2);
|
||||
|
||||
return glm::dmat3(
|
||||
out0.c0 , out0.c1 , out0.c2,
|
||||
out1.c0 , out1.c1 , out1.c2,
|
||||
out2.c0 , out2.c1 , out2.c2
|
||||
);
|
||||
return kameleonTransformationMatrix(from, to, ephemerisTime);
|
||||
|
||||
}else if(fromKameleon && !toKameleon){
|
||||
_kameleon->_cxform(from.c_str(), "J2000", ephemerisTime, &in0, &out0);
|
||||
_kameleon->_cxform(from.c_str(), "J2000", ephemerisTime, &in1, &out1);
|
||||
_kameleon->_cxform(from.c_str(), "J2000", ephemerisTime, &in2, &out2);
|
||||
|
||||
glm::dmat3 kameleonTransformation(
|
||||
out0.c0 , out0.c1 , out0.c2,
|
||||
out1.c0 , out1.c1 , out1.c2,
|
||||
out2.c0 , out2.c1 , out2.c2
|
||||
);
|
||||
|
||||
glm::dmat3 kameleonTransformation = kameleonTransformationMatrix(from, "J2000", ephemerisTime);
|
||||
glm::dmat3 spiceTransformation = SpiceManager::ref().frameTransformationMatrix("J2000", to, ephemerisTime);
|
||||
|
||||
return spiceTransformation*kameleonTransformation;
|
||||
|
||||
}else if(!fromKameleon && toKameleon){
|
||||
glm::dmat3 spiceTransformation = SpiceManager::ref().frameTransformationMatrix(from, "J2000", ephemerisTime);
|
||||
|
||||
_kameleon->_cxform("J2000", to.c_str(), ephemerisTime, &in0, &out0);
|
||||
_kameleon->_cxform("J2000", to.c_str(), ephemerisTime, &in1, &out1);
|
||||
_kameleon->_cxform("J2000", to.c_str(), ephemerisTime, &in2, &out2);
|
||||
|
||||
glm::dmat3 kameleonTransformation(
|
||||
out0.c0 , out0.c1 , out0.c2,
|
||||
out1.c0 , out1.c1 , out1.c2,
|
||||
out2.c0 , out2.c1 , out2.c2
|
||||
);
|
||||
glm::dmat3 kameleonTransformation = kameleonTransformationMatrix("J2000", to, ephemerisTime);
|
||||
|
||||
return kameleonTransformation*spiceTransformation;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user