12#include <Eigen/Geometry>
34 template <
class DataPo
int,
class _NFilter,
typename T>
35 class Plane :
public T,
public Eigen::Hyperplane<typename DataPoint::Scalar, DataPoint::Dim>
37 PONCA_FITTING_DECLARE_DEFAULT_TYPES
41 using EigenBase = Eigen::Hyperplane<typename DataPoint::Scalar, DataPoint::Dim>;
46 check = Base::PROVIDES_PRIMITIVE_BASE,
58 PONCA_MULTIARCH inline
void init()
61 EigenBase::coeffs().setZero();
67 PONCA_MULTIARCH [[nodiscard]]
inline bool isValid()
const
69 return !EigenBase::coeffs().isApprox(EigenBase::Coefficients::Zero());
74 return EigenBase::isApprox(other);
80 return !((*this) == other);
87 PONCA_MULTIARCH
inline void setPlane(
const VectorType& _dir,
const VectorType& _pos)
102 VectorType diff = Base::getNeighborFilter().evalPos() - newbasis;
103 Base::m_nFilter.changeNeighborhoodFrame(newbasis);
105 EigenBase::offset() -= EigenBase::normal().dot(diff);
112 return EigenBase::signedDistance(VectorType::Zero());
120 const VectorType lq = Base::getNeighborFilter().convertToLocalBasis(_q);
128 return Base::getNeighborFilter().convertToGlobalBasis(
129 EigenBase::projection(Base::getNeighborFilter().convertToLocalBasis(_q)));
136 return EigenBase::normal();
143 return EigenBase::normal();
151 return EigenBase::signedDistance(_lq);
156 return EigenBase::normal();
Implicit hyperplane defined by an homogeneous vector .
Eigen::Hyperplane< typename DataPoint::Scalar, DataPoint::Dim > EigenBase
Specialization of Eigen::Hyperplane inherited by Ponca::Plane.
VectorType project(const VectorType &_q) const
Project a point on the plane.
bool isValid() const
Tell if the plane as been correctly set. Used to set CONFLICT_ERROR_FOUND during fitting.
typename Base::VectorType VectorType
Alias to vector type.
VectorType primitiveGradientLocal(const VectorType &) const
Scalar field gradient direction at the evaluation point.
T Base
Base class of the procedure.
Scalar potential(const VectorType &_q) const
Value of the scalar field at the location .
VectorType primitiveGradient(const VectorType &) const
Scalar field gradient direction at .
Scalar potential() const
Value of the scalar field at the evaluation point.
typename DataPoint::Scalar Scalar
Alias to scalar type.
Plane< DataPoint, _NFilter, T > & plane()
Explicit conversion to Plane , to access methods potentially hidden by heritage.
bool operator!=(const Plane< DataPoint, NeighborFilter, T > &other) const
Comparison operator, convenience function.
Plane< DataPoint, _NFilter, T > & compactPlane()
Explicit conversion to Plane , to access methods potentially hidden by heritage.
Plane()
Default constructor.
VectorType primitiveGradient() const
Scalar field gradient direction at the evaluation point.
void changeBasis(const VectorType &newbasis)
Express the scalar field relatively to a new basis.
Scalar potentialLocal(const VectorType &_lq) const
Value of the scalar field at the evaluation point.
void init()
Set the scalar field values to 0.
This Source Code Form is subject to the terms of the Mozilla Public License, v.