Skip to content

Commit

Permalink
Ensure that non-signed fields output positive distances
Browse files Browse the repository at this point in the history
  • Loading branch information
nmellado committed Dec 15, 2023
1 parent afc4bb3 commit 78687d0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ inline void mlsDryRun() {

///Evaluate scalar field for generic FitType.
///// \tparam FitT Defines the type of estimator used for computation
template<typename FitT>
template<typename FitT, bool isSigned = true>
Scalar evalScalarField_impl(const VectorType& input_pos)
{
VectorType current_pos = input_pos;
Expand All @@ -251,7 +251,7 @@ Scalar evalScalarField_impl(const VectorType& input_pos)
auto res = fit.computeWithIds(tree.range_neighbors(current_pos, NSize), tree.point_data());
if(res == Ponca::STABLE) {
current_pos = fit.project(input_pos); // always project input pos
current_value = fit.potential(input_pos);
current_value = isSigned ? fit.potential(input_pos) : std::abs(fit.potential(input_pos));
// current_gradient = fit.primitiveGradient(input_pos);
} else {
// not enough neighbors (if far from the point cloud)
Expand Down Expand Up @@ -305,9 +305,9 @@ void callback() {
{
switch(item_current)
{
case 0: registerRegularSlicer("slicer", evalScalarField_impl<FitASO>,lower, upper, isHDSlicer?1024:256, axis, slice); break;
case 1: registerRegularSlicer("slicer", evalScalarField_impl<FitAPSS>,lower, upper, isHDSlicer?1024:256, axis, slice); break;
case 2: registerRegularSlicer("slicer", evalScalarField_impl<FitPlane>,lower, upper, isHDSlicer?1024:256, axis, slice); break;
case 0: registerRegularSlicer("slicer", evalScalarField_impl<FitASO, true>,lower, upper, isHDSlicer?1024:256, axis, slice); break;
case 1: registerRegularSlicer("slicer", evalScalarField_impl<FitAPSS, true>,lower, upper, isHDSlicer?1024:256, axis, slice); break;
case 2: registerRegularSlicer("slicer", evalScalarField_impl<FitPlane, false>,lower, upper, isHDSlicer?1024:256, axis, slice); break;
}
}
ImGui::SameLine();
Expand Down

0 comments on commit 78687d0

Please sign in to comment.