From 562ff4252041968289199e07e831befc571c3ef1 Mon Sep 17 00:00:00 2001 From: Jacob Molin Date: Fri, 24 Jun 2022 14:41:19 -0600 Subject: [PATCH] Adds log for amount of NaN values loaded for point data + cleanup --- .../rendering/renderablepointscloud.cpp | 20 +++++++++++++++---- .../softwareintegration/shaders/point_vs.glsl | 1 - 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/modules/softwareintegration/rendering/renderablepointscloud.cpp b/modules/softwareintegration/rendering/renderablepointscloud.cpp index 0868406e3c..cbe550a8cb 100644 --- a/modules/softwareintegration/rendering/renderablepointscloud.cpp +++ b/modules/softwareintegration/rendering/renderablepointscloud.cpp @@ -674,10 +674,15 @@ void RenderablePointsCloud::loadPointData(SoftwareIntegrationModule* softwareInt } // Convert to meters if needed + int nNans = 0; if (pointUnit != DistanceUnit::Meter) { float toMeters = static_cast(toMeter(pointUnit)); - for (auto& point : pointData) { - point *= toMeters; + for (auto& value : pointData) { + if (isnan(value)) { + nNans++; + continue; + } + value *= toMeters; } } @@ -687,7 +692,11 @@ void RenderablePointsCloud::loadPointData(SoftwareIntegrationModule* softwareInt pointDataSlice->assign(pointData.begin(), pointData.end()); softwareIntegrationModule->setDataLoaded(_identifier.value(), storage::Key::DataPoints); - LDEBUG("New point data has loaded"); + LINFO(fmt::format( + "New point data ({} points) has loaded. {} values are NaN values. " + "Point's with at least one NaN value are hidden.", + (pointData.size() / 3), nNans + )); } void RenderablePointsCloud::loadVelocityData(SoftwareIntegrationModule* softwareIntegrationModule) { @@ -746,7 +755,10 @@ void RenderablePointsCloud::loadVelocityData(SoftwareIntegrationModule* software // Check for NaN values and convert to m/s if needed int nNans = 0; for (auto& v : velocityData) { - if (isnan(v)) nNans++; + if (isnan(v)) { + nNans++; + continue; + } if (conversionNeeded) { v *= toMeters / toSeconds; } diff --git a/modules/softwareintegration/shaders/point_vs.glsl b/modules/softwareintegration/shaders/point_vs.glsl index 3d98b7978e..d1c230cb25 100644 --- a/modules/softwareintegration/shaders/point_vs.glsl +++ b/modules/softwareintegration/shaders/point_vs.glsl @@ -50,7 +50,6 @@ void main() { vs_velocity = in_velocity; bool velocityIsNan = (isnan(in_velocity[0]) || isnan(in_velocity[1]) || isnan(in_velocity[2])); if (motionEnabled && !velocityIsNan) { - // TODO: Need to subtract with t = 0 (when the position was measured) objectPosition.xyz += time * in_velocity; }