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!

  • $\begingroup$ (geometry) tag is deprecated, see the tag-info. Please, try to choose other suitable tag. $\endgroup$ Aug 28, 2017 at 14:15
  • $\begingroup$ 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. $\endgroup$ Aug 28, 2017 at 14:38
  • $\begingroup$ 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. $\endgroup$ Aug 28, 2017 at 15:20
  • $\begingroup$ 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. $\endgroup$ Aug 28, 2017 at 19:34

1 Answer 1


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 |$.

For the two coordinates with lowest discrepancy, replace them with their nearest integers. For the coordinate with highest discrepancy, either replace it with the nearest integer or the second-nearest integer, depending on which one has the correct parity to make the coordinate sum even.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.