You will write three functions about a point and a line. The first finds the foot of the perpendicular, the second finds the distance, and the third finds the two points of the line that are at a given distance from the point.
The idea. For the line through with direction , the foot of the perpendicular from is with . The distance is . A point of the line at distance from lies from the foot, along the line.
Your tasks.
foot(P, A, b). Return the foot as a tuple of three numbers.distance_to_line(P, A, b). Return the length of .points_at(P, A, b, s). Return the two points , with the point of the larger parameter first.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…