How can I find the angle between two vectors that answer should be between 0 to 2*pi
Ältere Kommentare anzeigen
We have two points on a circle in 3D space, as well as the center point. How can we calculate the angle between the vector from the center to point one and the vector from the center to point two, with the calculation starting from vector one counter-clockwise to vector two? In other words, the angle should be calculated such that if our first vector is from (0,0,0) to (0,-1,0) and the second vector is from (0,0,0) to (0,0,-1), the angle should be 270 degrees or 3*pi/2, not 90 degrees.
Akzeptierte Antwort
Weitere Antworten (1)
Luca Ferro
am 31 Mär. 2023
Bearbeitet: Luca Ferro
am 31 Mär. 2023
0 Stimmen
This question is a duplicate of: https://ch.mathworks.com/matlabcentral/answers/16243-angle-between-two-vectors-in-3d
As suggested there you can trya variation like this:
angle=180*atan2(norm(cross(a,b)), dot(a,b))
where a,b are your vectors.
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!