We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I discovered that when using subtract() in the context of a P5JS generative app that the resulting polygons vertices were not in the correct order.
subtract()
const poly1 = new Polygon(polygon1.map(({ x, y }) => [x, y])); const poly2 = new Polygon(polygon2.map(({ x, y }) => [x, y])); const res1= subtract(poly1, poly2);
This is a basic visualization of the issue when taking two boxes and subtracting one from the other.
To draw this, I'm using the below test code (not super relevant but I figured it could be useful.
`const drawPoly = (poly, color, showIndexes = false) => { poly.forEach(g => { fill(color); beginShape(); g.forEach(p => vertex(p.x, p.y)); endShape(); g.forEach((p, i) => { circle(p.x, p.y, 10); if (showIndexes) { fill(0) textSize(22) text(i, p.x, p.y); } });
})
}
drawPoly([res.vertices], [100, 100, 100], true) `
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I discovered that when using
subtract()
in the context of a P5JS generative app that the resulting polygons vertices were not in the correct order.This is a basic visualization of the issue when taking two boxes and subtracting one from the other.
To draw this, I'm using the below test code (not super relevant but I figured it could be useful.
`const drawPoly = (poly, color, showIndexes = false) => {
poly.forEach(g => {
fill(color);
beginShape();
g.forEach(p => vertex(p.x, p.y));
endShape();
g.forEach((p, i) => {
circle(p.x, p.y, 10);
if (showIndexes) {
fill(0)
textSize(22)
text(i, p.x, p.y);
}
});
}
drawPoly([res.vertices], [100, 100, 100], true)
`
The text was updated successfully, but these errors were encountered: