Welcome to mirror list, hosted at ThFree Co, Russian Federation.

binary_operators.cpp « region2d « geometry - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 24a512f14e39441d4a79140bf0dba013db0affab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "../../base/SRC_FIRST.hpp"

#include "binary_operators.hpp"
#include "boost_concept.hpp"


namespace m2
{
  using namespace boost::polygon;
  using namespace boost::polygon::operators;

  void SpliceRegions(vector<RegionI> & src, vector<RegionI> & res)
  {
    for (size_t i = 0; i < src.size(); ++i)
    {
      res.push_back(RegionI());
      res.back().Swap(src[i]);
    }
  }

  void IntersectRegions(RegionI const & r1, RegionI const & r2, vector<RegionI> & res)
  {
    vector<RegionI> local;
    local += (r1 * r2);
    SpliceRegions(local, res);
  }

  void DiffRegions(RegionI const & r1, RegionI const & r2, vector<RegionI> & res)
  {
    vector<RegionI> local;
    local += boost::polygon::operators::operator-(r1, r2);
    SpliceRegions(local, res);
  }
}