MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / addCylinder

Method addCylinder

visualization/src/pcl_visualizer.cpp:2248–2277  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

2246
2247////////////////////////////////////////////////////////////////////////////////////////////
2248bool
2249pcl::visualization::PCLVisualizer::addCylinder (const pcl::ModelCoefficients &coefficients,
2250 const std::string &id, int viewport)
2251{
2252 // Check to see if this ID entry already exists (has it been already added to the visualizer?)
2253 auto am_it = shape_actor_map_->find (id);
2254 if (am_it != shape_actor_map_->end ())
2255 {
2256 pcl::console::print_warn (stderr, "[addCylinder] A shape with id <%s> already exists! Please choose a different id and retry.\n", id.c_str ());
2257 return (false);
2258 }
2259
2260 if (coefficients.values.size () != 7)
2261 {
2262 PCL_WARN ("[addCylinder] Coefficients size does not match expected size (expected 7).\n");
2263 return (false);
2264 }
2265
2266 vtkSmartPointer<vtkDataSet> data = createCylinder (coefficients);
2267
2268 // Create an Actor
2269 vtkSmartPointer<vtkLODActor> actor;
2270 createActorFromVTKDataSet (data, actor);
2271 actor->GetProperty ()->SetRepresentationToSurface ();
2272 addActorToRenderer (actor, viewport);
2273
2274 // Save the pointer/ID pair to the global actor map
2275 (*shape_actor_map_)[id] = actor;
2276 return (true);
2277}
2278
2279////////////////////////////////////////////////////////////////////////////////////////////
2280bool

Callers 2

runFunction · 0.80
displayHeadsFunction · 0.80

Calls 3

findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected