Direction between points from [0,360]
이전 댓글 표시
I have 5 points which has (x,y) position and want to calculate the direction from one point to the other. I used atan2d but the output is confusing. Is there any way to bypass the different signs for counterclockwise and clockwise and get the output to be between [0,360] from clockwise only?
Thanks
채택된 답변
추가 답변 (1개)
Ameer Hamza
2020년 9월 25일
편집: Ameer Hamza
2020년 9월 25일
Add 2pi to negative values.
x = -1;
y = -1;
theta = atan2(y, x);
if theta < 0
theta = theta + 2*pi;
end
댓글 수: 1
John D'Errico
2020년 9월 25일
The OP apparently wants results in DEGREES.
카테고리
도움말 센터 및 File Exchange에서 Lengths and Angles에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!