Grasshopper

algorithmic modeling for Rhino

hi!

when creating a very simple member index with points there seems to be some locations for the point that work perfectly and some others not

here you can see the same points in a position that work and same ones in a position that doesn't work.

and as you can see in the panel we are talking about the exact same point...

Views: 1236

Attachments:

Replies to This Discussion

Just because two numbers look the same, doesn't mean they are the same. Numbers are formatted to a limited number of decimal places (otherwise they are always really hard to read). If you format them without loss of data, you can see they are not the same points after all:

Hi David,

You're right, they're not the same number, but what is strange is that they should be.

Those numbers are the coordinates of points,which should be the same point.

There's 2 curves, the region intersection is intersecting:

curve A with itself and with curve B (two resulting area centers),

and it's also intersecting

curve B with itself and with curve A (other two resulting area centers).

how can A-B be different than B-A?

maybe I'm missing something in my logical way of putting it... it's driving me crazy haha

Floating point arithmetic is not exact. Every time you perform some calculation you will get some errors in the least significant digits, and these errors aren't necessarily symmetric. The more calculations you perform, the worse the errors get. Especially subtraction is prone to a particularly severe type of error called catastrophic cancellation.

You don't have to understand the details of this, you just need to remember that when comparing floating point numbers, you almost never want to rely on exact equality. You must always pick the right tolerances for the problem at hand and treat values as equal if they fall within the same tolerance.

I feel like this "problem" comes up enough that it almost warrants a voronoi-style user warning message on first use. 

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