# Closest vertex in a 3D fcc lattice

The 3D fcc (face-centered-cubic) lattice, which has the same packing ratio as the 3D hexagonal close packed lattice, has the following 12 vectors connecting each vertex with its neighbors:

$(1,-1,0), (-1,1,0), (-1,-1,0), (1,1,0)$

$(1,0,-1), (-1,0,1), (-1,0,-1), (1,0,1)$

$(0,1,-1), (0,-1,1), (0,-1,-1), (0,1,1)$

If I have an arbitrary point $(x,y,z)$, I need a piecewise formula for finding which vertex in the lattice is the closest to it. I do not want an "algorithmic" solution, i.e. calculating distances to many vertices or computing voronoi cells.

Thank You!

• (geometry) tag is deprecated, see the tag-info. Please, try to choose other suitable tag. Aug 28, 2017 at 14:15
• An algorithmic solution is more easily expressible. If you are looking for a purely arithmetic formula without conditionals, you will have something that is very hard to implement. What are you going to do with such a formula if you get it? Gerhard "Thinks The Goal Is Wrong" Paseman, 2017.08.28. Aug 28, 2017 at 14:38
• I'm fine with conditionals, which is why I said piecewise. I just want a simple method that does not require distance calculations to multiple points. Aug 28, 2017 at 15:20
• Then start with the central cube. You will find that deciding on the orthant, followed by looking at (but not necessarily calculating) the Voronoi cells will lead to a simple algorithm based on relative size of coordinates. You can use translation to do this in other cubes. Gerhard "First, Make The Problem Local" Paseman, 2017.08.28. Aug 28, 2017 at 19:34

Recall that the face-centred cubic lattice comprises all vectors in $\mathbb{Z}^3$ whose coordinate sum is even.
Let $(x, y, z) \in \mathbb{R}^3$. For each coordinate, define the discrepancy to be the distance to the closest integer, i.e. $\delta(x) := |x - \lfloor x \rceil |$.