lib/sqed_utils.rb in sqed-0.4.3 vs lib/sqed_utils.rb in sqed-0.4.4

- old
+ new

@@ -9,10 +9,13 @@ # like `[0,1,2]` # # @param frequency_stats [Array] # like [1,2,3] # + # @param width_factor [Float] + # + # # @param max_width [Integer] # required, the width of the image in question # # See tests. This code does a rough job of smoothing out boundaries that seem to # be biased on one side or the other. Definitely could be refined to use a more @@ -31,30 +34,25 @@ return frequency_stats if (width_pct * 100) <= 2.0 a = (m - v0).abs b = (v2 - m).abs - c = a * width_factor - d = b * width_factor - largest = (a > b ? a : b) l = (m - b / 2) l = 0 if l < 0 r = (m + a / 2) r = max_width if r > max_width - x = a * width_factor - y = b * width_factor + c = a * width_factor + d = b * width_factor [ - x > largest ? l : v0, + c > largest ? l : v0, m, - y > largest ? r : v2 + d > largest ? r : v2 ] end - - end