Skip to content

Commit

Permalink
Housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasKroes committed Nov 25, 2024
1 parent 0402083 commit 9cec516
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/PointDataConversionPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Q_PLUGIN_METADATA(IID "studio.manivault.PointDataConversionPlugin")

using namespace mv;

const QMap<PointDataConversionPlugin::Type, QString> PointDataConversionPlugin::types = QMap<PointDataConversionPlugin::Type, QString>({
{ PointDataConversionPlugin::Type::Log2, "Log2" },
{ PointDataConversionPlugin::Type::ArcSin, "Arcsin" }
const QMap<PointDataConversionPlugin::Type, QString> PointDataConversionPlugin::types = QMap<Type, QString>({
{ Type::Log2, "Log2" },
{ Type::ArcSin, "Arcsin" }
});

PointDataConversionPlugin::PointDataConversionPlugin(const PluginFactory* factory) :
Expand All @@ -38,24 +38,19 @@ void PointDataConversionPlugin::transform()
task.setRunning();
task.setProgressDescription(QString("%1 conversion").arg(getTypeName(_type)));

qDebug() << "PointDataConversionPlugin:: Apply " << getTypeName(_type) << " conversion to " << points->getGuiName();

points->visitData([this, &points, &task](auto pointData) {
std::uint32_t noPointsProcessed = 0;

for (auto point : pointData) {
for (std::int32_t dimensionIndex = 0; dimensionIndex < points->getNumDimensions(); dimensionIndex++) {
switch (_type)
{
case PointDataConversionPlugin::Type::Log2:
point[dimensionIndex] = std::log2(point[dimensionIndex] + 1);
break;

case PointDataConversionPlugin::Type::ArcSin:
point[dimensionIndex] = std::asinh(point[dimensionIndex] / 5.0f);
case Type::Log2:
point[dimensionIndex] = std::log2f(point[dimensionIndex] + 1.0f);
break;

default:
case Type::ArcSin:
point[dimensionIndex] = std::asinhf(point[dimensionIndex] / 5.0f);
break;
}
}
Expand Down Expand Up @@ -186,9 +181,6 @@ WidgetAction* PointDataConversionPluginFactory::getConfigurationAction(const Poi

case PointDataConversionPlugin::Type::ArcSin:
return createGroupAction(_arcSinFactorAction);

default:
break;
}

return nullptr;
Expand Down

0 comments on commit 9cec516

Please sign in to comment.