You will write functions for the dot product of two direction vectors, the acute angle between two lines and a test that says whether two lines are perpendicular, parallel or neither. The cross product is already written for you.
The idea. The acute angle has . Lines are perpendicular when the dot product is , and parallel when the cross product is the zero vector.
Your tasks.
dot(u, v). Add the three products of matching components.angle_between(u, v). Return the acute angle in degrees.relation(u, v). Return "perpendicular", "parallel" or "neither".Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…