This project is read-only.

Input precision causing errors

May 8, 2014 at 11:39 PM
I've been using the Triagle.NET classes to mesh some geometry generated by my own code. I ran across a frustrating problem, where, triangulation would (seemingly randomly) fail with errors.
To test what was happening, I output my geometry to a .poly file, and ran it in the Mesh Explorer, where, without fail, it would mesh every time.
After some investigation I discovered that it was related to the number of significant figures in my numbers. A double will use 17 significant figures, but when it's output to string it gets truncated to 15 sig figs by default. So the .poly files would always have 15 sig figs, and would always mesh properly, while using 17 sig figs is hit-and-miss. I updated my code to truncate the last two significant figures from my coordinates, and, lo-and-behold, it stopped crashing.
Might be worth investigating for future updates.
May 9, 2014 at 9:47 AM
Edited May 9, 2014 at 11:17 AM
You have to expect those kind of problems on a finite precision machine (with double precision IEEE 754 standard, you get approximately 15 significant digits).