metafizzy / zdog

Flat, round, designer-friendly pseudo-3D engine for canvas & SVG
https://zzz.dog
10.38k stars 394 forks source link

Line across inside cylinder when fill is false #106

Open Coehill opened 3 years ago

Coehill commented 3 years ago

Test case: https://codepen.io/coehill/pen/OJRGavP

When a cylinder is created that has fill: false, there is a line across the centre. It can be removed by setting the color to be the same as the background, however this turns the model into an ellipse.

desandro commented 3 years ago

Thanks for reporting this issue. I imagine you're looking for a hollow cylinder, which the Cylinder shape does not support 😢. Zdog's Cylinder works as a hack by rendering a the curved surface as a rectangle. Setting fill breaks this illusion.

If you do need to render a hollow cylinder, the closest solution would be to render multiple Rects rotated around a center point.

Coehill commented 3 years ago

I appreciate the suggestion @desandro!. I decided to render multiple Ellipses stacked on the z-axis which worked for my purposes.