#include <MRMeshC/MRBox.h>
#include <MRMeshC/MRMultiwayICP.h>
#include <MRMeshC/MRPointCloud.h>
#include <MRMeshC/MRPointsLoad.h>
#include <MRMeshC/MRPointsSave.h>
#include <MRMeshC/MRString.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int gProgress = -1;
bool onProgress( float v )
{
int progress = (int)( 10.f * v );
if ( progress != gProgress )
{
gProgress = progress;
printf( "%d%%...\n", progress * 10 );
}
return true;
}
void resetProgress( void )
{
gProgress = -1;
}
{
printf( "Samples: %zu\n", numSamples );
printf( "Active point pairs: %zu\n", numActivePairs );
if ( numActivePairs > 0 )
{
printf( "RMS point-to-point distance: %f ± %f\n", p2ptMetric, p2ptInaccuracy );
printf( "RMS point-to-plane distance: %f ± %f\n", p2plMetric, p2plInaccuracy );
}
}
int main( int argc, char* argv[] )
{
int rc = EXIT_FAILURE;
if ( argc < 4 )
{
fprintf( stderr, "Usage: %s INPUT1 INPUT2 [INPUTS...] OUTPUT\n", argv[0] );
goto out;
}
const int inputNum = argc - 2;
for ( int i = 0; i < inputNum; ++i )
{
if ( errorString )
{
fprintf( stderr,
"Failed to load point cloud: %s\n",
mrStringData( errorString ) );
goto out_inputs;
}
maxBBox = bbox;
}
samplingParams.
cb = onProgress;
printStats( icp );
printf( "Calculating transformations...\n" );
resetProgress();
printStats( icp );
for ( int i = 0; i < inputNum; i++ )
{
{
}
}
if ( errorString )
{
fprintf( stderr,
"Failed to save point cloud: %s\n",
mrStringData( errorString ) );
goto out_output;
}
rc = EXIT_SUCCESS;
out_output:
out_xfs:
mrVectorAffineXf3fFree( xfs );
out_icp:
out_inputs:
for ( int i = 0; i < inputNum; i++ )
{
}
free( inputXfs );
free( inputs );
out:
return rc;
}
MRMESHC_API MRVector3f mrAffineXf3fApply(const MRAffineXf3f *xf, const MRVector3f *v)
MRMESHC_API MRBox3f mrBox3fNew(void)
MRMESHC_API float mrBox3fDiagonal(const MRBox3f *box)
MRMESHC_API bool mrBox3fValid(const MRBox3f *box)
MRMESHC_API float mrBox3fVolume(const MRBox3f *box)
MRMESHC_API MRICPProperties mrICPPropertiesNew(void)
struct MRPointCloud MRPointCloud
typedefMR_EXTERN_C_BEGIN struct MRString MRString
struct MRMeshOrPointsXf MRMeshOrPointsXf
MRMESHC_API void mrMeshOrPointsXfFree(MRMeshOrPointsXf *mp)
MRMESHC_API MRMeshOrPointsXf * mrMeshOrPointsXfFromPointCloud(const MRPointCloud *pc, const MRAffineXf3f *xf)
struct MRMultiwayICP MRMultiwayICP
MRMESHC_API MRMultiwayICPSamplingParameters mrMultiwayIcpSamplingParametersNew(void)
MRMESHC_API size_t mrMultiWayICPGetNumSamples(const MRMultiwayICP *mwicp)
MRMESHC_API void mrMultiwayICPFree(MRMultiwayICP *mwicp)
MRMESHC_API bool mrMultiwayICPUpdateAllPointPairs(MRMultiwayICP *mwicp, MRProgressCallback cb)
MRMESHC_API float mrMultiWayICPGetMeanSqDistToPoint(const MRMultiwayICP *mwicp, const double *value)
MRMESHC_API float mrMultiWayICPGetMeanSqDistToPlane(const MRMultiwayICP *mwicp, const double *value)
MRMESHC_API size_t mrMultiWayICPGetNumActivePairs(const MRMultiwayICP *mwicp)
MRMESHC_API size_t mrPointCloudPointsNum(const MRPointCloud *pc)
MR_EXTERN_C_BEGIN MRMESHC_API MRPointCloud * mrPointCloudNew(void)
MRMESHC_API MRBox3f mrPointCloudComputeBoundingBox(const MRPointCloud *pc, const MRAffineXf3f *toWorld)
MRMESHC_API void mrPointCloudFree(MRPointCloud *pc)
MRMESHC_API MRVector3f * mrPointCloudPointsRef(MRPointCloud *pc)
MRMESHC_API MRVertId mrPointCloudAddPoint(MRPointCloud *pc, const MRVector3f *point_)
MRMESHC_API MRPointsLoadSettings mrPointsLoadSettingsNew(void)
MRMESHC_API MRSaveSettings mrSaveSettingsNew(void)
MRMESHC_API void mrStringFree(MRString *str)
MR_EXTERN_C_BEGIN MRMESHC_API const char * mrStringData(const MRString *str)
MRMESHC_API MRMultiwayICP * mrMultiwayICPNew(const MRMeshOrPointsXf *objects, size_t objectsNum, const MRMultiwayICPSamplingParameters *samplingParams)
MRMESHC_API MRPointCloud * mrPointsLoadFromAnySupportedFormat(const char *filename, MRString **errorString)
MRMESHC_API void mrPointsSaveToAnySupportedFormat(const MRPointCloud *pc, const char *file, MRString **errorString)
MRMESHC_API void mrMultiwayICPSetParams(MRMultiwayICP *mwicp, const MRICPProperties *prop)
MRMESHC_API MRVectorAffineXf3f * mrMultiwayICPCalculateTransformations(MRMultiwayICP *mwicp, MRProgressCallback cb)
MRVIEWER_API void point(Element elem, float menuScaling, const Params ¶ms, ImVec2 point)