The C++, Haskell, and Coq files here are independent implementations of a clipping algorithm to solve the USA Computing Olympiad problem 'Closed Fences' (aka fence4).
I wrote about this in detail back in 2013 here and again in a different context in 2019 here