23 template <
class DataPo
int,
class _NFilter,
typename T>
26 PONCA_FITTING_DECLARE_DEFAULT_TYPES
27 static_assert(DataPoint::Dim == 3,
"HeightField is only valid in 3D");
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>
83 PONCA_FITTING_DECLARE_DEFAULT_TYPES
84 using HeightFieldCoefficients = Eigen::Matrix<Scalar, 6, 1>;
85 static_assert(DataPoint::Dim == 3,
"QuadraticHeightField is only valid in 3D");
90 Check = Base::PROVIDES_HEIGHTFIELD,
94 HeightFieldCoefficients
m_coeffs{HeightFieldCoefficients::Zero()};
105 PONCA_MULTIARCH [[nodiscard]]
inline const HeightFieldCoefficients& coeffs()
const {
return m_coeffs; }
108 PONCA_MULTIARCH
inline void init()
117 PONCA_MULTIARCH [[nodiscard]]
inline bool isValid()
const
119 return !
m_coeffs.isApprox(HeightFieldCoefficients::Zero());
122 PONCA_MULTIARCH [[nodiscard]]
inline bool operator==(
125 return m_coeffs.isApprox(other.m_params);
132 return !((*this) == other);
138 return h_uu() * u * u + h_vv() * v * v + h_uv() * u * v + h_u() * u + h_v() * v + h_c();
141 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_uu()
const {
return *(
m_coeffs.data()); }
142 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_vv()
const {
return *(
m_coeffs.data() + 1); }
143 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_uv()
const {
return *(
m_coeffs.data() + 2); }
144 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_u()
const {
return *(
m_coeffs.data() + 3); }
145 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_v()
const {
return *(
m_coeffs.data() + 4); }
146 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar& h_c()
const {
return *(
m_coeffs.data() + 5); }
151 return Scalar(2) * h_uu() * u + h_uv() * v + h_u();
157 return Scalar(2) * h_vv() * v + h_uv() * u + h_v();
163 return Scalar(2) * h_uu();
169 return Scalar(2) * h_vv();
174 PONCA_MULTIARCH [[nodiscard]]
inline Scalar d2h_duv(Scalar u =
Scalar(0), Scalar v =
Scalar(0))
const
180 PONCA_MULTIARCH [[nodiscard]]
inline VectorType heightTangentULocal(
const VectorType& _localQ)
const
182 const Scalar tu =
dh_du(Base::getUFromLocalCoordinates(_localQ), Base::getVFromLocalCoordinates(_localQ));
187 PONCA_MULTIARCH [[nodiscard]]
inline VectorType heightTangentVLocal(
const VectorType& _localQ)
const
189 const Scalar tv =
dh_dv(Base::getUFromLocalCoordinates(_localQ), Base::getVFromLocalCoordinates(_localQ));
204 template <
class DataPo
int,
class _NFilter,
typename T>
207 PONCA_FITTING_DECLARE_DEFAULT_TYPES
208 using HeightFieldCoefficients = Eigen::Matrix<Scalar, 4, 1>;
209 static_assert(DataPoint::Dim == 3,
"QuadraticHeightField is only valid in 3D");
214 Check = Base::PROVIDES_HEIGHTFIELD,
218 HeightFieldCoefficients
m_coeffs{HeightFieldCoefficients::Zero()};
229 PONCA_MULTIARCH [[nodiscard]]
inline const HeightFieldCoefficients& coeffs()
const {
return m_coeffs; }
232 PONCA_MULTIARCH
inline void init()
241 PONCA_MULTIARCH [[nodiscard]]
inline bool isValid()
const
243 return !
m_coeffs.isApprox(HeightFieldCoefficients::Zero());
246 PONCA_MULTIARCH [[nodiscard]]
inline bool operator==(
249 return m_coeffs.isApprox(other.m_params);
256 return !((*this) == other);
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.
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
@ PROVIDES_HEIGHTFIELD
Provides generic heightfield API.
Quadratic height field defined as .
typename Base::VectorType VectorType
Alias to vector type.
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 .
@ PROVIDES_QUADRIC_HEIGHTFIELD
Provides quadric heightfield API.
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.
@ PROVIDES_RESTRICTED_QUADRIC_HEIGHTFIELD
Provides quadric heightfield API.
RestrictedQuadraticHeightField()
Default constructor.
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.