Adds log for amount of NaN values loaded for point data + cleanup

This commit is contained in:
Jacob Molin
2022-06-24 14:41:19 -06:00
parent 78cdcf9178
commit 562ff42520
2 changed files with 16 additions and 5 deletions

View File

@@ -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<float>(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;
}

View File

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