ok, so i understand a little bit now how the sorting of points works, and i have even managed to sort a list of points. but only by using the x component. how would i sort by the y, or z component?
On Oct 10, 2:45 am, David Rutten <[EMAIL PROTECTED]> wrote: > You can only sort things which have stable (in)equality and smaller- > than/larger-than relationships. The most common example is numbers, > but it is also possible to sort text (of course under the hood, text > is numbers as well). If you need to sortpoints, what you're actually > doing is extracting all the x-coordinates (numbers), andsortingthat > list instead. In the meantime, you make sure that whenever you swap > two numbers in the keys list in order to improve the ascending nature > of the list, you also swap the same twopoints. That way, you can sort > a list ofpoints. > > Another example would be to sort curves. Curves themselves are not > very comparable, so instead you calculate the length for each curve > (you get a list of numbers), sort the length array and simultaneously > sort the curve array. Let's say we have 6 curves, each of which with > the different length: > > {L, XS, M, XL, S, XXL} > > the lengths are: > > {50, 1, 25, 60, 5, 200} > > If we sort the list of numbers, we get a very predictable: > > {1, 5, 25, 50, 60, 200} > > and if we make sure that the cure list is kept 'in synch' during the > the sort-operation, it will have become: > > {XS, S, M, L, XL, XXL} > > The list that is used forsortingis called the 'keys-list', the list > that is sorted synchronously is called the 'values-list'. > > Often the hardest thing is to create a meaningful keys-list, > especially if you need to sort a multi-dimensional dataset as opposed > to a linear one... > > -- > David Rutten > Robert McNeel & Associates > > On Oct 10, 8:05 am, oompa_l <[EMAIL PROTECTED]> wrote: > > > thanks taz. it seemed like it should be extremely easy, I just > > couldn't figure it out. Still, I have to admit that I dont really > > understand what the sorted "keys" are...it doesnt sound like you're > > completely certain either. > > > thanks > > G