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

问题描述

给定起点、直线长度和直线角度(相对于 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)?

推荐答案

直线方程是这样的:

m*x + n = y

m可以通过角度计算;m = tan(角度)如果你知道一个起点,那么你就可以找到 n.

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

所以 n = startPoint_Y - (tan ( 角度) * 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.

第一个是m*x + n = y(我们解决了).

The first is m*x + n = y (we solved it).

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

第二个是找到endPoint.

The second is to find the endPoint.

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

只有两件事我们还不知道:endPoint_x &端点_Y如果我们改写方程:

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

现在我们知道除了 endPoint_X 之外的一切.这个方程将为我们提供 endPoint_X 的两个解.然后就可以找到两个不同的ednPoint_Y了.

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-31 16:08