Skip to content

PathsD union not worked as expected imho #1051

@ol-loginov

Description

@ol-loginov

Thanks for greate lib for the first.

Trying to use PathsD (c# 2.0.0 via NuGet).
Having main rectangle 2 by 2 and attach another rect (2 by 1) to it. To the top left corner and to the bottom left corner. And results are different.

    [Test]
    public void Union() {
        var main = new Paths64([new Rect64(0, 0, 2, 2).AsPath()]);
        
        var add1 = new Paths64([new Rect64(-2, 0, 0, 1).AsPath()]);
        Assert.That(Clipper.Union(main, add1, FillRule.NonZero).ToString(), Is.EqualTo("2,2 , 0,2 , 0,0 , 2,0 \n0,1 , -2,1 , -2,0 , 0,0 "));
        
        var add2 = new Paths64([new Rect64(-2, 1, 0, 1).AsPath()]);
        Assert.That(Clipper.Union(main, add2, FillRule.NonZero).ToString(), Is.EqualTo("2,2 , 0,2 , 0,0 , 2,0 "));
    }
Image

If I connect rect to the top left corner - it's not getting merged to the main.
I have more other use cases - and it's not always merged together.

Image

Is it expected behaviour for PathsD? So I cannot use it for boolean operations to get rectangles merged for sure?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions