1 #pragma once
2
3 #include <set>
4
5 #include <mapbox/geometry/point.hpp>
6
7 #include <mapbox/geometry/wagyu/active_bound_list.hpp>
8
9 #ifdef DEBUG
10 #include <iostream>
11 #endif
12
13 namespace mapbox {
14 namespace geometry {
15 namespace wagyu {
16
17 template <typename T>
18 struct intersect_node {
19
20 bound_ptr<T> bound1;
21 bound_ptr<T> bound2;
22 mapbox::geometry::point<double> pt;
23
intersect_nodemapbox::geometry::wagyu::intersect_node24 intersect_node(intersect_node<T>&& n)
25 : bound1(std::move(n.bound1)), bound2(std::move(n.bound2)), pt(std::move(n.pt)) {
26 }
27
operator =mapbox::geometry::wagyu::intersect_node28 intersect_node& operator=(intersect_node<T>&& n) {
29 bound1 = std::move(n.bound1);
30 bound2 = std::move(n.bound2);
31 pt = std::move(n.pt);
32 return *this;
33 }
34
intersect_nodemapbox::geometry::wagyu::intersect_node35 intersect_node(bound_ptr<T> const& bound1_,
36 bound_ptr<T> const& bound2_,
37 mapbox::geometry::point<double> const& pt_)
38 : bound1(bound1_), bound2(bound2_), pt(pt_) {
39 }
40 };
41
42 template <typename T>
43 using intersect_list = std::vector<intersect_node<T>>;
44
45 #ifdef DEBUG
46
47 template <class charT, class traits, typename T>
operator <<(std::basic_ostream<charT,traits> & out,const intersect_node<T> & e)48 inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& out,
49 const intersect_node<T>& e) {
50 out << " point x: " << e.pt.x << " y: " << e.pt.y << std::endl;
51 out << " bound 1: " << std::endl;
52 out << *e.bound1 << std::endl;
53 out << " bound 2: " << std::endl;
54 out << *e.bound2 << std::endl;
55 return out;
56 }
57
58 template <class charT, class traits, typename T>
operator <<(std::basic_ostream<charT,traits> & out,const intersect_list<T> & ints)59 inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& out,
60 const intersect_list<T>& ints) {
61 std::size_t c = 0;
62 for (auto const& i : ints) {
63 out << "Intersection: " << c++ << std::endl;
64 out << i;
65 }
66 return out;
67 }
68
69 #endif
70 }
71 }
72 }
73