Clipper2 icon indicating copy to clipboard operation
Clipper2 copied to clipboard

`RectClip` not always preserving orientation

Open reunanen opened this issue 1 year ago • 2 comments

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.

reunanen avatar Jul 01 '24 05:07 reunanen

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.

AngusJohnson avatar Jul 01 '24 12:07 AngusJohnson

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

reunanen avatar Jul 01 '24 12:07 reunanen

Thank you Angus for fixing this! 🥳🥳🥳

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

reunanen avatar Jul 05 '24 14:07 reunanen