double getPositionOffset(double row) {
        double deltaY = row % 2.0;
        if (deltaY <= 1.0 / 3.0) {
            return 0;
        }
        if (deltaY <= 2.0 / 3.0) {
            return 1.5 * deltaY - 0.5;
        }
        if (deltaY < 4.0 / 3.0) {
            return 0.5;
        }
        if (deltaY < 5.0 / 3.0) {
            return 2.5 - 1.5 * deltaY;
        }
        return 0;
    }