OK, here's a small problem. I would love to get some help.
I have a view and the viewport size will vary depending on the user's screen resolution. In the viewport, the need to include the N-box, which stands from top to left to the right next to each other and take all horizontal positions in the viewport. Now if all boxes can have the same size, it would be easy, just divide the viewport width by N and you're far away.
The problem is that each box should be 10% smaller than the box, for example if the viewport is 271 pixels wide and there are three boxes then I will be returned [100, 90, 81]
So I need an algorithm that when the width is handed over, the number of viewport and horizontal boxes will give an array width, in which each box is needed to fill the width of the viewport and each box Size is reduced to 10%.
The answer is good in any oo language. Chris
Chris
def box_size (width, Num_boxes): first_box = width / (10 * (1 - 0.9 ** n)) returns [first_box * 0.9 ** in the range for i (n)]> gt; & Gt; & Gt; Box_size (100, 5) [24.4194280 9 6993972, 21.9774852872 94574, 19779736758565118, 17.801763082708607, 16.021586774437747] & gt; & Gt; & Gt; Zodiac (_) 100.00000000000001
You want to clear the accuracy, or you can convert it to an integer, but you should do this.
Comments
Post a Comment