Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply Pratt normalization for sphere fits #10

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(); };
};
Loading