Added coordinate transformation code.

Closes #4.