mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 14:29:42 -05:00
Fix for handling nan values in data
This commit is contained in:
@@ -123,7 +123,8 @@ RenderablePointsCloud::RenderablePointsCloud(const ghoul::Dictionary& dictionary
|
||||
|
||||
ghoul::Dictionary d = dictionary.value<ghoul::Dictionary>(DataInfo.identifier);
|
||||
for (int i = 0; i < static_cast<int>(d.size()); ++i) {
|
||||
_pointData.push_back(d.value<glm::dvec3>(std::to_string(i + 1)));
|
||||
const std::string key = std::to_string(i + 1);
|
||||
_pointData.push_back(d.value<glm::dvec3>(key));
|
||||
}
|
||||
|
||||
addProperty(_opacity);
|
||||
@@ -287,7 +288,7 @@ void RenderablePointsCloud::createDataSlice() {
|
||||
|
||||
void RenderablePointsCloud::loadData() {
|
||||
if (_pointData.empty()) {
|
||||
LERROR("No point data found");
|
||||
LWARNING("No point data found");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -252,9 +252,17 @@ void SoftwareIntegrationModule::handlePeerMessage(PeerMessage peerMessage) {
|
||||
float x = xCoordinates[i];
|
||||
float y = yCoordinates[i];
|
||||
float z = zCoordinates[i];
|
||||
glm::dvec3 point{ x, y, z };
|
||||
|
||||
const std::string key = fmt::format("[{}]", i + 1);
|
||||
pointDataDictonary.setValue<glm::dvec3>(key, { x, y, z });
|
||||
|
||||
// Avoid passing nan values through dictionary
|
||||
if (glm::any(glm::isnan(point))) {
|
||||
point = glm::dvec3(0.0);
|
||||
// @TODO Keep track of invalid indices?
|
||||
}
|
||||
|
||||
pointDataDictonary.setValue<glm::dvec3>(key, point);
|
||||
}
|
||||
|
||||
// Create a renderable
|
||||
|
||||
Reference in New Issue
Block a user