当前位置:网站首页>Distance from point to line intersection and included angle of line
Distance from point to line intersection and included angle of line
2022-07-05 22:19:00 【alex1801】
1、 The distance between a point and a line
P The straight line AB Distance of .
//P For a little off the line ,AB Two endpoints for the segment
float getDist_P2L(CvPoint pointP, CvPoint pointA, CvPoint pointB)
{
// Find the linear equation
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;
// Substitute the formula of the distance from the point to the straight line
float distance = 0;
distance = ((float)abs(A*pointP.x + B*pointP.y + C)) / ((float)sqrtf(A*A + B*B));
return distance;
}2、 The intersection of lines
Using point oblique expression to express straight line , Then solve the equations composed of two straight lines .

Solution :
x0 = (b2 - b1) / (k1 - k2 + 1e-4)
y0 = k1 * x0 + b13、 The included angle of the straight line
We know straight lines l1:y=k1x+b1,l2:y=k2x+b2, Find the angle between these two lines .
Conclusion :
l1 To l2 The steering angle of is θ, be tanθ=(k2- k1)/(1+ k1*k2)
l1 And l2 An Angle of θ, be tanθ=∣(k2- k1)/(1+ k1*k2)∣
Be careful : The included angle of two straight lines refers to the angle formed by two straight lines less than 90° Acute angle of , Obviously, in the included angle formula “ horn ” It's not always the angle between two straight lines .
边栏推荐
- A substring with a length of three and different characters in the leetcode simple question
- 50. Pow(x, n). O(logN) Sol
- Overview of concurrency control
- Storage optimization of performance tuning methodology
- Performance testing of software testing
- Platformio create libopencm3 + FreeRTOS project
- How can Bluetooth in notebook computer be used to connect headphones
- Oracle advanced query
- Pl/sql basic case
- [Yugong series] go teaching course in July 2022 004 go code Notes
猜你喜欢

The difference between MVVM and MVC

Nacos installation and service registration

Decorator learning 01

90后测试员:“入职阿里,这一次,我决定不在跳槽了”

The statistics of leetcode simple question is the public string that has appeared once

AD637 usage notes

Concurrency control of performance tuning methodology

Recovery technology with checkpoints

装饰器学习01

What if the files on the USB flash disk cannot be deleted? Win11 unable to delete U disk file solution tutorial
随机推荐
Platformio create libopencm3 + FreeRTOS project
Web3为互联网带来了哪些改变?
Advantages and disadvantages of the "Chris Richardson microservice series" microservice architecture
Decorator learning 01
Sparse array [matrix]
笔记本电脑蓝牙怎么用来连接耳机
Meituan dynamic thread pool practice ideas, open source
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award
A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition
Serializability of concurrent scheduling
Metaverse Ape获Negentropy Capital种子轮融资350万美元
Index optimization of performance tuning methodology
CA certificate trampled pit
[groovy] mop meta object protocol and meta programming (execute groovy methods through metamethod invoke)
Understand the basic concept of datastore in Android kotlin and why SharedPreferences should be stopped in Android
Interview questions for famous enterprises: Coins represent a given value
数据泄露怎么办?'华生·K'7招消灭安全威胁
Oracle views the data size of a table
Three "factions" in the metauniverse