10#include "../../defines.h"
11#include "../concepts.h"
13#include <Eigen/Geometry>
15#define LINE_REQUIREMENTS ProvidesBasketUnitBase<T>
33 template <
class DataPo
int,
class _NFilter,
typename T>
34 requires LINE_REQUIREMENTS
35 class Line :
public T,
public Eigen::ParametrizedLine<typename DataPoint::Scalar, DataPoint::Dim>
37 PONCA_FITTING_DECLARE_DEFAULT_TYPES
41 using EigenBase = Eigen::ParametrizedLine<typename DataPoint::Scalar, DataPoint::Dim>;
54 EigenBase::origin().setZero();
55 EigenBase::direction().setZero();
63 static const typename EigenBase::VectorType
zeros = EigenBase::VectorType::Zero();
64 return !(EigenBase::origin().isApprox(
zeros) && EigenBase::direction().isApprox(
zeros));
70 return EigenBase::isApprox(
other);
76 return !((*this) ==
other);
95 Base::m_nFilter.changeNeighborhoodFrame(
newbasis);
97 EigenBase::origin() +=
diff;
105 return EigenBase::squaredDistance(VectorType::Zero());
115 const VectorType lq = Base::getNeighborFrame().convertToLocalBasis(
_q);
124 return Base::getNeighborFrame().convertToGlobalBasis(
125 EigenBase::projection(Base::getNeighborFrame().convertToLocalBasis(
_q)));
133 const VectorType lq = Base::getNeighborFrame().convertToLocalBasis(
_q);
134 return primitiveGradientLocal(
lq);
145 return EigenBase::squaredDistance(
_lq);
148 PONCA_MULTIARCH [[
nodiscard]]
inline VectorType primitiveGradientLocal(
const VectorType&
_lq)
const
Aggregator class used to declare specialized structures using CRTP.
A parametrized line is defined by an origin point and a unit direction vector such that the line co...
const VectorType & primitiveGradient() const
Gradient of the scalar field at the line location.
Line< DataPoint, _NFilter, T > & line()
Explicit conversion to Line , to access methods potentially hidden by heritage.
Line< DataPoint, _NFilter, T > & projectionOperator()
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.
VectorType primitiveGradient(const VectorType &_q) const
Approximation of the scalar field gradient at .
Line< DataPoint, _NFilter, T > & implicitPrimitive()
Explicit conversion to Line , to access methods potentially hidden by heritage.
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.
Eigen::ParametrizedLine< typename DataPoint::Scalar, DataPoint::Dim > EigenBase
Specialization of Eigen::ParametrizedLine inherited by Ponca::Line.
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.
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.