if math.abs(grooveCenter.y) < distance then distance = math.abs(grooveCenter.y) pickedEdge = "north" end if math.abs(h - grooveCenter.y) < distance then distance = math.abs(h - grooveCenter.y) pickedEdge = "south" end if math.abs(grooveCenter.x) < distance then distance = math.abs(grooveCenter.x) pickedEdge = "east" end if math.abs(grooveCenter.x - w) < distance then distance = math.abs(grooveCenter.x - w) pickedEdge = "west" end