I have a bezier curve and would like to draw it's stroke. To do that, I planned to approximate the stroke to a polygon and fill it with a scanline algorithm. While I feel confident about implementing the conversion and the scanline algorithm, I am unsure how to handle the situation when a polygon intersects itself.

If I don't treat it specially, it will look like on this picture on the left side, but what I am actually looking for is something like on the right side. Is there a popular method how to do that?

enter image description here

  • 1
    $\begingroup$ Read about winding order. The left one is usually called even odd winding rule.vand the other is just any number other than 0. What you do is you calculate how many points on the scanline then add a number if curve is intersecting upwards and subtract when down (or vice versa) $\endgroup$
    – joojaa
    May 7, 2020 at 18:31


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.