Source: http://maths.vivien.free.fr/Documents/4e/CR4_triangle_rectangle.pdf