Commit 3325ded7 authored by Nicolas Mellado's avatar Nicolas Mellado

Add PROVIDES_TANGENT_PLANE_BASIS in CovariancePlaneFit + methods

parent eadb7073
......@@ -37,7 +37,14 @@ private:
protected:
enum
{
Check = Base::PROVIDES_PLANE
Check = Base::PROVIDES_PLANE,
/*!
* \brief Expose a method worldToTangentPlane(VectorType), which turns a point
* in ambient 3D space to the tangent plane.
* \see worldToTangentPlane
* \see tangentPlaneToWorld
*/
PROVIDES_TANGENT_PLANE_BASIS
};
public:
......@@ -111,6 +118,18 @@ public:
\return 0 for invalid fits
*/
MULTIARCH inline Scalar surfaceVariation() const;
/*!
* \brief Express a point in ambiant space relatively to the tangent plane.
* Output vector is: [h, u, v]^T, where u, v are 2d coordinates on the plane,
* and h the height of the sample.
*/
MULTIARCH inline VectorType worldToTangentPlane(const VectorType &_q) const;
/*!
* \brief Transform a point from the tangent plane [h, u, v]^T to ambiant space
*/
MULTIARCH inline VectorType tangentPlaneToWorld(const VectorType &_q) const;
}; //class CovariancePlaneFit
namespace internal {
......
......@@ -91,6 +91,22 @@ CovariancePlaneFit<DataPoint, _WFunctor, T>::surfaceVariation () const
return m_solver.eigenvalues()(0) / m_solver.eigenvalues().mean();
}
template < class DataPoint, class _WFunctor, typename T>
typename CovariancePlaneFit<DataPoint, _WFunctor, T>::VectorType
CovariancePlaneFit<DataPoint, _WFunctor, T>::worldToTangentPlane (const VectorType& _q) const
{
return m_solver.eigenvectors().transpose() * (_q - m_evalPos);
}
template < class DataPoint, class _WFunctor, typename T>
typename CovariancePlaneFit<DataPoint, _WFunctor, T>::VectorType
CovariancePlaneFit<DataPoint, _WFunctor, T>::tangentPlaneToWorld (const VectorType& _lq) const
{
return m_solver.eigenvectors().transpose().inverse() * _lq + m_evalPos;
}
namespace internal
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment