问题描述
     我在阵列中有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 - 垂直于二维矢量
问候,Guido
这篇关于画线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!