Quantcast

UpdateShape - addPolygon

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

UpdateShape - addPolygon

arabarg
I don't know where post this, but I think it is interesting.
I was trying update a plane added with
 bool pcl::visualization::PCLVisualizer::addPolygon ( const pcl::PlanarPolygon< PointT > &   polygon,
                double   r,
                double   g,
                double   b,
                const std::string &   id = "polygon",
                int   viewport = 0
        )
In this case the function updateShapePose(id,pose) didn't work for me because the actor in this case is type vtkOpenGLActor instead of vtkLODActor, so the downcasting from vtkProp to vtkLODActor returned false and didn't make the transform of my shape. I modified de function in this way, I hope I have done well and this will be useful.
updateShapePosePolygon(const std::string &id, const Eigen::Affine3f& pose){
 ShapeActorMap::iterator am_it = viewer_->getShapeActorMap()->find(id);
     if (am_it !== shape_actor_map_->end())return(false);
    else
     vtkOpenGLActor* actor=vtkOpenGLActor::SafeDownCast(am_it->second);
     vtkSmartPointer<vtkMatrix4x4> matrix=  vtkSmartPointer<vtkMatrix4x4> ::New();
   convertToVtkMatrix(pose.matrix(), matrix);
    actor->SetUserMatrix(matrix);
actor->Modified();
return true;
}
Loading...