A set of simple MetaPost macros for the task. While the task is not itself difficult to program, it is felt that many users will be happy to have a library for the job..