13#include <Eigen/Geometry>
33template <
class DataPo
int,
class _NFilter,
typename T >
35 public Eigen::ParametrizedLine<typename DataPoint::Scalar, DataPoint::Dim >
37PONCA_FITTING_DECLARE_DEFAULT_TYPES
41 using EigenBase = Eigen::ParametrizedLine<typename DataPoint::Scalar, DataPoint::Dim >;
47 check = Base::PROVIDES_PRIMITIVE_BASE,
57 PONCA_MULTIARCH inline
void init()
60 EigenBase::origin().setZero();
61 EigenBase::direction().setZero();
67 PONCA_MULTIARCH [[nodiscard]]
inline bool isValid()
const{
68 static const typename EigenBase::VectorType zeros = EigenBase::VectorType::Zero();
69 return ! ( EigenBase::origin().isApprox(zeros) && EigenBase::direction().isApprox(zeros) ) ;
74 return EigenBase::isApprox(other);
79 return ! ((*this) == other);
98 VectorType diff = Base::getNeighborFilter().evalPos() - newbasis;
99 Base::getNeighborFilter().changeNeighborhoodFrame(newbasis);
101 EigenBase::origin() += diff;
109 return EigenBase::squaredDistance(VectorType::Zero());
119 const VectorType lq = Base::getNeighborFilter().convertToLocalBasis(_q);
128 return Base::getNeighborFilter().convertToGlobalBasis(EigenBase::projection(Base::getNeighborFilter().convertToLocalBasis(_q)));
134 return EigenBase::squaredDistance(_lq);
A parametrized line is defined by an origin point and a unit direction vector such that the line co...
Line< DataPoint, _NFilter, T > & line()
Explicit conversion to Line , to access methods potentially hidden by heritage.
Scalar potentialLocal(const VectorType &_lq) const
Value of the scalar field at the evaluation point.
Scalar potential() const
Value of the scalar field at the evaluation point.
void changeBasis(const VectorType &newbasis)
Express the line relatively to a new basis.
void init()
Set the scalar field values to 0 and reset the distance() and origin() status.
bool operator==(const Line< DataPoint, NeighborFilter, T > &other) const
Comparison operator.
Eigen::ParametrizedLine< typename DataPoint::Scalar, DataPoint::Dim > EigenBase
Specialization of Eigen::ParametrizedLine inherited by Ponca::Line.
VectorType project(const VectorType &_q) const
Project a point on the line.
Scalar potential(const VectorType &_q) const
Value of the scalar field at the location , defined as the squared distance between and the line.
void setLine(const VectorType &origin, const VectorType &direction)
Init the line from a direction and a position.
typename DataPoint::Scalar Scalar
Alias to scalar type.
bool operator!=(const Line< DataPoint, NeighborFilter, T > &other) const
Comparison operator, convenience function.
typename Base::VectorType VectorType
Alias to vector type.
@ PROVIDES_LINE
Provides Line.
@ check
Requires PrimitiveBase.
bool isValid() const
Tell if the line as been correctly set. Used to set CONFLICT_ERROR_FOUND during fitting.
This Source Code Form is subject to the terms of the Mozilla Public License, v.