Define a coordinate transform function