Ticket #13556: geometry_within_bug.cpp

File geometry_within_bug.cpp, 710 bytes (added by Josiah Slack <josiahnmi@…>, 4 years ago)
Line 
1#include <iostream>
2#include <boost/geometry.hpp>
3#include <boost/geometry/geometries/point_xy.hpp>
4
5using point_t = boost::geometry::model::d2::point_xy<double>;
6using segment_t = boost::geometry::model::segment<point_t>;
7
8int main() {
9 segment_t e1{point_t{100, 350}, point_t{-100, 400}};
10 segment_t e2{point_t{0, 0}, point_t{90, 600}};
11 std::vector<point_t> iv;
12 boost::geometry::intersection(e1, e2, iv);
13 assert(iv.size() == 1);
14 const auto& v = iv[0];
15 bool is_within = boost::geometry::within(v, e1);
16 std::cout << "is within? " << is_within << std::endl;
17 is_within = boost::geometry::within(v, e2);
18 std::cout << "is within? " << is_within << std::endl;
19
20 return 0;
21}