MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / main

Function main

examples/cpp-examples/Fusion.dox.cpp:10–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include <iostream>
9
10int main()
11{
12 // load points
13 auto loadRes = MR::PointsLoad::fromAnySupportedFormat( "Points.ply" );
14 if ( !loadRes.has_value() )
15 {
16 std::cerr << loadRes.error() << "\n";
17 return 1; // error while loading file
18 }
19
20 MR::PointsToMeshParameters params;
21 params.voxelSize = loadRes->computeBoundingBox().diagonal() * 1e-2f;
22 params.sigma = std::max( params.voxelSize, MR::findAvgPointsRadius( *loadRes, 50 ) );
23 params.minWeight = 1.0f;
24
25 auto fusionRes = MR::pointsToMeshFusion( *loadRes, params );
26 if ( !fusionRes.has_value() )
27 {
28 std::cerr << fusionRes.error() << "\n";
29 return 1; // error while saving file
30 }
31
32 auto saveRes = MR::MeshSave::toAnySupportedFormat( *fusionRes, "Mesh.ctm" );
33 if ( !saveRes.has_value() )
34 {
35 std::cerr << saveRes.error() << "\n";
36 return 1; // error while saving file
37 }
38 return 0;
39}

Callers

nothing calls this directly

Calls 8

maxFunction · 0.85
findAvgPointsRadiusFunction · 0.85
pointsToMeshFusionFunction · 0.85
errorMethod · 0.80
fromAnySupportedFormatFunction · 0.50
toAnySupportedFormatFunction · 0.50
diagonalMethod · 0.45
computeBoundingBoxMethod · 0.45

Tested by

no test coverage detected