Hi. Am I making a stupid mistake here? I believe this is a correct usage of sort_by but the result doesn’t seem to be correct.
a = [Geom::Point3d.new(12.333, 0.530369, 25.3869), Geom::Point3d.new(12.3615, 0.530369, 21.1437),
Geom::Point3d.new(12.3903, 0.530369, 16.8721), Geom::Point3d.new(12.3242, 0.530369, 26.7057), Geom::Point3d.new(12.3332, 0.530369, 25.3588)]
result = a.sort_by{|pt3d| pt3d.x}
=> [Point3d(12.3242, 0.530369, 26.7057), Point3d(12.3332, 0.530369, 25.3588),
Point3d(12.333, 0.530369, 25.3869), Point3d(12.3615, 0.530369, 21.1437), Point3d(12.3903, 0.530369, 16.8721)]
The third point in result should come before the second point, no?