how do i find the angle between a vector and a line?

1 view (last 30 days)
a=(1,-1,2)
Line (x-1)/2 = (y-4)/5 =(z-6)/8

Answers (1)

Roger Stafford
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.)

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!