Source: http://people.math.harvard.edu/~marcinek/Ma21a/Week9/triplecoords.pdf