A class to handle encoding cube positions.