We are working on a projection system that takes 3 dimensions and spits out hexagons. When we looked through the values, it seems that for each movement of any one of the three axes x, y and z, it could either result is moving to next valid hexagon point, or could end in an invalid point. I am attaching a screenshot (with green showing the valid points, and red showing invalid points). Furthermore, we note that each valid point is either a Y point or an inverted-Y point.
What we aren't able to crack is the formula that converts the 3 coordinates into one of the following results: (invalid, valid-Y, valid-inverted-Y)
Is there a function to map this coordinate system?

or programming version: