直线方程公式

Posted bky2016

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了直线方程公式相关的知识,希望对你有一定的参考价值。

此处总结常见的算法,尽可能的记住..

1.两点式直线方程:a * x + b * y + c = 0;

float a1= centerPostionToUse.y - point1ToUse.y;
float b1= point1ToUse.x - centerPostionToUse.x;
float c1 = point1ToUse.x*(point1ToUse.y - centerPostionToUse.y) - point1ToUse.y*(point1ToUse.x - centerPostionToUse.x);

已知两点p1,p2
a = p2.y - p1.y;
b = p1.x - p2.x;
c = p1.x * (p1.y - p2.y) - p1.y * (p1.x - p2.x);

2.已知顶点p(x,y),计算点到直线的距离:
dis = abs(a * x + b * y + c)/sqrt(a * a + b * b);

垂足czPoint求算:
czPoint.x = (b * b * curpoint.x - a * b * curpoint.y - a * c)/(a * a + b * b);
czPoint.y = (a * a * curpoint.y - a * b * curpoint.x - b * c)/(a * a + b * b);

3.已知直线l方程a * x + b * y + c = 0;和点p(x1,y1)
计算过p1点且与直线l垂直的直线方程为a2 * x + b2 * y + c2 = 0;
则a2 = b;
b2 = -a;
c2 = a * (y1 - b/a * x1);

 

后续更新中....

以上是关于直线方程公式的主要内容,如果未能解决你的问题,请参考以下文章

三维坐标系中两点式求直线方程的详细解释

线性回归和线性回归方程是怎样的呢?

直线绕原点旋转一定角度后该直线方程,(例如转90.45.)

最小二乘法求线性回归方程中的系数a,b怎么求

vc MFC中,知道一个起点,一条直线方程y=kx+b,怎么在界面上画出这条直线?

直线与方程