The Formation of Columnar Joints on Earth and Mars