Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
outofcore
visualization
axes.h
1
#pragma once
2
3
// C++
4
#include <iostream>
5
#include <string>
6
7
// PCL
8
#include "object.h"
9
10
// VTK
11
#include <vtkVersion.h>
12
#include <vtkActor.h>
13
#include <vtkTubeFilter.h>
14
#include <vtkAxes.h>
15
//#include <vtkDataSetMapper.h>
16
#include <vtkFloatArray.h>
17
#include <vtkProperty.h>
18
#include <vtkPolyData.h>
19
#include <vtkPolyDataMapper.h>
20
#include <vtkSmartPointer.h>
21
22
class
Axes
:
public
Object
23
{
24
public
:
25
26
// Operators
27
// -----------------------------------------------------------------------------
28
Axes
(std::string name,
float
size = 1.0) :
29
Object
(name), axes_ (
vtkSmartPointer
<vtkAxes>::New ())
30
{
31
axes_->SetOrigin (0, 0, 0);
32
axes_->SetScaleFactor (size);
33
axes_->Update ();
34
35
vtkSmartPointer<vtkFloatArray>
axes_colors =
vtkSmartPointer<vtkFloatArray>::New
();
36
axes_colors->Allocate (6);
37
axes_colors->InsertNextValue (0.0);
38
axes_colors->InsertNextValue (0.0);
39
axes_colors->InsertNextValue (0.5);
40
axes_colors->InsertNextValue (0.5);
41
axes_colors->InsertNextValue (1.0);
42
axes_colors->InsertNextValue (1.0);
43
44
vtkSmartPointer<vtkPolyData>
axes_data = axes_->GetOutput ();
45
axes_data->GetPointData ()->SetScalars (axes_colors);
46
47
vtkSmartPointer<vtkTubeFilter>
axes_tubes =
vtkSmartPointer<vtkTubeFilter>::New
();
48
axes_tubes->SetInputData (axes_data);
49
axes_tubes->SetRadius (axes_->GetScaleFactor () / 100.0);
50
axes_tubes->SetNumberOfSides (6);
51
52
vtkSmartPointer<vtkPolyDataMapper>
axes_mapper =
vtkSmartPointer<vtkPolyDataMapper>::New
();
53
axes_mapper->SetScalarModeToUsePointData ();
54
axes_mapper->SetInputData (axes_tubes->GetOutput ());
55
56
axes_actor_ =
vtkSmartPointer<vtkActor>::New
();
57
axes_actor_->GetProperty ()->SetLighting (
false
);
58
axes_actor_->SetMapper (axes_mapper);
59
60
addActor
(axes_actor_);
61
}
62
63
// Accessors
64
// -----------------------------------------------------------------------------
65
inline
vtkSmartPointer<vtkAxes>
66
getAxes
()
const
67
{
68
return
axes_;
69
}
70
71
vtkSmartPointer<vtkActor>
72
getAxesActor
()
const
73
{
74
return
axes_actor_;
75
}
76
77
private
:
78
79
// Members
80
// -----------------------------------------------------------------------------
81
vtkSmartPointer<vtkAxes>
axes_;
82
vtkSmartPointer<vtkActor>
axes_actor_;
83
84
};
Axes::getAxesActor
vtkSmartPointer< vtkActor > getAxesActor() const
Definition
axes.h:72
Axes::getAxes
vtkSmartPointer< vtkAxes > getAxes() const
Definition
axes.h:66
Axes::Axes
Axes(std::string name, float size=1.0)
Definition
axes.h:28
Object::addActor
void addActor(vtkActor *actor)
Object::Object
Object(std::string name)
vtkSmartPointer
Definition
actor_map.h:51