Inspired by Tsoding's ball example in his linear algebra repo https://github.com/tsoding/la/blob/master/ball.c