Skip to content

Commit

Permalink
Merge pull request #127 from ThibaultLejemble/fix-sphere-gradient
Browse files Browse the repository at this point in the history
Fix sphere gradient (#118)
  • Loading branch information
nmellado authored Dec 15, 2023
2 parents 632e0e2 + dbf32e5 commit cfbe035
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Current head (v.1.2 RC)
- [spatialPartitioning] Fix potential compilation issues in KnnGraph (#111)
- [spatialPartitioning] Fix debug macros in KnnGraphRangeQuery (#121)
- [fitting] Fix sphere fit eigen solver (#112)
- [fitting] Fix a bug in AlgebraicSphere::primtiveGradient (#127)
- [spatialPartitioning] Improve kdtree to_string to output data in YAML format (#125)

-Docs
Expand Down
8 changes: 5 additions & 3 deletions Ponca/src/Fitting/algebraicSphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,13 @@ class AlgebraicSphere : public T
*/
PONCA_MULTIARCH inline VectorType projectDescent (const VectorType& _q, int nbIter = 16) const;

//! \brief Approximation of the scalar field gradient at \f$ \mathbf{q} (not normalized) \f$
/*! \brief Approximation of the scalar field gradient at \f$ \mathbf{q}\f$
\warning The gradient is not normalized by default */
PONCA_MULTIARCH inline VectorType primitiveGradient (const VectorType& _q) const;

/*! \brief Approximation of the scalar field gradient at the evaluation point */
PONCA_MULTIARCH inline VectorType primitiveGradient () const { return m_ul.normalized(); }
/*! \brief Approximation of the scalar field gradient at the evaluation point
\warning The gradient is not normalized by default */
PONCA_MULTIARCH inline const VectorType& primitiveGradient () const { return m_ul; }

/*!
\brief Used to know if the fitting result to a plane
Expand Down
2 changes: 1 addition & 1 deletion tests/src/gls_paraboloid_der.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void testFunction(bool isSigned = true)
// dTau(k) = ( f.tau() - ref_fit.tau() ) / h;

dPotential(k) = ( flip_f*f.potential() - flip_ref * ref_fit.potential() ) / h;
dN.col(k) = ( flip_f*f.primitiveGradient() - flip_ref * ref_fit.primitiveGradient() ) / h;
dN.col(k) = ( flip_f*f.primitiveGradient().normalized() - flip_ref * ref_fit.primitiveGradient().normalized() ) / h;
// dKappa(k) = ( f.kappa() - ref_fit.kappa() ) / h;
}

Expand Down

0 comments on commit cfbe035

Please sign in to comment.