Preparing to migrate to the new face implementation

Added tri.d, which is a reimplementation of face.d with algorithms I
didn't make up. Committing now so I can revert if this turns into a huge
mess.