From 55bd95a7fa02e59cc1b9fc8e8117b8ad0ff44a11 Mon Sep 17 00:00:00 2001 From: Nicolas Mellado Date: Fri, 22 Dec 2023 08:58:46 +0100 Subject: [PATCH] Apply Pratt normalization for sphere fits --- src/drawingPasses/poncaFitField.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/drawingPasses/poncaFitField.h b/src/drawingPasses/poncaFitField.h index 1c7806c..8fa3471 100644 --- a/src/drawingPasses/poncaFitField.h +++ b/src/drawingPasses/poncaFitField.h @@ -18,6 +18,8 @@ struct FitField : public BaseFitField { using FitType = _FitType; using WeightFunc = typename FitType::WeightFunction; + /// Method called at the end of the fitting process, only for stable fits + virtual void postProcess(FitType& /*fit*/){}; void render(const DataManager::KdTree& points, float*buffer, int w, int h) override{ if(points.point_data().empty()) return; @@ -43,6 +45,7 @@ struct FitField : public BaseFitField { } if ( (b[2] = fit.isStable()) ){ + postProcess(fit); float dist = fit.potential({i,j}); if (std::abs(dist)> maxVal) maxVal = std::abs(dist); @@ -58,6 +61,13 @@ struct FitField : public BaseFitField { }; using PlaneFitField = FitField; -using SphereFitField = FitField; -using OrientedSphereFitField = FitField; -using UnorientedSphereFitField = FitField; + +struct SphereFitField : public FitField{ + void postProcess(typename FitField::FitType& fit) override { fit.applyPrattNorm(); }; +}; +struct OrientedSphereFitField : public FitField{ + void postProcess(typename FitField::FitType& fit) override { fit.applyPrattNorm(); }; +}; +struct UnorientedSphereFitField : public FitField{ + void postProcess(typename FitField::FitType& fit) override { fit.applyPrattNorm(); }; +};