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

Function main

examples/cpp-examples/SignedDistances.dox.cpp:6–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <iostream>
5
6int main()
7{
8 auto refMesh = MR::MeshLoad::fromAnySupportedFormat( "mesh1.ctm" );
9 if ( !refMesh.has_value() )
10 {
11 std::cerr << refMesh.error();
12 return 1;
13 }
14 auto mesh = MR::MeshLoad::fromAnySupportedFormat( "mesh2.ctm" );
15 if ( !mesh.has_value() )
16 {
17 std::cerr << mesh.error();
18 return 1;
19 }
20 // get object of VertScalars - set of distances between points of target mesh and reference mesh
21 auto vertDistances = MR::findSignedDistances( *refMesh, *mesh );
22 auto minmax = std::minmax_element( begin( vertDistances ), end( vertDistances ) );
23 std::cout << "Distance between reference mesh and the closest point of target mesh is " << *minmax.first << "\n";
24 std::cout << "Distance between reference mesh and the farthest point of target mesh is " << *minmax.second << "\n";
25
26 return 0;
27}

Callers

nothing calls this directly

Calls 5

findSignedDistancesFunction · 0.85
errorMethod · 0.80
fromAnySupportedFormatFunction · 0.50
beginFunction · 0.50
endFunction · 0.50

Tested by

no test coverage detected