daef / poly-bool-comparison

10 stars 4 forks source link

unisamples : tri2 #5

Open z3dev opened 2 years ago

z3dev commented 2 years ago

FYI, this polygon definition is rotating clockwise about Z, which I believe is wrong.

daef commented 2 years ago

when I was looking for a robust implementation there were no assumptions (like assuming CCW winding order)

tbh I'm astonished that there seems to be no polygon in 'random' segment order, if anything one should probably add more edgy cases like this.

z3dev commented 2 years ago

That might be a good idea, but it seems that the validations are against SVG images, and path definitions are definitely SVG based. Doesn’t that mean SVG orientation and ordering of points?

daef commented 2 years ago

Ah, I see, so svg.js should polygonize and fix the winding before generating svgs

z3dev commented 2 years ago

SVG has a fill-rule, which is used to draw the insides of shapes. It’s not intuitive.

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule

If the results (paths) cross or overlap then this rule is used to render the insides. Even the initial polygons (paths) will be rendered using this rule.

daef commented 2 years ago

That's why I set the fill-rule to evenodd. This makes the winding direction irrelevant, see this or that