How to measure angle of intersection ?

조회 수: 2 (최근 30일)
thineesh Vijayakumar
thineesh Vijayakumar 2019년 4월 9일
댓글: A. Sawas 2019년 4월 12일
I need to calculate the angle of intersection . Can anyone share the coding ? How to find the angle (red shaded region) ? Thank you.ggg.JPG
  댓글 수: 2
Rik
Rik 2019년 4월 9일
Do you have the locations of the two lines involved? Then you could fit two linear functions and use mathematics to find the angle.
A. Sawas
A. Sawas 2019년 4월 9일
I think you have asked an identical question before "How to measure angle between two lines?".
I reposted the solution below and added some comments. Please comment on the solution if this is not what you are looking for.

댓글을 달려면 로그인하십시오.

채택된 답변

A. Sawas
A. Sawas 2019년 4월 9일
편집: A. Sawas 2019년 4월 9일
Assuming that the two lines are defined by four points P1, P2, P3, and P4 as such, the first line is L1(P1,P2) and the second line L2 (P3,P4) you can find the angle using the following code:
% define the points as [x,y]
P1 = [1,1];
P2 = [5,5];
P3 = [5,2];
P4 = [1,3];
% dx = x1 - x2;
dx1 = P1(1)-P2(1);
dx2 = P3(1)-P4(1);
% dy = y1 - y2;
dy1 = P1(2)-P2(2);
dy2 = P3(2)-P4(2);
% the angle (in degrees) between the lines:
angle = 180 - acosd((dx1*dx2+dy1*dy2)/(sqrt(dx1^2+dx2^2)*sqrt(dy1^2+dy2^2)));
disp(angle);
  댓글 수: 2
thineesh Vijayakumar
thineesh Vijayakumar 2019년 4월 12일
Thank you :)
A. Sawas
A. Sawas 2019년 4월 12일
You are welcome :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by