rectpack2D icon indicating copy to clipboard operation
rectpack2D copied to clipboard

remove the pathological multiplier for being useless

Open 1e1001 opened this issue 2 years ago • 0 comments

the pathological multiplier is defined as

max(w, h) / min(w, h) × w × h

substituting for all possible orderings of w and h:

  • w < h: h / w × w × h = h × h
  • w > h: w / h × w × h = w × w
  • w = h: n / n × n × n = n × n (where n = w = h)

thus this is equvialent to max(w, h)²

because the comparator is only used for sorting the rectangles, and negative-sized rectangles are generally not used, max(w, h) and max(w, h)² will sort the rectangles in the same order

since max(x, y) is already one of the comparators, this means that the pathological ordering is redundant

1e1001 avatar Dec 06 '23 21:12 1e1001