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

Method addCoordinateSystem

visualization/src/pcl_visualizer.cpp:660–698  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

658
659/////////////////////////////////////////////////////////////////////////////////////////////
660void
661pcl::visualization::PCLVisualizer::addCoordinateSystem (double scale, const std::string &id, int viewport)
662{
663 if (scale <= 0.0)
664 scale = 1.0;
665 vtkSmartPointer<vtkAxes> axes = vtkSmartPointer<vtkAxes>::New ();
666 axes->SetOrigin (0, 0, 0);
667 axes->SetScaleFactor (scale);
668 axes->Update ();
669
670 vtkSmartPointer<vtkFloatArray> axes_colors = vtkSmartPointer<vtkFloatArray>::New ();
671 axes_colors->Allocate (6);
672 axes_colors->InsertNextValue (0.0);
673 axes_colors->InsertNextValue (0.0);
674 axes_colors->InsertNextValue (0.5);
675 axes_colors->InsertNextValue (0.5);
676 axes_colors->InsertNextValue (1.0);
677 axes_colors->InsertNextValue (1.0);
678
679 vtkSmartPointer<vtkPolyData> axes_data = axes->GetOutput ();
680 axes_data->GetPointData ()->SetScalars (axes_colors);
681
682 vtkSmartPointer<vtkTubeFilter> axes_tubes = vtkSmartPointer<vtkTubeFilter>::New ();
683 axes_tubes->SetInputData (axes_data);
684 axes_tubes->SetRadius (axes->GetScaleFactor () / 50.0);
685 axes_tubes->SetNumberOfSides (6);
686
687 vtkSmartPointer<vtkPolyDataMapper> axes_mapper = vtkSmartPointer<vtkPolyDataMapper>::New ();
688 axes_mapper->SetScalarModeToUsePointData ();
689 axes_mapper->SetInputConnection (axes_tubes->GetOutputPort ());
690
691 vtkSmartPointer<vtkLODActor> axes_actor = vtkSmartPointer<vtkLODActor>::New ();
692 axes_actor->SetMapper (axes_mapper);
693
694 // Save the ID and actor pair to the global actor map
695 (*coordinate_actor_map_) [id] = axes_actor;
696
697 addActorToRenderer (axes_actor, viewport);
698}
699
700/////////////////////////////////////////////////////////////////////////////////////////////
701void

Callers 15

keyboard_callbackMethod · 0.80
runMethod · 0.80
visualizeFunction · 0.80
runMethod · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 4

NewFunction · 0.85
quat_to_angle_axisFunction · 0.85
SetOriginMethod · 0.80
SetRadiusMethod · 0.80

Tested by 7

mainFunction · 0.64
mainFunction · 0.64
mainFunction · 0.64
mainFunction · 0.64
mainFunction · 0.64
mainFunction · 0.64
simpleVisFunction · 0.64