This is an example of how to instantiate the PointConcept in order to use Ponca on existing data structures without any memory duplication.
We apply exactly the same processing than in Ponca basic CPU, but this time by taking an interlaced raw buffer as input.
#include <iostream>
#include <Ponca/src/Fitting/basket.h>
#include <Ponca/src/Fitting/gls.h>
#include <Ponca/src/Fitting/orientedSphereFit.h>
#include <Ponca/src/Fitting/weightFunc.h>
#include <Ponca/src/Fitting/weightKernel.h>
#include <Ponca/src/Common/pointTypes.h>
#include "Eigen/Eigen"
using namespace std;
#define DIMENSION 3
using Scalar = MyPoint::Scalar;
using VectorType = MyPoint::VectorType;
template <typename Fit>
{
for (
int i = 0;
i !=
_n;
i++)
{
}
{
cout <<
"Center: [" <<
_fit.center().transpose() <<
"] ; radius: " <<
_fit.radius() <<
endl;
cout <<
"Pratt normalization" << (
_fit.applyPrattNorm() ?
" is now done." :
" has already been applied.")
cout <<
"Value of the scalar field at the initial point: " <<
_p.transpose() <<
" is equal to "
cout <<
"It's gradient at this place is equal to: " <<
_fit.primitiveGradient(
_p).transpose() <<
endl;
<<
"\t Eta : " <<
_fit.eta().transpose() <<
endl
<<
"\t Kappa: " <<
_fit.kappa() <<
endl;
cout <<
"The initial point " <<
_p.transpose() <<
endl
<<
"Is projected at " <<
_fit.project(
_p).transpose() <<
endl;
}
}
{
for (
int k = 0; k <
_n; ++k)
{
const Eigen::Matrix<Scalar, DIMENSION, 1>
nvec = Eigen::Matrix<Scalar, DIMENSION, 1>::Random().normalized();
const Eigen::Matrix<Scalar, DIMENSION, 1>
pvec =
nvec * Eigen::internal::random<Scalar>(0.9, 1.1);
}
}
{
constexpr int n = 1000;
}
Aggregator class used to declare specialized structures using CRTP.
bool addNeighbor(const DataPoint &_nei)
Add a neighbor to perform the fit.
This Source Code Form is subject to the terms of the Mozilla Public License, v.