#include <MRMesh/MRBox.h>
#include <MRMesh/MRICP.h>
#include <MRMesh/MRMesh.h>
#include <MRMesh/MRMeshLoad.h>
#include <MRMesh/MRMeshSave.h>
#include <iostream>
{
if ( !meshFloatingRes.has_value() )
{
std::cerr << meshFloatingRes.error() << std::endl;
return 1;
}
MR::Mesh& meshFloating = *meshFloatingRes;
if ( !meshFixedRes.has_value() )
{
std::cerr << meshFixedRes.error() << std::endl;
return 1;
}
float diagonal = meshFixed.getBoundingBox().diagonal();
float icpSamplingVoxelSize = diagonal * 0.01f;
icpParams.distThresholdSq =
MR::sqr( diagonal * 0.1f );
icpParams.exitVal = diagonal * 0.003f;
MR::AffineXf3f(), MR::AffineXf3f(),
icpSamplingVoxelSize );
icp.setParams( icpParams );
MR::AffineXf3f xf = icp.calculateTransformation();
meshFloating.transform( xf );
std::string info = icp.getStatusInfo();
std::cerr << info << std::endl;
{
std::cerr << saveRes.error() << std::endl;
return 1;
}
}
MRMESH_API Expected< Mesh > fromAnySupportedFormat(const std::filesystem::path &file, const MeshLoadSettings &settings={})
MRMESH_API Expected< void > toAnySupportedFormat(const Mesh &mesh, const std::filesystem::path &file, const SaveSettings &settings={})
constexpr T sqr(T x) noexcept