Grasshopper

algorithmic modeling for Rhino

Please see attached images. I was getting some issue from the output of deconstruct point when testing its equality. My guess is that there is some small floating point error that the equality component cannot pick up. When I used integer the equality test worked. Is there some better way to prevent this? 

Views: 2162

Replies to This Discussion

Hello

This was driving me nuts in a similar case.

i had to do the following  to get past it. it is not nice when dealing with a big set.

i had not figured the integer workaround, but in my case could not work because i wanted to match floating number without the rounding that takes place when using integer.

cheers

alex

There is also this simple math that solves it per Mateusz suggestion, as I also needed floating points. 


nice one!

The most common solution is to compute the absolute difference between two values and compare it to a threshold value.

Abs(A-B) < 1e-12

Could this perhaps be folded in the Similarity component? To choose between a Relative value (percentages, as it is currently) and an absolute threshold?

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