当前位置:网站首页>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 + b1
3、 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 .
边栏推荐
- What if the files on the USB flash disk cannot be deleted? Win11 unable to delete U disk file solution tutorial
- The real situation of programmers
- FBO and RBO disappeared in webgpu
- Unique occurrence times of leetcode simple questions
- Alternating merging strings of leetcode simple questions
- [groovy] mop meta object protocol and meta programming (Introduction to groovyobject interface | introduction to metaclass | implementation of class methods using groovyobject invokemethod)
- MySQL连接断开报错MySQLdb._exceptions.OperationalError 4031, The client was disconnected by the server
- Web3为互联网带来了哪些改变?
- Talking about MySQL index
- Overview of concurrency control
猜你喜欢
Matlab draws a cute fat doll
Leetcode simple question: find the nearest point with the same X or Y coordinate
Decorator learning 01
Granularity of blocking of concurrency control
Blocking protocol for concurrency control
What if the files on the USB flash disk cannot be deleted? Win11 unable to delete U disk file solution tutorial
MySQL连接断开报错MySQLdb._exceptions.OperationalError 4031, The client was disconnected by the server
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
Getting started with microservices (resttemplate, Eureka, Nacos, feign, gateway)
The American Championship is about to start. Are you ready?
随机推荐
MySQL连接断开报错MySQLdb._exceptions.OperationalError 4031, The client was disconnected by the server
Did you brush the real title of the blue bridge cup over the years? Come here and teach you to counter attack!
AD637使用笔记
Nacos installation and service registration
点到直线的距离直线的交点及夹角
90后测试员:“入职阿里,这一次,我决定不在跳槽了”
Kubernetes Administrator certification (CKA) exam notes (IV)
Stored procedures and stored functions
The statistics of leetcode simple question is the public string that has appeared once
Granularity of blocking of concurrency control
C language knowledge points link
GWT module may need to be (RE) compiled reduce - GWT module may need to be (RE) compiled reduce
Pl/sql basic case
A substring with a length of three and different characters in the leetcode simple question
微服務鏈路風險分析
How to reverse a string fromCharCode? - How to reverse String. fromCharCode?
Text组件新增内容通过tag_config设置前景色、背景色
Platform bus
K210 learning notes (IV) k210 runs multiple models at the same time
科技云报道荣膺全球云计算大会“云鼎奖”2013-2022十周年特别贡献奖