Array#combination is ruby19 method. But it's probably a good thing you
didn't get my "solution" to run. If I remove irrelevant points in
advance, I get somewhat close to Frank's solution with respect to
speed but it still lags behind.
Anyway, I can offer some accuracy tests with random point sets (size
1..100).
s_tml2.rb | s_billk.rb | s_billk2.rb | s_lionel.rb | s_frank.rb |
s_justin.rb
Min: 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0004 |
0.0000
Max: 0.0225 | 0.0795 | 0.0422* | 0.0140 | 0.0063* |
0.0817
Avg: 0.0027 | 0.0297 | ------- | 0.0017 | 0.0058 |
0.0115
[*] Slightly invalid results, maybe the center isn't quite where it
should be?
x/y-range is -0.5..0.5
Since the number of test runs is rather small, you should take into
account a margin of 30% or so.
s_lionel is Lionel's very first submission because I have difficulties
to integrate the later solutions.
s_tml2 is my second solution that starts at the center of the longest
cord. The first solution yields results mostly identical to Justin's
submission.
Regards,
Thomas.