Re: [csswg-drafts] [css-grid] Can the sizing algo be made to deal with this

_definition: `d_x_y` is the distance between line grid `x` and line grid `y`_

---

I think the "correct" to solve this is to
1.  set up the following equations that ensure the grid is a grid (gaps omitted for simplicity):
    ```
    d_1_2 + d_2_3 = d_1_3
    d_2_3 + d_3_4 = d_2_4
    d_3_4 + d_4_5 = d_3_5
    d_1_2 + d_2_3 + d_3_4 = d_1_4
    d_2_3 + d_3_4 + d_5_4 = d_2_5
    d_1_2 + d_2_3 + d_3_4 + d_5_4 = d_1_5
    ```
2. for each pair of lines between which at least one item spans, set up the following inequation: `d_x_y >= max( all the items between the lines x and y)`
    ```
    d_1_3 >= max(item_1) = max(300) = 300
    d_3_5 >= max(item_2) = max(150) = 150
    d_2_4 >= max(item_3) = max(150) = 250
    ```
3. We try to solve that system of inequations while minimizing `d_first_last`.

Depending on the specifics of the system, there may be one solution, or a range of solutions: your example has one degree of liberty, and can vary between  50px <= `d_1_2@ <=  200px, my example had a single solution.

I'm a long way out of school, but maybe some of the more mathematically inclined among us known the algorithms that can be used to solve that, their complexity, whether they are parallelization friendly, and whether the way we pick one solution when there is a range gives us a different choice of algorithms?


-- 
GitHub Notification of comment by frivoal
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2356#issuecomment-379206560 using your GitHub account

Received on Friday, 6 April 2018 09:55:20 UTC