#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <Ponca/Ponca>
using namespace std;
using Scalar = MyPoint::Scalar;
using VectorType = MyPoint::VectorType;
template <typename Fit>
void test_fit(Fit& _fit, vector<MyPoint>& _vecs, const VectorType& _p)
{
Scalar tmax = 100.0;
_fit.setNeighborFilter({_p, tmax});
_fit.
compute(_vecs.begin(), _vecs.end());
if (_fit.isStable())
{
cout << "Value of the scalar field at the initial point: " << _p.transpose() << " is equal to "
<< _fit.potential(_p) << endl;
cout << "It's gradient at this place is equal to: " << _fit.primitiveGradient(_p).transpose() << endl;
cout << "The initial point " << _p.transpose() << endl
<< "Is projected at " << _fit.project(_p).transpose() << endl;
cout << "Value of the surface variation: " << _fit.surfaceVariation() << endl;
}
}
int main()
{
int n = 10000;
vector<MyPoint> vecs(n);
std::generate(vecs.begin(), vecs.end(), getRandomPoint<MyPoint>);
std::cout << "====================\nCovariancePlaneFit:\n";
CovPlaneFit fit;
test_fit(fit, vecs, vecs.at(0).pos());
}
Aggregator class used to declare specialized structures using CRTP.
Weight neighbors according to the Euclidean distance between a query and a reference position.
Point data type containing the position and normal vectors.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
FIT_RESULT compute(const IteratorBegin &begin, const IteratorEnd &end)
Convenience function for STL-like iterators Add neighbors stored in a container using STL-like iterat...