Fix for handling nan values in data

This commit is contained in:
Emma Broman
2021-02-08 09:31:24 +01:00
parent 65d70c5965
commit e18f106084
2 changed files with 12 additions and 3 deletions

View File

@@ -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