// face returns face ID from 0 to 5 containing the r. For points on the // boundary between faces, the result is arbitrary but deterministic. func face(r r3.Vector) int { abs := r.Abs() id := 0 value := r.X if abs.Y > abs.X { id = 1 value = r.Y } if abs.Z > math.Abs(value) { id = 2 value = r.Z } if value < 0 { id += 3 } return id }