how do i find the angle between a vector and a line?
1 view (last 30 days)
Show older comments
a=(1,-1,2)
Line (x-1)/2 = (y-4)/5 =(z-6)/8
0 Comments
Answers (1)
Roger Stafford
on 6 Nov 2014
Edited: Roger Stafford
on 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.)
0 Comments
See Also
Categories
Find more on 3-D Scene Control in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!