computational geometry routines