问题描述
如何从一个起点,线的长度和线的角度(相对于x轴),找到一条线或绘制线的方程式?
线的方程式如下所示:
m * x + n = y
m可以通过角度来计算; m = tan(角度)
如果您知道一个起点,那么您可以找到n。
tan(角度)* startPoint_X + n = startPoint_Y
n = startPoint_Y - (tan(angle)* startPoint_X)
如果要绘制线段并你知道长度,起点和角度,会有两个方程式。
第一个是 m * x + n = y
(我们解决了它)。
这意味着 第二个是找到endPoint。 还有两件事我们还不知道:endPoint_x& endPoint_Y 现在我们知道除了endPoint_X之外的所有内容。 How can I find equation of a line or draw a line, given a starting point, length of line and angle of line (relative to x-axis)? An equation of a line is like: m can be calculated by angle; So If you want to draw a line-segment and you know the length, the start point and the angle, there will be two equations. The first is And this means The second is to find the endPoint. There are only two things that still we don't know: endPoint_x & endPoint_YIf we rewrite the equation: now we know everything except endPoint_X.This equation will give us two solutions for endPoint_X.Then you can find two different ednPoint_Y. 这篇关于带角度的直线方程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! m *(endPoint_X)+ n = endPoint_Y $ c $
length ^ 2 =(endPoint_X - startPoint_X)^ 2 +(endPoint_Y - startPoint_Y)^ 2
如果我们重写方程:
length ^ 2 =(endPoint_X - startPoint_X)^ 2 +(m * (endPoint_X)+ n - startPoint_Y)^ 2
这个等式给了我们两个endPoint_X的解决方案。
然后你可以找到两个不同的ednPoint_Y。m*x + n = y
m = tan(angle)
And if you know a start point then you can find n.tan(angle) * startPoint_X + n = startPoint_Y
n = startPoint_Y - (tan ( angle) * startPoint_X )
m*x + n = y
(we solved it).m*(endPoint_X) + n = endPoint_Y
length^2 = (endPoint_X - startPoint_X)^2 + (endPoint_Y - startPoint_Y)^2
length^2 = (endPoint_X - startPoint_X)^2 + ( m*(endPoint_X) + n - startPoint_Y)^2