-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHausdorffDistanceCalculatorMain_stl.cpp
58 lines (44 loc) · 2.02 KB
/
HausdorffDistanceCalculatorMain_stl.cpp
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
// Copyright (c) 2020-2021 Univaq (Italy)
// All rights reserved.
//
// Author(s): Claudia Di Marco <[email protected]>, Riccardo Mantini <[email protected]>
//
//******************************************************************************
// File Description :
// Main file to get the Hausdorff Distance between the generated mesh and the object.
//******************************************************************************
#include <cstdlib>
#include <VTK_manager.h>
#include "vtkHausdorffDistancePointSetFilter.h"
#include <string>
#include <vtk-9.0/vtkSTLReader.h>
int main(int argc, char* argv[]){
if (argc == 3)
{
std::string inputPathToVTKFileName = argv[1];
std::string inputPathToVTKFileName2 = argv[2];
std::cout << "Loading: " << inputPathToVTKFileName << std::endl;
vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();
reader->SetFileName(inputPathToVTKFileName.c_str());
reader->Update();
vtkSmartPointer<vtkSTLReader> reader2 = vtkSmartPointer<vtkSTLReader>::New();
reader2->SetFileName(inputPathToVTKFileName2.c_str());
reader2->Update();
// VTK_manager vtk_manager;
//vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid = vtk_manager.readUnstructuredGrid(inputPathToVTKFileName);
std::cout << "0" << std::endl;
vtkSmartPointer<vtkHausdorffDistancePointSetFilter> distance =
vtkSmartPointer<vtkHausdorffDistancePointSetFilter>::New();
//vtkHausdorffDistancePointSetFilter* distance;
std::cout << "0.1" << std::endl;
distance->SetInputData(0,reader->GetOutput());
std::cout << "0.2" << std::endl;
distance->SetInputData(1,reader2->GetOutput());
std::cout << "0.3" << std::endl;
distance->Update();
std::cout << "1" << std::endl;
double hausdorffDistance = distance->GetHausdorffDistance();
std::cout << "Distanza " << hausdorffDistance << std::endl;
}
return EXIT_SUCCESS;
}