3MFConsortium / lib3mf

lib3mf is an implementation of the 3D Manufacturing Format file standard
http://3mf.io
BSD 2-Clause "Simplified" License
228 stars 92 forks source link

SetDecimalPrecision not working for values above 9 decimal places #363

Closed DavidJohnMcLean closed 2 weeks ago

DavidJohnMcLean commented 4 months ago

Below is a table showing the sudden change in vertex values beyond 9 decimal places, values 6-9 work as expected but suddenly the values change at 10:

6  <vertex x="-44.822084"      y="27.634122"      z="2.597792" />
7  <vertex x="-44.8220832"     y="27.6341216"     z="2.5977922" />
8  <vertex x="-44.82208256"    y="27.63412224"    z="2.59779216" />
9  <vertex x="-44.822081536"   y="27.634122752"   z="2.597792256" />
10 <vertex x="-9.6254689280"   y="5.9343826944"   z="0.5578716160" />
11 <vertex x="-0.96254689280"  y="0.59343826944"  z="0.05578716160" />
12 <vertex x="-0.096254689280" y="0.059343826944" z="0.005578716160" />

I notice in the PR that created this API that we cast a very large number to an int, when it should probably be a long long (m_nPutDoubleFactor). I stongly suspect this will fix the issue.

This issue could be fixed by doing the above but really it would be nicer to allow doubles to be input (this issue)

Or nicer still, store the vertex values (and everything else) in binary instead of XML and lose no data as a result.

gangatp commented 2 months ago

This PR #369 fixes your suggestion for changing int to long long.