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

RectClip not always preserving orientation #864

Closed
reunanen opened this issue Jul 1, 2024 · 3 comments
Closed

RectClip not always preserving orientation #864

reunanen opened this issue Jul 1, 2024 · 3 comments

Comments

@reunanen
Copy link
Contributor

reunanen commented Jul 1, 2024

The documentation states:

RectClip preserves path orientation

Either I've misunderstood something, or here's a counter-example:

TEST(Clipper2Tests, TestRectClipOrientation)
{
    const Rect64 rect(1222, 1323, 3247, 3348);
    const Path64 subject = MakePath({ 375,1680, 1915,4716, 5943,586, 3987,152 });
    RectClip64 clip(rect);
    const auto solution = clip.Execute({ subject });
    ASSERT_EQ(solution.size(), 1);
    EXPECT_EQ(IsPositive(subject), IsPositive(solution.front()));
}

I'm not saying it's not a corner case (literally!):

image

However, this is a simplified version of a much more complex case that I accidentally stumbled upon.

@AngusJohnson
Copy link
Owner

Thanks Juha.
I can confirm that this is an issue.
Howver I'm currently occupied with other things so I doubt I'll get a chance to look at this for a few days.

@reunanen
Copy link
Contributor Author

reunanen commented Jul 1, 2024

Not at all urgent from my side – I have a workaround in place already.

@reunanen
Copy link
Contributor Author

reunanen commented Jul 5, 2024

Thank you Angus for fixing this! 🥳🥳🥳

Can confirm that the fix works on my machine as well! 😅

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