当前位置:网站首页>点到直线的距离直线的交点及夹角
点到直线的距离直线的交点及夹角
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°的锐角,显然夹角公式中的“角”并不都是两直线的夹角。
边栏推荐
- Platform bus
- Create a virtual machine on VMware (system not installed)
- Blocking of concurrency control
- Getting started with microservices (resttemplate, Eureka, Nacos, feign, gateway)
- Two stage locking protocol for concurrency control
- 多家呼吸机巨头产品近期被一级召回 呼吸机市场仍在增量竞争
- Learning of mall permission module
- Recovery technology with checkpoints
- Nacos installation and service registration
- A long's perception
猜你喜欢

Leetcode simple question: find the nearest point with the same X or Y coordinate

Solutions for unexplained downtime of MySQL services

Pl/sql basic case

PyGame practical project: write Snake games with 300 lines of code

Analysis of the problem that the cookie value in PHP contains a plus sign (+) and becomes a space

Livelocks and deadlocks of concurrency control

Database recovery strategy

Win11运行cmd提示“请求的操作需要提升”的解决方法

Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award

Web3为互联网带来了哪些改变?
随机推荐
Oracle advanced query
[Yugong series] go teaching course 003-ide installation and basic use in July 2022
A trip to Suzhou during the Dragon Boat Festival holiday
The difference between MVVM and MVC
CA certificate trampled pit
Win11运行cmd提示“请求的操作需要提升”的解决方法
Microservice link risk analysis
Analyse des risques liés aux liaisons de microservices
Recovery technology with checkpoints
Metaverse Ape获Negentropy Capital种子轮融资350万美元
[Chongqing Guangdong education] National Open University autumn 2018 0088-21t Insurance Introduction reference questions
Common interview questions of JVM manufacturers
Official clarification statement of Jihu company
When the industrial Internet era is truly mature, we will look at the emergence of a series of new industrial giants
Two stage locking protocol for concurrency control
MySQL连接断开报错MySQLdb._exceptions.OperationalError 4031, The client was disconnected by the server
[agc009e] eternal average - conclusion, DP
Regular expressions and re Libraries
Multiplexing of Oracle control files
Performance testing of software testing