Point Cloud Library (PCL)
1.12.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)
30
{
31
axes_ =
vtkSmartPointer<vtkAxes>::New
();
32
axes_->SetOrigin (0, 0, 0);
33
axes_->SetScaleFactor (size);
34
axes_->Update ();
35
36
vtkSmartPointer<vtkFloatArray>
axes_colors =
vtkSmartPointer<vtkFloatArray>::New
();
37
axes_colors->Allocate (6);
38
axes_colors->InsertNextValue (0.0);
39
axes_colors->InsertNextValue (0.0);
40
axes_colors->InsertNextValue (0.5);
41
axes_colors->InsertNextValue (0.5);
42
axes_colors->InsertNextValue (1.0);
43
axes_colors->InsertNextValue (1.0);
44
45
vtkSmartPointer<vtkPolyData>
axes_data = axes_->GetOutput ();
46
axes_data->GetPointData ()->SetScalars (axes_colors);
47
48
vtkSmartPointer<vtkTubeFilter>
axes_tubes =
vtkSmartPointer<vtkTubeFilter>::New
();
49
axes_tubes->SetInputData (axes_data);
50
axes_tubes->SetRadius (axes_->GetScaleFactor () / 100.0);
51
axes_tubes->SetNumberOfSides (6);
52
53
vtkSmartPointer<vtkPolyDataMapper>
axes_mapper =
vtkSmartPointer<vtkPolyDataMapper>::New
();
54
axes_mapper->SetScalarModeToUsePointData ();
55
axes_mapper->SetInputData (axes_tubes->GetOutput ());
56
57
axes_actor_ =
vtkSmartPointer<vtkActor>::New
();
58
axes_actor_->GetProperty ()->SetLighting (
false
);
59
axes_actor_->SetMapper (axes_mapper);
60
61
addActor
(axes_actor_);
62
}
63
//~Axes () { }
64
65
// Accessors
66
// -----------------------------------------------------------------------------
67
inline
vtkSmartPointer<vtkAxes>
68
getAxes
()
const
69
{
70
return
axes_;
71
}
72
73
vtkSmartPointer<vtkActor>
74
getAxesActor
()
const
75
{
76
return
axes_actor_;
77
}
78
79
private
:
80
81
// Members
82
// -----------------------------------------------------------------------------
83
vtkSmartPointer<vtkAxes>
axes_;
84
vtkSmartPointer<vtkActor>
axes_actor_;
85
86
};
Axes::getAxesActor
vtkSmartPointer< vtkActor > getAxesActor() const
Definition
axes.h:74
Axes::getAxes
vtkSmartPointer< vtkAxes > getAxes() const
Definition
axes.h:68
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