-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvtkPMObservationDirectionDataPointsFilter.cxx
78 lines (64 loc) · 2.77 KB
/
vtkPMObservationDirectionDataPointsFilter.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*=========================================================================
Program: Lib Point Matcher Plugin for ParaView
Module: vtkPMObservationDirectionDataPointsFilter.cxx
Copyright (c) Ellon Paiva Mendes
All rights reserved.
See LICENSE file for details.
=========================================================================*/
#include "vtkPMObservationDirectionDataPointsFilter.h"
#include "vtkPMConversions.h"
#include "vtkPolyData.h"
#include "vtkPointData.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkSmartPointer.h"
#include "vtkNew.h"
typedef vtkPMConversions::PM PM;
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPMObservationDirectionDataPointsFilter);
//----------------------------------------------------------------------------
vtkPMObservationDirectionDataPointsFilter::vtkPMObservationDirectionDataPointsFilter()
{
this->X = 0;
this->Y = 0;
this->Z = 0;
this->SetNumberOfInputPorts(1);
this->SetNumberOfOutputPorts(1);
}
//----------------------------------------------------------------------------
vtkPMObservationDirectionDataPointsFilter::~vtkPMObservationDirectionDataPointsFilter()
{
}
//----------------------------------------------------------------------------
int vtkPMObservationDirectionDataPointsFilter::RequestData(
vtkInformation* vtkNotUsed(request),
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
// get input and output data objects
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
vtkPolyData *input = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
vtkInformation *outInfo = outputVector->GetInformationObject(0);
vtkPolyData *output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
// configure the filter
PointMatcherSupport::Parametrizable::Parameters params;
std::string name = "ObservationDirectionDataPointsFilter";
params["x"] = boost::lexical_cast<std::string>(this->X);
params["y"] = boost::lexical_cast<std::string>(this->Y);
params["z"] = boost::lexical_cast<std::string>(this->Z);
PM::DataPointsFilter* PM_filter =
PM::get().DataPointsFilterRegistrar.create(name, params);
// perform fix step sampling
boost::shared_ptr<PM::DataPoints> cloud = vtkPMConversions::DataPointsFromPolyData(input);
PM_filter->inPlaceFilter(*cloud);
// store output
output->ShallowCopy(vtkPMConversions::PolyDataFromDataPoints(*cloud));
return 1;
}
//----------------------------------------------------------------------------
void vtkPMObservationDirectionDataPointsFilter::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}