mirror of https://github.com/CGAL/cgal
Deal with argc/argv and cleanup
This commit is contained in:
parent
13b66b6b88
commit
85723d0117
|
|
@ -14,11 +14,11 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
std::vector<Point> A, B;
|
||||
{
|
||||
std::ifstream in(CGAL::data_file_path("wkt/LetterA.wkt"));
|
||||
std::ifstream in((argc > 1) ? argv[1] : CGAL::data_file_path("wkt/LetterA.wkt"));
|
||||
CGAL::IO::read_linestring_WKT(in, A);
|
||||
}
|
||||
{
|
||||
std::ifstream in(CGAL::data_file_path("wkt/LetterAbis.wkt"));
|
||||
std::ifstream in((argc > 1) ? argv[1] : CGAL::data_file_path("wkt/LetterAbis.wkt"));
|
||||
CGAL::IO::read_linestring_WKT(in, B);
|
||||
}
|
||||
bool res = CGAL::is_Frechet_distance_larger<Traits>(A, B, 0.001);
|
||||
|
|
|
|||
|
|
@ -1,36 +1,26 @@
|
|||
#include <CGAL/Frechet_distance.h>
|
||||
#include <CGAL/Frechet_distance_traits_3.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/IO/WKT.h>
|
||||
|
||||
#include <ostream>
|
||||
#include <fstream>
|
||||
|
||||
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
//using Kernel = CGAL::Simple_cartesian<double>;
|
||||
using Kernel = CGAL::Simple_cartesian<double>;
|
||||
using Traits = CGAL::Frechet_distance_traits_3<Kernel>;
|
||||
using Point = Traits::Point_d;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#if 0
|
||||
std::vector<Point> A, B;
|
||||
{
|
||||
std::ifstream in(CGAL::data_file_path("wkt/moebius.wkt"));
|
||||
std::ifstream in((argc > 1) ? argv[1] : CGAL::data_file_path("wkt/moebius.wkt"));
|
||||
CGAL::IO::read_linestring_WKT(in, A);
|
||||
}
|
||||
{
|
||||
std::ifstream in(CGAL::data_file_path("wkt/moebius2.wkt"));
|
||||
std::ifstream in((argc > 2) ? argv[1] : CGAL::data_file_path("wkt/moebius2.wkt"));
|
||||
CGAL::IO::read_linestring_WKT(in, B);
|
||||
}
|
||||
#else
|
||||
|
||||
// two identical points fails
|
||||
std::array<Point,4> A = { Point(0,0,0), Point(0,0,0), Point(1,0,1), Point(1,1,0)};
|
||||
std::array<Point,4> B = { Point(0,0,0), Point(0,0,0), Point(1,0,0), Point(1,1,0)};
|
||||
|
||||
#endif
|
||||
|
||||
std::pair<double, double> res = CGAL::approximate_Frechet_distance<Traits>(A, B, 0.000001);
|
||||
std::cout << "The Frechet distance between the polylines is between " << res.first << " and " << res.second << std::endl;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include <CGAL/Frechet_distance.h>
|
||||
#include <CGAL/Frechet_distance_traits_d.h>
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue