Did you ask AI about it? Maybe one of all the models we have today gives a clue.
r
romainguy
06/15/2025, 9:00 AM
Your Zs are floats but you use a List of Int, so the sorting is done after casting, which could explain the results you are getting. Also this is quite inefficient
o
oligarchokapi
06/15/2025, 9:28 PM
@Stefan Oltmann i didn't, but it would indeed have given a clue about the mistake, which was that the sorting key was the vertex index, rather than the z-coordinate itself. using
minOf
instead of
minBy
does what i intended
oligarchokapi
06/15/2025, 9:35 PM
@romainguy the list of ints are indices into the vertex array. no casting, just a semi-opaque layer of indirection. i'll agree with you that it's inefficient, in addition to being not very readable