How do I render thick 2D lines as polygons?

前端 未结 9 1228
心在旅途
心在旅途 2020-12-12 18:17

I have a path made up of a list of 2D points. I want to turn these into a strip of triangles in order to render a textured line with a specified thickness (and other such th

9条回答
  •  死守一世寂寞
    2020-12-12 19:02

    A simple method off the top of my head.

    Bisect the angle of each 2d Vertex, this will create a nice miter line. Then move along that line, both inward and outward, the amount of your "thickness" (or thickness divided by two?), you now have your inner and outer polygon points. Move to the next point, repeat the same process, building your new polygon points along the way. Then apply a triangualtion to get your render-ready vertexes.

提交回复
热议问题