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

Path.area() does not work correctly for path1.exclude(path2) #2064

Open
Pehat opened this issue Feb 11, 2024 · 0 comments
Open

Path.area() does not work correctly for path1.exclude(path2) #2064

Pehat opened this issue Feb 11, 2024 · 0 comments

Comments

@Pehat
Copy link

Pehat commented Feb 11, 2024

Description/Steps to reproduce

var path1 = new paper.Path([
    [100, 100],
    [200, 100],
    [200, 200],
    [100, 200]
]);
path1.closed = true;
path1.strokeColor = "red";
path1.visible = true;

var path2 = new paper.Path([
    [190, 190],
    [290, 190],
    [290, 290],
    [190, 290]
]);
path2.closed = true;
path2.strokeColor = "blue";
path2.visible = true;

var xor_path = path1.exclude(path2);
xor_path.strokeColor = null;
xor_path.fillColor = "lime";
xor_path.visible = true;
console.log(path1.area);  // expected 10000
console.log(path2.area);  // expected 10000
console.log(xor_path.area);  // expected 19900, got eps
console.log(xor_path.children[0].area);  // expected 9900
console.log(xor_path.children[1].area);  // expected 9900, got -9900

Link to reproduction test-case

Sketch link

Expected result

The intersection of two Path objects should have the area rendered in green. In fact, looks like it simply sums the oriented areas of underlying paths, regardless are they really rendered or not.

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

1 participant