void getVoxelActors (pcl::PointCloud<pcl::PointXYZ>& voxelCenters, double voxelSideLen, Eigen::Vector3f color, vtkSmartPointer<vtkActorCollection> coll) { vtkSmartPointer < vtkAppendPolyData > treeWireframe = vtkSmartPointer<vtkAppendPolyData>::New (); double s = voxelSideLen/2.0; for (const auto &point : voxelCenters.points) { double x = point.x; double y = point.y; double z = point.z; treeWireframe->AddInputData (getCuboid (x - s, x + s, y - s, y + s, z - s, z + s)); } vtkSmartPointer < vtkLODActor > treeActor = vtkSmartPointer<vtkLODActor>::New (); vtkSmartPointer < vtkDataSetMapper > mapper = vtkSmartPointer<vtkDataSetMapper>::New (); mapper->SetInputData (treeWireframe->GetOutput ()); treeActor->SetMapper (mapper); treeActor->GetProperty ()->SetRepresentationToWireframe (); treeActor->GetProperty ()->SetColor (color[0], color[1], color[2]); treeActor->GetProperty ()->SetLineWidth (4); coll->AddItem (treeActor); }
void displayBoundingBox (Eigen::Vector3f& min_b, Eigen::Vector3f& max_b, vtkSmartPointer<vtkActorCollection> coll) { vtkSmartPointer < vtkAppendPolyData > treeWireframe = vtkSmartPointer<vtkAppendPolyData>::New (); treeWireframe->AddInputData (getCuboid (min_b[0], max_b[0], min_b[1], max_b[1], min_b[2], max_b[2])); vtkSmartPointer < vtkActor > treeActor = vtkSmartPointer<vtkActor>::New (); vtkSmartPointer < vtkDataSetMapper > mapper = vtkSmartPointer<vtkDataSetMapper>::New (); mapper->SetInputData (treeWireframe->GetOutput ()); treeActor->SetMapper (mapper); treeActor->GetProperty ()->SetRepresentationToWireframe (); treeActor->GetProperty ()->SetColor (0.0, 0.0, 1.0); treeActor->GetProperty ()->SetLineWidth (2); coll->AddItem (treeActor); }