Some of the textbelow is a lua adaptation of
Author: Thomas Schwarzl (aka hermitC)
Author's game development blog
Some other parts are adaptation from different sources:
#Practical Geometry Algorithms. by Daniel Sunday PhD (parts on segment rays and polygons)
#Graphics Gems I, II, III, IV
Lua adaption by Alexandre Boulay alexandre.boulay59@gmail.com