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

Function pointCloudFromNP

source/mrmeshnumpy/MRPythonNumpyExposing.cpp:251–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249} )
250
251MR::PointCloud pointCloudFromNP( const pybind11::buffer& points, const pybind11::buffer& normals )
252{
253 pybind11::buffer_info infoPoints = points.request();
254 pybind11::buffer_info infoNormals = normals.request();
255 if ( infoPoints.ndim != 2 || infoPoints.shape[1] != 3 )
256 throw std::runtime_error( "shape of input python vector 'points' should be (n,3)" );
257 if ( infoNormals.size != 0 && ( infoNormals.ndim != 2 || infoNormals.shape[1] != 3 ) )
258 throw std::runtime_error( "shape of input python vector 'normals' should be (n,3) or empty" );
259
260 MR::PointCloud res;
261
262 // verts to points part
263 res.points = fromNumpyArrayInfo( infoPoints );
264 if ( infoNormals.size > 0 )
265 res.normals = fromNumpyArrayInfo( infoNormals );
266
267 res.validPoints = MR::VertBitSet( res.points.size() );
268 res.validPoints.flip();
269
270 return res;
271}
272
273MR::Polyline2 polyline2FromNP( const pybind11::buffer& points )
274{

Callers

nothing calls this directly

Calls 4

fromNumpyArrayInfoFunction · 0.85
requestMethod · 0.45
sizeMethod · 0.45
flipMethod · 0.45

Tested by

no test coverage detected