find angle between tangent and line
27 次查看(过去 30 天)
显示 更早的评论
I wanted to finding angle between camera center line (green vertical line ) and tangent(red line) drawn to the parabolic points (blue dots).But I am not finding any intersection point in it.Anyone can help me in finding angle ?
0 个评论
回答(1 个)
Milan Bansal
2023-10-3
Hi,
I understand that you are trying to find the angle between the vertical line and the tangent line as you are unable to find the intersection point.
If the equations of the lines are present in "y = mx + b" format, find the intersection point of the lines as shown in the code below.
x0 = (b2-b1)/(m1-m2); %find the x point
y0 = m1*x0+b1;
Find another point on each of the two lines, (x1, y1) and (x2, y2).
Use the "atan2" function to find the angle between the lines using these points and the intersection point (x0, y0) calculated above.
v1 = [x1, y1, 0] - [x0, y0, 0];
v2 = [x2, y2, 0] - [x0, y0, 0];
Theta = atan2(norm(cross(v1, v2)), dot(v1, v2));
Refer to the below MathWorks documentation link to learn more about "atan2" function.
Hope it helps!
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!