Ponca  292d8d7132745e0d4242ff9a01e93697fc96b204
Point Cloud Analysis library
Loading...
Searching...
No Matches
mlsSphereFitDer.h
1/*
2 This Source Code Form is subject to the terms of the Mozilla Public
3 License, v. 2.0. If a copy of the MPL was not distributed with this
4 file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7#pragma once
8
9#include "../../defines.h"
10#include "../concepts.h"
11
12#define MLS_SPHERE_FIT_DER_REQUIREMENTS \
13 ProvidesAlgebraicSphere<T>&& ProvidesImplicitPrimitiveDerivative<T>&& ProvidesNormal<DataPoint>
14
15namespace Ponca
16{
17
24
25 template <class DataPoint, class _NFilter, int DiffType, typename T>
26 requires MLS_SPHERE_FIT_DER_REQUIREMENTS
27 class MlsSphereFitDer : public T
28 {
29 PONCA_FITTING_DECLARE_DEFAULT_TYPES
30 PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES
31 protected:
32 enum
33 {
34 Dim = DataPoint::Dim,
35 DerDim = Base::NbDerivatives
36 };
37
38 public:
50 using Matrix = Eigen::Matrix<Scalar, DerDim, DerDim>;
51
56
71 using MatrixArray = Eigen::Matrix<Scalar, DerDim, Dim * DerDim>;
72
73 protected:
74 // computation data
75 Matrix m_d2SumDotPN{Matrix::Zero()},
77 m_d2SumDotPP{Matrix::Zero()},
79 m_d2SumW{Matrix::Zero()};
80
81 MatrixArray m_d2SumP{MatrixArray::Zero()},
83 m_d2SumN{MatrixArray::Zero()};
84
85 public:
86 // results
87 Matrix m_d2Uc{Matrix::Zero()},
88 m_d2Uq{Matrix::Zero()};
89 MatrixArray m_d2Ul{MatrixArray::Zero()};
90 public:
91 PONCA_EXPLICIT_BASKET_CAST_OPERATORS_DER(MlsSphereFitDer, mlsSphereFitDer)
92 PONCA_EXPLICIT_BASKET_CAST_OPERATORS_DER(MlsSphereFitDer, implicitPrimitiveDer)
93
94 PONCA_FITTING_DECLARE_INIT_ADDDER_FINALIZE
95
98 PONCA_MULTIARCH [[nodiscard]] inline ScalarArray dPotential() const;
99
101 PONCA_MULTIARCH [[nodiscard]] inline VectorType primitiveGradient() const;
102
104 PONCA_MULTIARCH [[nodiscard]] inline VectorType primitiveGradient(const VectorType& pos) const;
105
107 PONCA_MULTIARCH [[nodiscard]] inline VectorArray dNormal() const;
108
109 PONCA_MULTIARCH [[nodiscard]] inline bool operator==(
110 const MlsSphereFitDer<DataPoint, _NFilter, DiffType, T>& _other) const
111 {
112 return Base::operator==(_other) && internal::isApprox(m_d2SumDotPN, _other.m_d2SumDotPN) &&
113 internal::isApprox(m_d2SumDotPP, _other.m_d2SumDotPP) &&
114 internal::isApprox(m_d2SumW, _other.m_d2SumW) && internal::isApprox(m_d2SumP, _other.m_d2SumP) &&
115 internal::isApprox(m_d2SumN, _other.m_d2SumN) && internal::isApprox(m_d2Uc, _other.m_d2Uc) &&
116 internal::isApprox(m_d2Ul, _other.m_d2Ul) && internal::isApprox(m_d2Uq, _other.m_d2Uq);
117 }
118
119 }; // class MlsSphereFitDer
120
121#include "mlsSphereFitDer.hpp"
122
123} // namespace Ponca
Extension performing derivation of the mls surface.
typename Base::ScalarArray ScalarArray
Alias to scalar derivatives array.
typename Base::VectorArray VectorArray
Alias to vector derivatives array.
Matrix m_d2SumDotPN
Sum of the dot product between relative positions and normals with second-order weight derivatives.
MlsSphereFitDer< DataPoint, _NFilter, DiffType, T > & implicitPrimitiveDer()
Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.
VectorType primitiveGradient() const
Value of the normal of the primitive at the evaluation point.
Matrix m_d2Uc
Second derivative of the hyper-sphere constant term.
Eigen::Matrix< Scalar, DerDim, DerDim > Matrix
Static squared matrix of scalars with a size adapted to the differentiation type.
MatrixArray m_d2SumN
Sum of normal vectors with second-order weight derivatives.
MatrixArray m_d2SumP
Sum of relative positions with second-order weight derivatives.
Matrix m_d2SumDotPP
Sum of the squared relative positions with second-order weight derivatives.
Eigen::Matrix< Scalar, DerDim, Dim *DerDim > MatrixArray
Static matrix of scalars with a size adapted to the differentiation type and the dimension of the amb...
MatrixArray m_d2Ul
Second derivative of the hyper-sphere linear term.
VectorArray dNormal() const
Returns the second derivatives of the scalar field at the evaluation point.
ScalarArray dPotential() const
Returns the derivatives of the scalar field at the evaluation point.
@ Dim
Dimension of the ambient space.
@ DerDim
Number of dimensions used for the differentiation.
typename Base::VectorType VectorType
Alias to vector type.
MlsSphereFitDer< DataPoint, _NFilter, DiffType, T > & mlsSphereFitDer()
Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.
Matrix m_d2SumW
Sum of queries weight with second-order weight derivatives.
Matrix m_d2Uq
Second derivative of the hyper-sphere quadratic term.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition concepts.h:11
DiffType
Flags defining which derivatives need to be computed.
Definition enums.h:34