How to convert to px?

后端 未结 7 1983
-上瘾入骨i
-上瘾入骨i 2020-11-28 09:56

I need to convert to px.

Example only(not correct): is equivalent to 12px.

Is th

7条回答
  •  情书的邮戳
    2020-11-28 10:26

    Using the data points from the accepted answer you can use polynomial interpolation to obtain a formula.

    WolframAlpha Input: interpolating polynomial {{1,.63},{2,.82}, {3,1}, {4,1.13}, {5,1.5}, {6, 2}, {7,3}}

    Formula: 0.00223611x^6 - 0.0530417x^5 + 0.496319x^4 - 2.30479x^3 + 5.51644x^2 - 6.16717x + 3.14

    And use in Groovy code:

    import java.math.*
    def convert = {x -> (0.00223611*x**6 - 0.053042*x**5 + 0.49632*x**4 - 2.30479*x**3 + 5.5164*x**2 - 6.167*x + 3.14).setScale(2, RoundingMode.HALF_UP) }
    (1..7).each { i -> println(convert(i)) }
    

提交回复
热议问题