Skip to content

Commit

Permalink
Apply Pratt normalization for sphere fits
Browse files Browse the repository at this point in the history
  • Loading branch information
nmellado committed Dec 22, 2023
1 parent 27d50c5 commit 55bd95a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/drawingPasses/poncaFitField.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -58,6 +61,13 @@ struct FitField : public BaseFitField {
};

using PlaneFitField = FitField<PlaneFit>;
using SphereFitField = FitField<SphereFit>;
using OrientedSphereFitField = FitField<OrientedSphereFit>;
using UnorientedSphereFitField = FitField<UnorientedSphereFit>;

struct SphereFitField : public FitField<SphereFit>{
void postProcess(typename FitField<SphereFit>::FitType& fit) override { fit.applyPrattNorm(); };
};
struct OrientedSphereFitField : public FitField<OrientedSphereFit>{
void postProcess(typename FitField<OrientedSphereFit>::FitType& fit) override { fit.applyPrattNorm(); };
};
struct UnorientedSphereFitField : public FitField<UnorientedSphereFit>{
void postProcess(typename FitField<UnorientedSphereFit>::FitType& fit) override { fit.applyPrattNorm(); };
};

0 comments on commit 55bd95a

Please sign in to comment.