Code examples from http://libgeodecomp.org