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

Function distanceMapToMesh

source/MRMesh/MRDistanceMap.cpp:185–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185Expected<Mesh> distanceMapToMesh( const DistanceMap& distMap, const AffineXf3f& toWorld, ProgressCallback cb )
186{
187 auto resX = distMap.resX();
188 auto resY = distMap.resY();
189
190 if (resX < 2 || resY < 2)
191 {
192 return unexpected( "Cannot create mesh from degenerated 1x1 distance map." );
193 }
194
195 return makeRegularGridMesh( resX, resY, [&]( size_t x, size_t y )
196 {
197 return distMap.isValid( x, y );
198 },
199 [&]( size_t x, size_t y )
200 {
201 return distMap.unproject( x, y, toWorld ).value_or( Vector3f{} );
202 }, {}, cb );
203}
204
205MRMESH_API Image convertDistanceMapToImage( const DistanceMap& dm, float threshold )
206{

Callers 2

TESTFunction · 0.85
calculateMeshMethod · 0.85

Calls 6

makeRegularGridMeshFunction · 0.85
resXMethod · 0.80
resYMethod · 0.80
unprojectMethod · 0.80
unexpectedFunction · 0.70
isValidMethod · 0.45

Tested by 1

TESTFunction · 0.68