A computer finds the four centres of any triangle in a moment. In this lab you write the functions for the area, the centroid, the circumcentre and the orthocentre, and the checker tries them on the triangle of Example 1 and on random triangles.
Your tasks.
area, return the area from the corner formula.centroid, return the average of the three corners, as a pair.circumcentre, solve the two perpendicular-bisector equations for the pairs and .orthocentre, use .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…