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");
35 {
return *(_lq.data()); }
39 {
return *(_lq.data()); }
43 {
return *(_lq.data()+1); }
47 {
return *(_lq.data()+1); }
51 {
return *(_lq.data()+2); }
55 {
return *(_lq.data()+2); }
66 template <
class DataPo
int,
class _NFilter,
typename T >
69 PONCA_FITTING_DECLARE_DEFAULT_TYPES
70 using HeightFieldCoefficients = Eigen::Matrix<Scalar,6,1>;
71 static_assert ( DataPoint::Dim == 3,
"QuadraticHeightField is only valid in 3D");
75 Check = Base::PROVIDES_HEIGHTFIELD,
79 HeightFieldCoefficients
m_coeffs {HeightFieldCoefficients::Zero()};
89 PONCA_MULTIARCH inline
void setQuadric(const HeightFieldCoefficients& coeffs) {
m_coeffs = coeffs; }
91 PONCA_MULTIARCH [[nodiscard]]
inline const HeightFieldCoefficients& coeffs()
const {
return m_coeffs; }
94 PONCA_MULTIARCH
inline void init()
103 PONCA_MULTIARCH [[nodiscard]]
inline bool isValid()
const{
104 return !
m_coeffs.isApprox(HeightFieldCoefficients::Zero());
108 return m_coeffs.isApprox(other.m_params);
113 return ! ((*this) == other);
118 return h_uu()*u*u + h_vv()*v*v + h_uv()*u*v + h_u()*u + h_v()*v + h_c();
121 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar & h_uu ()
const {
return *(
m_coeffs.data()); }
122 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar & h_vv ()
const {
return *(
m_coeffs.data()+1); }
123 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar & h_uv ()
const {
return *(
m_coeffs.data()+2); }
124 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar & h_u ()
const {
return *(
m_coeffs.data()+3); }
125 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar & h_v ()
const {
return *(
m_coeffs.data()+4); }
126 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar & h_c ()
const {
return *(
m_coeffs.data()+5); }
130 {
return Scalar(2)*h_uu() * u + h_uv()*v + h_u(); }
134 {
return Scalar(2)*h_vv() * v + h_uv()*u + h_v(); }
138 {
return Scalar(2)*h_uu(); }
142 {
return Scalar(2)*h_vv(); }
150 const Scalar tu =
dh_du(Base::getUFromLocalCoordinates(_localQ), Base::getVFromLocalCoordinates(_localQ));
156 const Scalar tv =
dh_dv(Base::getUFromLocalCoordinates(_localQ), Base::getVFromLocalCoordinates(_localQ));
171 template <
class DataPo
int,
class _NFilter,
typename T >
174 PONCA_FITTING_DECLARE_DEFAULT_TYPES
175 using HeightFieldCoefficients = Eigen::Matrix<Scalar,4,1>;
176 static_assert ( DataPoint::Dim == 3,
"QuadraticHeightField is only valid in 3D");
180 Check = Base::PROVIDES_HEIGHTFIELD,
184 HeightFieldCoefficients
m_coeffs {HeightFieldCoefficients::Zero()};
196 PONCA_MULTIARCH [[nodiscard]]
inline const HeightFieldCoefficients& coeffs()
const {
return m_coeffs; }
199 PONCA_MULTIARCH
inline void init()
208 PONCA_MULTIARCH [[nodiscard]]
inline bool isValid()
const{
209 return !
m_coeffs.isApprox(HeightFieldCoefficients::Zero());
213 return m_coeffs.isApprox(other.m_params);
218 return ! ((*this) == other);
223 return h_uu()*u*u + h_vv()*v*v + h_uv()*u*v + h_c();
226 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar & h_uu ()
const {
return *(
m_coeffs.data()); }
227 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar & h_vv ()
const {
return *(
m_coeffs.data()+1); }
228 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar & h_uv ()
const {
return *(
m_coeffs.data()+2); }
229 PONCA_MULTIARCH [[nodiscard]]
inline const Scalar & h_c ()
const {
return *(
m_coeffs.data()+3); }
233 {
return Scalar(2)*h_uu() * u + h_uv()*v; }
237 {
return Scalar(2)*h_vv() * v + h_uv()*u ; }
241 {
return Scalar(2)*h_uu(); }
245 {
return Scalar(2)*h_vv(); }
253 const Scalar tu =
dh_du(Base::getUFromLocalCoordinates(_localQ), Base::getVFromLocalCoordinates(_localQ));
259 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.
Scalar d2h_duv(Scalar u=Scalar(0), Scalar v=Scalar(0)) const
Second order partial derivative .
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.
VectorType heightTangentULocal(const VectorType &_localQ) const
Local tangent vector in the direction of .
Scalar d2h_duu(Scalar u=Scalar(0), Scalar v=Scalar(0)) const
Second order partial derivative .
@ PROVIDES_QUADRIC_HEIGHTFIELD
Provides quadric heightfield API.
VectorType heightTangentVLocal(const VectorType &_localQ) const
Local tangent vector in the direction of .
Quadratic height field defined as .
VectorType heightTangentULocal(const VectorType &_localQ) const
Local tangent vector in the direction of .
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.
VectorType heightTangentVLocal(const VectorType &_localQ) const
Local tangent vector in the direction of .
Scalar d2h_duv(Scalar u=Scalar(0), Scalar v=Scalar(0)) const
Second order partial derivative .
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.