9#include "../../defines.h"
10#include "../concepts.h"
14#define HEIGHT_FIELD_REQUIREMENTS Is3D<DataPoint>
15#define QUADRATIC_HEIGHT_FIELD_REQUIREMENTS ProvidesHeightFieldBase<T>&& Is3D<DataPoint>
27 template <
class DataPo
int,
class _NFilter,
typename T>
28 requires HEIGHT_FIELD_REQUIREMENTS
31 PONCA_FITTING_DECLARE_DEFAULT_TYPES
50 return *(_lq.data() + 1);
56 return *(_lq.data() + 1);
62 return *(_lq.data() + 2);
68 return *(_lq.data() + 2);
80 template <
class DataPo
int,
class _NFilter,
typename T>
81 requires QUADRATIC_HEIGHT_FIELD_REQUIREMENTS
84 PONCA_FITTING_DECLARE_DEFAULT_TYPES
85 using HeightFieldCoefficients = Eigen::Matrix<Scalar, 6, 1>;
89 HeightFieldCoefficients
m_coeffs{HeightFieldCoefficients::Zero()};
99 PONCA_MULTIARCH inline
void setQuadric(const HeightFieldCoefficients& coeffs) {
m_coeffs = coeffs; }
101 PONCA_MULTIARCH [[nodiscard]]
inline const HeightFieldCoefficients& coeffs()
const {
return m_coeffs; }
104 PONCA_MULTIARCH
inline void init()
113 PONCA_MULTIARCH [[nodiscard]]
inline bool isValid()
const
115 return !
m_coeffs.isApprox(HeightFieldCoefficients::Zero());
118 PONCA_MULTIARCH [[nodiscard]]
inline bool operator==(
128 return !((*this) == other);
134 return h_uu() * u * u + h_vv() * v * v + h_uv() * u * v + h_u() * u + h_v() * v + h_c();
137 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_uu()
const {
return *(
m_coeffs.data()); }
138 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_vv()
const {
return *(
m_coeffs.data() + 1); }
139 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_uv()
const {
return *(
m_coeffs.data() + 2); }
140 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_u()
const {
return *(
m_coeffs.data() + 3); }
141 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_v()
const {
return *(
m_coeffs.data() + 4); }
142 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_c()
const {
return *(
m_coeffs.data() + 5); }
147 return Scalar(2) * h_uu() * u + h_uv() * v + h_u();
153 return Scalar(2) * h_vv() * v + h_uv() * u + h_v();
159 return Scalar(2) * h_uu();
165 return Scalar(2) * h_vv();
170 PONCA_MULTIARCH [[nodiscard]]
inline Scalar d2h_duv(Scalar u =
Scalar(0), Scalar v =
Scalar(0))
const
176 PONCA_MULTIARCH [[nodiscard]]
inline VectorType heightTangentULocal(
const VectorType& _localQ)
const
178 const Scalar tu =
dh_du(Base::getUFromLocalCoordinates(_localQ), Base::getVFromLocalCoordinates(_localQ));
183 PONCA_MULTIARCH [[nodiscard]]
inline VectorType heightTangentVLocal(
const VectorType& _localQ)
const
185 const Scalar tv =
dh_dv(Base::getUFromLocalCoordinates(_localQ), Base::getVFromLocalCoordinates(_localQ));
200 template <
class DataPo
int,
class _NFilter,
typename T>
201 requires QUADRATIC_HEIGHT_FIELD_REQUIREMENTS
204 PONCA_FITTING_DECLARE_DEFAULT_TYPES
205 using HeightFieldCoefficients = Eigen::Matrix<Scalar, 4, 1>;
209 HeightFieldCoefficients
m_coeffs{HeightFieldCoefficients::Zero()};
221 PONCA_MULTIARCH [[nodiscard]]
inline const HeightFieldCoefficients& coeffs()
const {
return m_coeffs; }
224 PONCA_MULTIARCH
inline void init()
233 PONCA_MULTIARCH [[nodiscard]]
inline bool isValid()
const
235 return !
m_coeffs.isApprox(HeightFieldCoefficients::Zero());
238 PONCA_MULTIARCH [[nodiscard]]
inline bool operator==(
248 return !((*this) == other);
252 template <
typename Other>
253 PONCA_MULTIARCH [[nodiscard]]
inline bool isApprox(
254 const Other& other,
const Scalar& epsilon = Eigen::NumTraits<Scalar>::dummy_precision())
const
256 return m_coeffs.isApprox(other.m_params, epsilon);
262 return h_uu() * u * u + h_vv() * v * v + h_uv() * u * v + h_c();
265 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_uu()
const {
return *(
m_coeffs.data()); }
266 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_vv()
const {
return *(
m_coeffs.data() + 1); }
267 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_uv()
const {
return *(
m_coeffs.data() + 2); }
268 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_c()
const {
return *(
m_coeffs.data() + 3); }
273 return Scalar(2) * h_uu() * u + h_uv() * v;
279 return Scalar(2) * h_vv() * v + h_uv() * u;
285 return Scalar(2) * h_uu();
291 return Scalar(2) * h_vv();
296 PONCA_MULTIARCH [[nodiscard]]
inline Scalar d2h_duv(Scalar u =
Scalar(0), Scalar v =
Scalar(0))
const
302 PONCA_MULTIARCH [[nodiscard]]
inline VectorType heightTangentULocal(
const VectorType& _localQ)
const
304 const Scalar tu =
dh_du(Base::getUFromLocalCoordinates(_localQ), Base::getVFromLocalCoordinates(_localQ));
309 PONCA_MULTIARCH [[nodiscard]]
inline VectorType heightTangentVLocal(
const VectorType& _localQ)
const
311 const Scalar tv =
dh_dv(Base::getUFromLocalCoordinates(_localQ), Base::getVFromLocalCoordinates(_localQ));
Internal base classe for height fields.
HeightField< DataPoint, _NFilter, T > & heightFieldBase()
Explicit conversion to HeightField , to access methods potentially hidden by heritage.
Scalar & getVFromLocalCoordinates(VectorType &_lq)
get access to v from local coordinate vector
const Scalar & getVFromLocalCoordinates(const VectorType &_lq) const
get access to v from local coordinate vector
typename DataPoint::Scalar Scalar
Alias to scalar type.
Scalar & getUFromLocalCoordinates(VectorType &_lq) const
get access to u from local coordinate vector
typename Base::VectorType VectorType
Alias to vector type.
const Scalar & getHFromLocalCoordinates(const VectorType &_lq) const
get access to height from local coordinate vector
Scalar & getHFromLocalCoordinates(VectorType &_lq) const
get access to height from local coordinate vector
const Scalar & getUFromLocalCoordinates(const VectorType &_lq) const
get access to u from local coordinate vector
Quadratic height field defined as .
typename Base::VectorType VectorType
Alias to vector type.
QuadraticHeightField< DataPoint, _NFilter, T > & heightField()
Explicit conversion to QuadraticHeightField , to access methods potentially hidden by heritage.
void setQuadric(const HeightFieldCoefficients &coeffs)
Set the scalar field values.
typename DataPoint::Scalar Scalar
Alias to scalar type.
void init()
Set the scalar field values to 0.
bool isValid() const
Tell if the plane as been correctly set. Used to set CONFLICT_ERROR_FOUND during fitting.
HeightFieldCoefficients m_coeffs
Quadric parameters, stored as .
QuadraticHeightField()
Default constructor.
Scalar dh_du(Scalar u=Scalar(0), Scalar v=Scalar(0)) const
Partial derivative .
T Base
Base class of the procedure.
Scalar dh_dv(Scalar u=Scalar(0), Scalar v=Scalar(0)) const
Partial derivative .
Scalar d2h_dvv(Scalar u=Scalar(0), Scalar v=Scalar(0)) const
Second order partial derivative .
bool operator!=(const QuadraticHeightField< DataPoint, _NFilter, T > &other) const
Comparison operator, convenience function.
Scalar height(Scalar u, Scalar v) const
Height value at local uv.
QuadraticHeightField< DataPoint, _NFilter, T > & quadraticHeightField()
Explicit conversion to QuadraticHeightField , to access methods potentially hidden by heritage.
Scalar d2h_duu(Scalar u=Scalar(0), Scalar v=Scalar(0)) const
Second order partial derivative .
Quadratic height field defined as .
Scalar d2h_dvv(Scalar u=Scalar(0), Scalar v=Scalar(0)) const
Second order partial derivative .
Scalar d2h_duu(Scalar u=Scalar(0), Scalar v=Scalar(0)) const
Second order partial derivative .
Scalar dh_du(Scalar u=Scalar(0), Scalar v=Scalar(0)) const
Partial derivative .
void setQuadric(const HeightFieldCoefficients &coeffs)
Set the scalar field values.
Scalar dh_dv(Scalar u=Scalar(0), Scalar v=Scalar(0)) const
Partial derivative .
Scalar height(Scalar u, Scalar v) const
Height value at local uv.
T Base
Base class of the procedure.
RestrictedQuadraticHeightField()
Default constructor.
QuadraticHeightField< DataPoint, _NFilter, T > & heightField()
Explicit conversion to QuadraticHeightField , to access methods potentially hidden by heritage.
bool isApprox(const Other &other, const Scalar &epsilon=Eigen::NumTraits< Scalar >::dummy_precision()) const
Approximate comparison operator operator.
void init()
Set the scalar field values to 0.
RestrictedQuadraticHeightField< DataPoint, _NFilter, T > & quadraticHeightField()
Explicit conversion to RestrictedQuadraticHeightField , to access methods potentially hidden by herit...
bool isValid() const
Tell if the plane as been correctly set. Used to set CONFLICT_ERROR_FOUND during fitting.
typename DataPoint::Scalar Scalar
Alias to scalar type.
HeightFieldCoefficients m_coeffs
Quadric parameters, stored as .
bool operator!=(const RestrictedQuadraticHeightField< DataPoint, _NFilter, T > &other) const
Comparison operator, convenience function.
typename Base::VectorType VectorType
Alias to vector type.
This Source Code Form is subject to the terms of the Mozilla Public License, v.