Source: http://www.pierrelux.net/documents/cours/4_2008/triangle_rectangle.pdf