| 8 | #include <iostream> |
| 9 | |
| 10 | int 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 | } |
nothing calls this directly
no test coverage detected