Added convert_to_cartesian function