开发者

Draw 2 parallel lines

How can I calculate the points to draw 2 parallel lines.

I know the start and end points for the centre of the parallel lines. To makes thing a开发者_JS百科 little bit harder, it needs to support straight and Bezier curved lines.


The question is vague, but here's a possibility. Hope that helps.

For a segment (x1,y1)-(x2,y2) you can calculate another segment, n pixels away in a direction represented by angle a this way

x1b = x1 + n cos a
y1b = y1 - n sin a
x2b = x2 + n cos a
y2b = y2 - n sin a
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜