how do i find the angle between a vector and a line?
Ältere Kommentare anzeigen
a=(1,-1,2)
Line (x-1)/2 = (y-4)/5 =(z-6)/8
Antworten (1)
Roger Stafford
am 6 Nov. 2014
Bearbeitet: Roger Stafford
am 6 Nov. 2014
b = [2,5,8]; % vector along line
ang = atan2(norm(cross(a,b)),dot(a,b)); % Angle in radians between vectors a and b
(Note: If you take a vector b along the opposite direction along the line, the resulting angle will be the supplement of the above - that is, it will be pi minus the above angle. Which answer is correct depends on your definition of the angle between a vector and a line.)
Kategorien
Mehr zu Simulink 3D Animation 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!