c++ - save mesh with RGB in vtk -


i have mesh (with color) loaded , want write .ply file , store rgb information well. have code below, uses vtkplywriter class, saves vertices , not rgb info. there built in way this?

code

vtksmartpointer<vtktransformpolydatafilter> rotate_and_save_mesh(vtksmartpointer<vtkplyreader> mesh_reader, double rotation_angle, double x, double y, double z,          std::string& out_name, bool should_write = true){     vtksmartpointer<vtktransform> transform = vtksmartpointer<vtktransform>::new();     transform->rotatewxyz(rotation_angle, x, y, z);     vtksmartpointer<vtktransformpolydatafilter> transformfilter = vtksmartpointer<vtktransformpolydatafilter>::new();      transformfilter->settransform(transform);     transformfilter->setinputconnection(mesh_reader->getoutputport());     transformfilter->update();      if(should_write){         vtksmartpointer<vtkplywriter> writer = vtksmartpointer<vtkplywriter>::new();         writer->setinputconnection(transformfilter->getoutputport());         writer->setfilename(out_name.c_str());          writer->write();     }     return transformfilter; } 

this awkward. unlike vtkpolydataxmlwriter , other vtk writers, must specify

plywriter->setarrayname("colors"); 

where color array created/named this:

vtksmartpointer<vtkunsignedchararray> colors =   vtksmartpointer<vtkunsignedchararray>::new(); colors->setnumberofcomponents(3); colors->setname("colors"); 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -