Edges on polygon outlines not always correct

后端 未结 6 1121
梦毁少年i
梦毁少年i 2020-12-01 08:54

I\'m using the algorithm below to generate quads which are then rendered to make an outline like this

http://img810.imageshack.us/img810/8530/uhohz.p

6条回答
  •  抹茶落季
    2020-12-01 09:09

    Ah, I see now. It's because you are reusing your old vertices, which aren't necessarily parallel to your new ones.

    Just go through your code with a simple example by hand, where your input points take a sharp 90 degree turn. The old vertices will be parallel to dir while the new ones will be perpendicular. If you have points on the line that are close enough together then you'll get strange behaviour like you see in your picture.

    There's no "simple" solution to getting uniform width lines, but things would look better if you just render the lines a pair at a time (i.e. get rid of the i > 0 case). That will give you some ugly sharp corners, but you won't get any thin lines.

提交回复
热议问题