showCylinder implementation
This commit is contained in:
@@ -142,6 +142,7 @@ public:
|
||||
void showPlane (const String &id, const cv::Vec4f &coefs, const Color &color);
|
||||
void showPlane (const String &id ,const cv::Vec4f &coefs, const cv::Point3f &pt, const Color &color);
|
||||
void showCube (const String &id, const Point3f &pt1, const Point3f &pt2, const Color &color);
|
||||
void showCylinder (const String &id, const Point3f &pt_on_axis, const Point3f &axis_direction, double radius, int num_sides, const Color &color);
|
||||
|
||||
bool addPolygon(const cv::Mat& cloud, const Color& color, const std::string &id = "polygon");
|
||||
bool addArrow (const cv::Point3f &pt1, const cv::Point3f &pt2, const Color& color, bool display_length, const std::string &id = "arrow");
|
||||
|
@@ -98,6 +98,11 @@ void temp_viz::Viz3d::showCube(const String &id, const Point3f &pt1, const Point
|
||||
impl_->showCube(id, pt1, pt2, color);
|
||||
}
|
||||
|
||||
void temp_viz::Viz3d::showCylinder(const String &id, const Point3f &pt_on_axis, const Point3f &axis_direction, double radius, int num_sides, const Color &color)
|
||||
{
|
||||
impl_->showCylinder(id, pt_on_axis, axis_direction, radius, num_sides, color);
|
||||
}
|
||||
|
||||
bool temp_viz::Viz3d::removeCoordinateSystem (const String &id)
|
||||
{
|
||||
return impl_->removeCoordinateSystem(id);
|
||||
|
@@ -407,6 +407,40 @@ void temp_viz::Viz3d::VizImpl::showCube (const String &id, const Point3f &pt1, c
|
||||
}
|
||||
}
|
||||
|
||||
void temp_viz::Viz3d::VizImpl::showCylinder (const String &id, const Point3f &pt_on_axis, const Point3f &axis_direction, double radius, int num_sides, const Color &color)
|
||||
{
|
||||
// Check if this Id already exists
|
||||
ShapeActorMap::iterator am_it = shape_actor_map_->find (id);
|
||||
bool exists = (am_it != shape_actor_map_->end());
|
||||
Color c = vtkcolor(color);
|
||||
// If it exists just update
|
||||
if (exists)
|
||||
{
|
||||
vtkSmartPointer<vtkLODActor> actor = vtkLODActor::SafeDownCast (am_it->second);
|
||||
reinterpret_cast<vtkDataSetMapper*>(actor->GetMapper ())->SetInput(createCylinder(pt_on_axis, axis_direction, radius, num_sides));
|
||||
actor->GetProperty ()->SetColor (c.val);
|
||||
actor->GetMapper ()->ScalarVisibilityOff ();
|
||||
actor->Modified ();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create a plane
|
||||
vtkSmartPointer<vtkDataSet> data = createCylinder(pt_on_axis, axis_direction, radius, num_sides);
|
||||
|
||||
// Create an Actor
|
||||
vtkSmartPointer<vtkLODActor> actor;
|
||||
createActorFromVTKDataSet (data, actor);
|
||||
// actor->GetProperty ()->SetRepresentationToWireframe ();
|
||||
actor->GetProperty ()->SetRepresentationToSurface ();
|
||||
actor->GetProperty ()->SetLighting (false);
|
||||
actor->GetProperty ()->SetColor (c.val);
|
||||
actor->GetMapper ()->ScalarVisibilityOff ();
|
||||
renderer_->AddActor(actor);
|
||||
|
||||
// Save the pointer/ID pair to the global actor map
|
||||
(*shape_actor_map_)[id] = actor;
|
||||
}
|
||||
}
|
||||
|
||||
bool temp_viz::Viz3d::VizImpl::addPolygonMesh (const Mesh3d& mesh, const Mat& mask, const std::string &id)
|
||||
{
|
||||
|
Reference in New Issue
Block a user