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

Function makeObjectPointsFromFile

source/MRMesh/MRObjectLoad.cpp:305–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305Expected<ObjectPoints> makeObjectPointsFromFile( const std::filesystem::path& file, ProgressCallback callback )
306{
307 MR_TIMER;
308
309 VertColors colors;
310 AffineXf3f xf;
311 auto pointsCloud = PointsLoad::fromAnySupportedFormat( file, {
312 .colors = &colors,
313 .outXf = &xf,
314 .callback = callback,
315 } );
316 if ( !pointsCloud.has_value() )
317 {
318 return unexpected( pointsCloud.error() );
319 }
320
321 ObjectPoints objectPoints;
322 objectPoints.setName( utf8string( file.stem() ) );
323 objectPoints.setPointCloud( std::make_shared<PointCloud>( std::move( pointsCloud.value() ) ) );
324 objectPoints.setXf( xf );
325 if ( !colors.empty() )
326 {
327 objectPoints.setVertsColorMap( std::move( colors ) );
328 objectPoints.setColoringType( ColoringType::VertsColorMap );
329 }
330
331 return objectPoints;
332}
333
334Expected<ObjectDistanceMap> makeObjectDistanceMapFromFile( const std::filesystem::path& file, ProgressCallback callback )
335{

Callers 1

loadObjectFromFileFunction · 0.85

Calls 9

utf8stringFunction · 0.85
errorMethod · 0.80
setColoringTypeMethod · 0.80
fromAnySupportedFormatFunction · 0.70
unexpectedFunction · 0.70
setPointCloudMethod · 0.45
valueMethod · 0.45
setXfMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected