画线 [英] Draw line

查看:92
本文介绍了画线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

       我在阵列中有360点,它的颜色为红色, 我想绘制另一条像蓝色的线,我不知道如何计算第二行360点,所以请分享一些想法或代码。我希望与第一行保持
50像素差异。

        i have 360 points in array and its drawn like red color line,  and i want draw another line like blue color and i dont know how to calculate that second line 360 points so please share some ideas or code. and i want to maintain 50 pixel difference from first line.

Rangaraj Palanisamy

Rangaraj Palanisamy

推荐答案

你好,

你可以例如,使用向量计算来计算点数。

you can for example calculate the points using vector calculation.

在彼此旁边做一个2点的线并计算垂直向量。然后,您可以从距离为50像素的行的第一个点开始计算该行左侧或右侧的蓝点。

Make a line of 2 points next to each other and calculate the perpendicular vector. Then you can calculate a blue point left or right to the line from the first point of the line with distance 50 pixels.

https://en.wikipedia.org/wiki/Perpendicular

https://gamedev.stackexchange.com/questions/70075/how-can-i-find-the - 垂直于二维矢量

http:// mathworld .wolfram.com / PerpendicularVector.html

问候,Guido


这篇关于画线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆