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

InflatePaths doesn't check that its result stays in-range #396

Closed
ccoustet opened this issue Feb 3, 2023 · 1 comment
Closed

InflatePaths doesn't check that its result stays in-range #396

ccoustet opened this issue Feb 3, 2023 · 1 comment

Comments

@ccoustet
Copy link

ccoustet commented Feb 3, 2023

Hi everyone,
InflatePaths doesn't check that its result stays in-range (it checks its input, though).
If slightly out-of-range, the result can look OK, but is not accepted as an input of a second InflatePaths because being out-of-range.
Going too far out-of-range results in an empty polygon.
In either case, no exception is raised.

PathsD polyline, solution;
PointD coords[4] = {{-2305843009213.,1.}, {1.,5.}, {5.,5.}, {5.,1.}};
polyline.push_back(PathD(std::begin(coords), std::end(coords)));
// offset polyline
std::cout << "Huge offset" << std::endl;
solution = InflatePaths(polyline, 1e30, JoinType::Miter, EndType::Polygon, 2 , 6);
//print inflated solution
std::cout << solution;
polyline.push_back(PathD(std::begin(coords), std::end(coords)));
// offset polyline
std::cout << "Small offset" << std::endl;
solution = InflatePaths(polyline, 1, JoinType::Miter, EndType::Polygon, 2 , 6);
//print inflated solution
std::cout << std::setprecision(15) << solution;
//try to use polygon in another InflatePaths call
std::cout << "Small offset" << std::endl;
InflatePaths(solution, 1, JoinType::Miter, EndType::Polygon, 2 , 6);


Huge offset
Small offset
-2305843009214,0 , -2305843009214,2 , 1,6 , 6,6 , 6,0 
Small offset
terminate called after throwing an instance of 'Clipper2Lib::Clipper2Exception'
  what():  Values exceed permitted range
@AngusJohnson
Copy link
Owner

Hopefully fixed now.

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

2 participants