Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The result of polygon_90_set_data::get with argument vthreshold is incorrect #84

Open
xshenf opened this issue Mar 21, 2023 · 0 comments

Comments

@xshenf
Copy link

xshenf commented Mar 21, 2023

The code is as follows:

#include "boost/polygon/gtl.hpp"
#include <vector>
#include <iostream>

using namespace std;

int main(int argc, char** argv)
{
    gtl::point_data<int> point[] = {{53, 17}, {53, 68}, {33, 68}, {33, 17}};
    gtl::polygon_90_data<int> p90;
    p90.set(point, point + 5);
    gtl::rectangle_data<int> r1 = {10, 20, 30, 40};
    gtl::rectangle_data<int> r2 = {10, 25, 35, 45};
    gtl::rectangle_data<int> r3 = {10, 55, 43, 62};
    gtl::polygon_90_set_data<int> ps1(gtl::VERTICAL), ps2(gtl::VERTICAL);
    ps1.insert(r1);
    ps1.insert(r3);
    ps2.insert(r2);
    ps2.insert(p90);

    gtl::polygon_90_set_data<int> ps3 = ps1 | ps2;    
    vector<gtl::polygon_90_data<int>> p90s;
    ps3.get(p90s, 8);
    for (auto& p : p90s) {
        for (auto& x : p) {
          cout << "(" << x.x() << " " << x.y() << ")";
        }
        cout << endl;
    }

    return 0;
}

The result is:

(17 33)(25 33)(25 30)(20 30)(20 10)(45 10)(17 10)
(53 17)(33 17)(33 55)(10 55)(10 62)(33 62)(33 68)(53 68)

The input 17(point{53,17}) is the vertical coordinate, and the output 17(point{17,33}) is the horizontal coordinate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant