Clipper2 icon indicating copy to clipboard operation
Clipper2 copied to clipboard

`RectClip` not always preserving orientation

Open reunanen opened this issue 7 months 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