using point_2d = bg::model::point<double, 2, bg::cs::cartesian>;
using linestring_2d = bg::model::linestring<point_2d>;
// overlaps
linestring_2d line_test_1({ point_2d(0.0, 0.0), point_2d(2.0, 0.0) });
linestring_2d line_test_2({ point_2d(0.0, 0.0), point_2d(1.0, 0.0) });
bool res = bg::overlaps(line_test1, line_test2);
This results to false. Should I use a specific strategy? I checked also tests and I saw that you do test overlap for linestrings.
ii) I have a structure that contains a linestring. I want to use an unordered set for storing unique objects with respect to their geometry (linestring). Therefore, I will need to write hash functions as below:
struct Object_hash
{
std::size_t operator()(const Object& obj) const
{
Linestring<Point> linestring = obj.get_linestring();
std::size_t hash = 0;
for (auto iter=linestring.cbegin(); iter!=linestring.cend(); ++iter)
{
boost::hash_combine(hash, iter->x1());
boost::hash_combine(hash, iter->x2());
}
return hash;
}
};