This commit is contained in:
Yaghyavardhan singh khangarot 2018-08-16 02:10:38 +05:30
parent f526bb8f54
commit 5aa539d58e
3 changed files with 9 additions and 8 deletions

View File

@ -10,6 +10,7 @@
//` Calculate Similarity between two geometries as the discrete frechet distance between them.
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/algorithms/discrete_frechet_distance.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/linestring.hpp>
int main()
@ -18,9 +19,9 @@ int main()
typedef boost::geometry::model::linestring<point_type> linestring_type;
linestring_type linestring1,linestring2;
boost::geometry::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", linestring1);
boost::geometry::read_wkt("LINESTRING(1 0,0 1,1 1,2 1,3 1)", linestring2);
boost::geometry::read_wkt("LINESTRING(1 0,0 1,1 1,2 1,3 1)", linestring2);
double res;
res = boost::geometry::frechet_distance(linestring1,linestrign2);
res = boost::geometry::discrete_frechet_distance(linestring1,linestring2);
std::cout << "Discrete Frechet Distance: " << res << std::endl;
return 0;
}
@ -32,4 +33,4 @@ Output:
Discrete Frechet Distance: 1.41421
]
*/
//]
//]

View File

@ -10,6 +10,7 @@
//` Calculate Similarity between two geometries as the discrete hasdorff distance between them.
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/algorithms/discrete_hausdorff_distance.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/linestring.hpp>
int main()
@ -18,9 +19,9 @@ int main()
typedef boost::geometry::model::linestring<point_type> linestring_type;
linestring_type linestring1,linestring2;
boost::geometry::read_wkt("LINESTRING(0 0,1 1,1 2,2 1,2 2)", linestring1);
boost::geometry::read_wkt("LINESTRING(1 0,0 1,1 1,2 1,3 1)", linestring2);
boost::geometry::read_wkt("LINESTRING(1 0,0 1,1 1,2 1,3 1)", linestring2);
double res;
res = boost::geometry::hausdorff_distance(linestring1,linestring2);
res = boost::geometry::discrete_hausdorff_distance(linestring1,linestring2);
std::cout << "Discrete Hausdorff Distance: " << res << std::endl;
return 0;
}
@ -32,4 +33,4 @@ Output:
Discrete Hausdorff Distance: 1.0
]
*/
//]
//]

View File

@ -79,7 +79,6 @@ build-project overlay ;
build-project perimeter ;
build-project relate ;
build-project set_operations ;
build-project similarity;
build-project similarity ;
build-project touches ;
build-project within ;