当前位置:网站首页>点到直线的距离直线的交点及夹角
点到直线的距离直线的交点及夹角
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°的锐角,显然夹角公式中的“角”并不都是两直线的夹角。
边栏推荐
- Sub total of Pico development
- The difference between MVVM and MVC
- PyGame practical project: write Snake games with 300 lines of code
- Performance testing of software testing
- How to quickly experience oneos
- 极狐公司官方澄清声明
- Promql demo service
- Cobaltstrike builds an intranet tunnel
- Search: Future Vision (moving sword)
- Serializability of concurrent scheduling
猜你喜欢

【愚公系列】2022年7月 Go教学课程 003-IDE的安装和基本使用

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

Nacos installation and service registration

AD637 usage notes

多家呼吸机巨头产品近期被一级召回 呼吸机市场仍在增量竞争

IIC bus realizes client device

Database recovery strategy

ICMP introduction

AD637使用笔记

Ad637 notes d'utilisation
随机推荐
FBO and RBO disappeared in webgpu
Leetcode simple question: find the nearest point with the same X or Y coordinate
database mirroring
Shell script, awk condition judgment and logic comparison &||
科技云报道:算力网络,还需跨越几道坎?
MySQL disconnection reports an error MySQL ldb_ exceptions. OperationalError 4031, The client was disconnected by the server
K210学习笔记(四) K210同时运行多个模型
EBS Oracle 11g cloning steps (single node)
2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*
Blocking protocol for concurrency control
Nacos installation and service registration
The Blue Bridge Cup web application development simulation competition is open for the first time! Contestants fast forward!
Business learning of mall order module
每日刷题记录 (十四)
How to develop and introduce applet plug-ins
Talking about MySQL index
Ad637 notes d'utilisation
Implementation technology of recovery
Comment développer un plug - in d'applet
Pl/sql basic case