Sorry for this simple question but I can't find a way to solve it in a simple way. I've found "point location" solutions, but there must be a much simpler way to do this, given that it's a regular grid and not arbitrary polygons.
As seen in the attached picture, I have a rhombus shaped grid. They have 90 degree angles, so they're squares, but I think the word rhombus is more appropriate here because everyone assumes something else when thinking of a square grid. The diagonal of a rhombus can be of any size (although if it makes the solution simpler (unlikely), my diagonals are always an even number). In this picture it's 6.
The center of a rhombus cell is indicated by a green square.
Given a random point on the graph, I need to get the coordinates of the center of the rhombus cell that the point is in. If the point is on the edge of 2 cells, it can favor either of them. 1 http://puu.sh/7Ej6V.png