8#include "../../defines.h"
9#include "../concepts.h"
11#include "../extensions/heightField.h"
12#include "../extensions/weingarten.h"
15#include PONCA_MULTIARCH_INCLUDE_STD(cmath)
19#define MONGE_PATCH_REQUIREMENTS ProvidesTangentPlaneBasis<T>&& ProvidesHeightField<T>&& Is3D<DataPoint>
20#define MONGE_PATCH_FIT_REQUIREMENTS ProvidesImplicitPrimitive<T>&& ProvidesMongePatch<T>
40 template <
class DataPo
int,
class _NFilter,
typename T>
41 requires MONGE_PATCH_REQUIREMENTS
44 PONCA_FITTING_DECLARE_DEFAULT_TYPES
61 const VectorType x = Base::worldToTangentPlane(_q);
62 return Base::height(Base::getUFromLocalCoordinates(x), Base::getVFromLocalCoordinates(x)) -
63 Base::getHFromLocalCoordinates(x);
72 Base::getHFromLocalCoordinates(x) =
73 Base::height(Base::getUFromLocalCoordinates(x), Base::getVFromLocalCoordinates(x));
74 return Base::tangentPlaneToWorld(x);
91 const VectorType& _localQ = VectorType::Zero())
const
93 VectorType uVect = Base::heightTangentULocal(_localQ);
94 VectorType vVect = Base::heightTangentVLocal(_localQ);
96 VectorType crossN = uVect.normalized().cross(vVect.normalized());
97 return Base::heightTangentULocal(_localQ).cross(Base::heightTangentVLocal(_localQ));
100 PONCA_MULTIARCH
inline void firstFundamentalFormComponents(Scalar& E, Scalar& F, Scalar& G)
const
102 PONCA_MULTIARCH_STD_MATH(sqrt);
103 const VectorType fu{Base::dh_du(),
Scalar(1),
Scalar(0)};
104 const VectorType fv{Base::dh_dv(),
Scalar(0),
Scalar(1)};
110 PONCA_MULTIARCH
inline void secondFundamentalFormComponents(
Scalar& L,
Scalar& M,
Scalar& N)
const
112 PONCA_MULTIARCH_STD_MATH(sqrt);
132 template <
class DataPo
int,
class _NFilter,
typename T>
133 requires MONGE_PATCH_FIT_REQUIREMENTS
136 PONCA_FITTING_DECLARE_MULTIPASS_TYPES
139 using SampleMatrix = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>;
140 using QuadraticHeightFieldCoefficients =
typename Base::HeightFieldCoefficients;
145 QuadraticHeightFieldCoefficients
m_b{QuadraticHeightFieldCoefficients::Zero()};
148 PONCA_FITTING_DECLARE_INIT_ADD_FINALIZE
150 PONCA_MULTIARCH [[nodiscard]]
inline bool operator==(
153 return Base::operator==(_other) && internal::isApprox(
m_A, _other.
m_A) &&
154 internal::isApprox(
m_b, _other.
m_b);
165 template <
class DataPo
int,
class _NFilter,
typename T>
166 requires MONGE_PATCH_FIT_REQUIREMENTS
169 PONCA_FITTING_DECLARE_MULTIPASS_TYPES
172 using SampleMatrix = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>;
173 using QuadraticHeightFieldCoefficients =
typename Base::HeightFieldCoefficients;
177 QuadraticHeightFieldCoefficients
m_b{QuadraticHeightFieldCoefficients::Zero()};
180 PONCA_FITTING_DECLARE_INIT_ADD_FINALIZE
182 PONCA_MULTIARCH [[nodiscard]]
inline bool operator==(
185 return Base::operator==(_other) && internal::isApprox(
m_A, _other.
m_A) &&
186 internal::isApprox(
m_b, _other.
m_b);
190 template <
class DataPo
int,
class _NFilter,
typename T>
191 using MongePatchQuadraticFit = WeingartenCurvatureEstimator<
193 FundamentalFormWeingartenEstimator<
195 MongePatchQuadraticFitImpl<
197 MongePatch<DataPoint, _NFilter,
198 QuadraticHeightField<
200 HeightField<DataPoint, _NFilter, CovariancePlaneFit<DataPoint, _NFilter, T>>>>>>>;
202 template <
class DataPo
int,
class _NFilter,
typename T>
203 using MongePatchRestrictedQuadraticFit = WeingartenCurvatureEstimator<
205 FundamentalFormWeingartenEstimator<
207 MongePatchRestrictedQuadraticFitImpl<
209 MongePatch<DataPoint, _NFilter,
210 RestrictedQuadraticHeightField<
212 HeightField<DataPoint, _NFilter, CovariancePlaneFit<DataPoint, _NFilter, T>>>>>>>;
214#include "mongePatch.hpp"
Extension to compute the best fit quadric on 3d points expressed as .
MongePatchQuadraticFitImpl< DataPoint, _NFilter, T > & mongePatchQuadraticFit()
Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.
SampleMatrix m_A
Quadric input samples.
QuadraticHeightFieldCoefficients m_b
Observations.
Extension to compute the best fit restricted quadric on 3d points expressed as .
MongePatchRestrictedQuadraticFitImpl< DataPoint, _NFilter, T > & mongePatchQuadraticFit()
Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.
QuadraticHeightFieldCoefficients m_b
Observations.
SampleMatrix m_A
Quadric input samples.
typename DataPoint::Scalar Scalar
Alias to scalar type.
typename Base::VectorType VectorType
Alias to vector type.
typename Base::VectorType VectorType
Alias to vector type.
typename DataPoint::Scalar Scalar
Alias to scalar type.
VectorType primitiveGradient(const VectorType &_q) const
Scalar field gradient direction at .
VectorType primitiveGradient() const
Scalar field gradient direction at the basis center.
MongePatch< DataPoint, _NFilter, T > & mongePatchPrimitive()
Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.
VectorType primitiveGradientLocal(const VectorType &_localQ=VectorType::Zero()) const
Scalar field gradient direction, both input and output vectors are expressed in the local basis.
VectorType project(const VectorType &_q) const
Orthogonal projection on the patch.
MongePatch()
Default constructor.
MongePatch< DataPoint, _NFilter, T > & secondFondamentalFormComponent()
Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.
MongePatch< DataPoint, _NFilter, T > & firstFondamentalFormComponent()
Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.
Scalar potential() const
Value of the scalar field at the evaluation point.
T Base
Base class of the procedure.
MongePatch< DataPoint, _NFilter, T > & implicitPrimitive()
Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.
This Source Code Form is subject to the terms of the Mozilla Public License, v.