Fix scaling of star translation in kd trees

Applied Parsec scale to the localWorldCenter
This commit is contained in:
Emil Wallberg
2025-04-01 13:41:14 +02:00
parent dc6edcc96d
commit bab025f106
2 changed files with 6 additions and 5 deletions

View File

@@ -2,6 +2,7 @@
#include <ghoul/filesystem/filesystem.h>
#include <openspace/data/dataloader.h>
#include <algorithm>
#include <openspace/util/distanceconstants.h>
#include <queue>
@@ -15,11 +16,11 @@ namespace {
}
}
namespace openspace {
StarMaps::StarMaps(std::string const& filePath, glm::vec3 const& localWorldCenter, std::vector<std::pair<float, float>> const& renderSpans) {
StarMaps::StarMaps(std::string const& filePath, glm::dvec3 const& localWorldCenter, std::vector<std::pair<float, float>> const& renderSpans) {
build(filePath, localWorldCenter, renderSpans);
}
void StarMaps::build(std::string const& filePath, glm::vec3 const& localWorldCenter,
void StarMaps::build(std::string const& filePath, glm::dvec3 const& localWorldCenter,
std::vector<std::pair<float, float>> const& renderSpans)
{
const std::filesystem::path file{ absPath(filePath) };
@@ -32,7 +33,7 @@ namespace openspace {
// Convert positions to spherical coordinates
#pragma omp parallel for
for (auto& entry : dataset.entries) {
entry.position = cartesianToSpherical(entry.position - localWorldCenter);
entry.position = cartesianToSpherical(entry.position - static_cast<glm::vec3>(localWorldCenter / distanceconstants::Parsec));
}
size_t numEntries = dataset.entries.size();

View File

@@ -10,7 +10,7 @@ namespace openspace {
public:
StarMaps() {};
StarMaps(std::string const& filePath, glm::vec3 const& localWorldCenter, std::vector<std::pair<float, float>> const& renderSpans = {});
StarMaps(std::string const& filePath, glm::dvec3 const& localWorldCenter, std::vector<std::pair<float, float>> const& renderSpans = {});
size_t mapsSize() { return _flatTrees.size(); };
@@ -26,7 +26,7 @@ namespace openspace {
void build(
std::string const& constfilePath,
glm::vec3 const& localWorldCenter,
glm::dvec3 const& localWorldCenter,
std::vector<std::pair<float, float>> const& renderSpans = {}
);