Convert copy_plane to a non-member function