Re: Sorting point-arrays by rows and columns, cont.

• To: mathgroup at smc.vnet.net
• Subject: [mg124126] Re: Sorting point-arrays by rows and columns, cont.
• From: Shizu <slivo.vitz at msa.hinet.net>
• Date: Tue, 10 Jan 2012 05:58:15 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```> Thanks to Fred Simons for this method. Seems to work
> fine and seems to
> be one of the simplest to use in this particular
> case. Still wish that
> Sort would just accept a list of successive
> conditions to break ties,
> as SortBy does. (SortBy, however, applies the
> functions to every
> element and _then_ sorts, not what we want here.)
>
> In[3]:= Sort[hexPts, #1[[2]] < #2[[
> 2]] \[Or] (#1[[2]] == #2[[2]] && #1[[1]] <=
> ]] <= #2[[1]]) & ]
>
> Out[3]= {{-(1/2), -(Sqrt[3]/2)}, {1/2, -(Sqrt[3]/2)},
> {-1, 0}, {0,
>   0}, {1, 0}, {-(1/2), Sqrt[3]/2}, {1/2, Sqrt[3]/2}}
>

Finally, I understood what Chris wanted -- you wanted to sort by Y and then X coordinates.  I think Fred's method is the most elegant so far.  My procedure is kind of complex, so I didn't post it here.  What Chris expected from Mathematica doesn't exist.  And so, you may want to invent your own Sort[] or amend the original Sort[] or SortBy[], and share the result with us?

```

• Prev by Date: Re: For a variety of plotting experiences, maybe bugs?
• Next by Date: Graphics bounding box in source coordinates?
• Previous by thread: Re: Sorting point-arrays by rows and columns, cont.
• Next by thread: Mantaining the same form