当前位置:网站首页>点到直线的距离直线的交点及夹角
点到直线的距离直线的交点及夹角
2022-07-05 22:17:00 【alex1801】
1、点到直线的距离
P到直线AB的距离。
//P为线外一点,AB为线段两个端点
float getDist_P2L(CvPoint pointP, CvPoint pointA, CvPoint pointB)
{
//求直线方程
int A = 0, B = 0, C = 0;
A = pointA.y - pointB.y;
B = pointB.x - pointA.x;
C = pointA.x*pointB.y - pointA.y*pointB.x;
//代入点到直线距离公式
float distance = 0;
distance = ((float)abs(A*pointP.x + B*pointP.y + C)) / ((float)sqrtf(A*A + B*B));
return distance;
}2、直线的交点
利用点斜式表达直线,然后求解两条直线组成的方程组。

解得:
x0 = (b2 - b1) / (k1 - k2 + 1e-4)
y0 = k1 * x0 + b13、直线的夹角
已知直线 l1:y=k1x+b1,l2:y=k2x+b2,求这两条直线的夹角。
结论:
l1 到 l2 的转向角为 θ,则 tanθ=(k2- k1)/(1+ k1*k2)
l1 与 l2 的夹角为 θ,则 tanθ=∣(k2- k1)/(1+ k1*k2)∣
注意:两直线的夹角指的是两直线所成的小于90°的锐角,显然夹角公式中的“角”并不都是两直线的夹角。
边栏推荐
- Bitbucket installation configuration
- Code bug correction, char is converted to int high-order symbol extension, resulting in changes in positivity and negativity and values. Int num = (int) (unsigned int) a, which will occur in older com
- Technology cloud report won the special contribution award for the 10th anniversary of 2013-2022 of the "cloud Ding Award" of the global cloud computing conference
- IIC bus realizes client device
- The new content of the text component can be added through the tag_ Config set foreground and background colors
- AD637 usage notes
- 如何快速体验OneOS
- 700. Search in a Binary Search Tree. Sol
- Countdown to 92 days, the strategy for the provincial preparation of the Blue Bridge Cup is coming~
- Database recovery strategy
猜你喜欢

K210学习笔记(四) K210同时运行多个模型

boundary IoU 的计算方式

Granularity of blocking of concurrency control

Depth first DFS and breadth first BFS -- traversing adjacency tables

Search: Future Vision (moving sword)

Metaverse Ape获Negentropy Capital种子轮融资350万美元

Overview of database recovery

The American Championship is about to start. Are you ready?

Win11 runs CMD to prompt the solution of "the requested operation needs to be promoted"

CA certificate trampled pit
随机推荐
Concurrency control of performance tuning methodology
科技云报道荣膺全球云计算大会“云鼎奖”2013-2022十周年特别贡献奖
装饰器学习01
Interprocess communication in the "Chris Richardson microservice series" microservice architecture
[Yugong series] go teaching course in July 2022 004 go code Notes
AD637 usage notes
The simple problem of leetcode is to split a string into several groups of length K
从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
Livelocks and deadlocks of concurrency control
Microservice link risk analysis
A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition
Bitbucket installation configuration
Some tutorials install the database on ubantu so as not to occupy computer memory?
database mirroring
"Chris Richardson microservices series" uses API gateway to build microservices
Pl/sql basic syntax
Matlab draws a cute fat doll
Oracle hint understanding
Database recovery strategy
Web3为互联网带来了哪些改变?