13#include <Eigen/Geometry>
33template <
class DataPo
int,
class _WFunctor,
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,
59 Base::init(_basisCenter);
60 EigenBase::origin().setZero();
61 EigenBase::direction().setZero();
67 PONCA_MULTIARCH
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 return EigenBase::squaredDistance(VectorType::Zero());
108 return EigenBase::squaredDistance(Base::m_w.convertToLocalBasis(_q));
115 return Base::m_w.convertToGlobalBasis(EigenBase::projection(Base::m_w.convertToLocalBasis(_q)));
A parametrized line is defined by an origin point and a unit direction vector such that the line co...
void setLine(const VectorType &origin, const VectorType &direction)
Init the line from a direction and a position.
bool isValid() const
Tell if the line as been correctly set. Used to set CONFLICT_ERROR_FOUND during fitting.
Eigen::ParametrizedLine< typename DataPoint::Scalar, DataPoint::Dim > EigenBase
Specialization of Eigen::ParametrizedLine inherited by Ponca::Line.
typename Base::VectorType VectorType
Alias to vector type.
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 init(const VectorType &_basisCenter=VectorType::Zero())
Set the scalar field values to 0 and reset the distance() and origin() status.
typename DataPoint::Scalar Scalar
Alias to scalar type.
Scalar potential() const
Value of the scalar field at the evaluation point.
bool operator==(const Line< DataPoint, WFunctor, T > &other) const
Comparison operator.
bool operator!=(const Line< DataPoint, WFunctor, T > &other) const
Comparison operator, convenience function.
@ PROVIDES_LINE
Provides Line.
@ check
Requires PrimitiveBase.
Line< DataPoint, _WFunctor, T > & line()
Explicit conversion to Line , to access methods potentially hidden by heritage.
This Source Code Form is subject to the terms of the Mozilla Public License, v.