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

问题描述

如何从一个起点,线的长度和线的角度(相对于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 (我们解决了它)。

这意味着 m *(endPoint_X)+ n = endPoint_Y

第二个是找到endPoint。

  length ^ 2 =(endPoint_X  -  startPoint_X)^ 2 +(endPoint_Y  -  startPoint_Y)^ 2 

还有两件事我们还不知道:endPoint_x& endPoint_Y
如果我们重写方程:

  length ^ 2 =(endPoint_X  -  startPoint_X)^ 2 +(m * (endPoint_X)+ n  -  startPoint_Y)^ 2 

现在我们知道除了endPoint_X之外的所有内容。
这个等式给了我们两个endPoint_X的解决方案。
然后你可以找到两个不同的ednPoint_Y。


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*x + n = y

m can be calculated by angle; m = tan(angle)And if you know a start point then you can find n.

tan(angle) * startPoint_X + n = startPoint_Y

So n = startPoint_Y - (tan ( angle) * startPoint_X )

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 m*x + n = y (we solved it).

And this means m*(endPoint_X) + n = endPoint_Y

The second is to find the endPoint.

length^2 = (endPoint_X - startPoint_X)^2 + (endPoint_Y - startPoint_Y)^2

There are only two things that still we don't know: endPoint_x & endPoint_YIf we rewrite the equation:

length^2 = (endPoint_X - startPoint_X)^2 + ( m*(endPoint_X) + n - startPoint_Y)^2

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.

这篇关于带角度的直线方程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 17:38