Calculating # or Rows and Columns

前端 未结 6 896
北海茫月
北海茫月 2021-01-04 13:27

I have a # of images that I\'m stitching together into a sprite sheet, how can I calculate the number of rows and columns to fit equally in an even rectangle (no blank space

6条回答
  •  一个人的身影
    2021-01-04 13:41

    Well looking at it if the number is prime you want to have 1 row with x columns where x is the prime number. Else if the number is a perfect square the rows would be the square root of the number by the square root of the number (9 == 3x3) . Else factor the remainder.

提交回复
热议问题