functions for mapping to the fundamental domain