Grasshopper

algorithmic modeling for Rhino

Hi, in a script of mine sort points is not working properly. The attached image below is not photoshoped ;) pos. 2 and 3 are not sorted in z from min-max.

If I internalise the data and copy the function to a new sheet it runs properly...

Is it known that sort points isn't reliable?

Is it a decimal error? As in pos. 2 is 0.00000000001 closer than 3 in x?
This could only be the case if when I internalise data it rounds the number, which isn't the case ?

Views: 524

Replies to This Discussion

It is reliable. The numbers you see in the panels are rounded to 6 decimal places. There must be differences in the remaining digits of the x or y coordinates that affect the sort order.

I'll need to see the actual data before I can comment in specifics.

I think sort point tries to sort Y-coord 0.0 in a "random" order. Would be better if sort points left the order of identical values intact. Look at the attached. 

Attachments:

Attachments:

Ah, the attached solution is neater.

Attachments:

Sort may indeed mess up order, but only for items that sort exactly the same. This is not the case for your points. If the X and Y coordinates are the same for two points, then only Z is considered as a sorting key.

The problem (as shown in the file I posted) is that your Y coordinates are not always exactly zero. When Y values differ, even if only by a tiny bit), then Z values no longer matter.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service