I'm already halfway done, but I thought I'd ask if anyone can point me towards existing source code for implementations of this (the geometry projections, line mitering etc.) I looked before starting but couldn't find anything...