unexpected results when using ReferenceIntersector , and the Elevation of Levels .

unexpected results when using ReferenceIntersector , and the Elevation of Levels .

jonathan.taVCBM2
Enthusiast Enthusiast
326 Views
2 Replies
Message 1 of 3

unexpected results when using ReferenceIntersector , and the Elevation of Levels .

jonathan.taVCBM2
Enthusiast
Enthusiast

Hi all, 

I am trying to figure out if a column (vertical ones only at the moment) reaches a floor or a beam on both ends.

I am finding the expected Floors or Beams but the distance is slightly (0.0000000000040000) shorter than the column. There seem to be no difference if the column is attached at it's top and base to elements or not.

I obtained the elevation parameters of the relevant levels and saw the following : 

 

Level 2 300.0000000000010000
Level 1 -0.0000000000024364

While the Levels property show 0.0 or 300.0

 

On top of that - the distance between the intersected floor and beam differ from calculated height of the column , by a similar small number . Since all elements are set in relation to the levels (see screenshot)  this really shouldn't happen. 

jonathantaVCBM2_0-1650369247437.png

 

The only way I can think is to round all the values to 0.0001 format using Math.Round(value , 4) , I am not too thrilled with this solution.  Any other ideas how to go about this ? 

Thanks , Jonathan

 

Jonathan Talisman
BIM Developer
0 Likes
Accepted solutions (1)
327 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni
Accepted solution

Every floating point calculation performed on a digital computer that has a problem dealing with very small calculation errors such as you describe is fundamentally flawed. 

 

Every floating point calculation performed on a digital computer needs to be implemented in such a way that it can gracefully handle such errors.

 

It will help a lot to study this problem in more depth before trying to address your issue directly.

 

You can start by reading the short article about floating point arithmetic accuracy problems on Wikipedia:

 

https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems

 

The Building Coder has frequently discussed such problems and one simple approach to address them called 'fuzz':

 

https://www.google.com/search?q=fuzz&as_sitesearch=thebuildingcoder.typepad.com

   

Once you have taken a look at the material suggested above, you will be able to easily resolve your problem yourself.

 

Good luck and have fun,

 

Jeremy

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

jonathan.taVCBM2
Enthusiast
Enthusiast

Thanks Jeremy, 
I understand the gist of the real numbers accuracy and hardware 
limitations, I am familiar with the XYZ/UV IsAlmostEqualTo methods , I'll read more on the other fuzzy comparisons suggested in these links, pretty sure I'll have some fun.
Thanks again,  Jonathan. 

Jonathan Talisman
BIM Developer