<div dir="auto"><div>This is for SFImage, sorry.</div><div dir="auto"><br></div><div dir="auto">John<br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On Aug 13, 2017 10:00 AM, "John Carlson" <<a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto">Well I'm trying to convert a large integer into something that will fit in an int in Java through python, and afaik, it can't be hex.   Can someone help convert JSON to DOM to Java, JavaScript and Python?</div><div dir="auto"><br></div><div dir="auto">Thanks!</div><font color="#888888"><div dir="auto"><br></div><div dir="auto">John</div></font></div><div class="elided-text"><div class="gmail_extra"><br><div class="gmail_quote">On Aug 13, 2017 9:46 AM, "Roy Walmsley" <<a href="mailto:roy.walmsley@ntlworld.com" target="_blank">roy.walmsley@ntlworld.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-GB" link="#0563C1" vlink="#954F72"><div class="m_-3883048082267794957m_-3809465758443317426WordSection1"><p class="MsoNormal"><span>John,<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>It’s a simple question. However, the answer is not so simple!<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>Yes, we could easily add maximum and minimum values to the JSON schema for all xFInt32 fields. They would all have to be done individually, notwithstanding any more limited requirements.<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>However, what is the maximum and minimum? I know, you’ll say that the maximum is 2^31-1, i.e. <a href="tel:(214)%20748-3647" value="+12147483647" target="_blank">2147483647</a>, and the minimum is -<a href="tel:(214)%20748-3468" value="+12147483468" target="_blank">2147483468</a>. And 99.9% of the time, in practice, that is what it will be. But what does the specification say.<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>Let’s look at ISO/IEC 19775-1:2013, clause 5.3.7 SFInt32 and MFInt32.<u></u><u></u></span></p><p class="MsoNormal"><span>Reference: <a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/fieldsDef.html#SFInt32AndMFInt32" target="_blank">http://www.web3d.org/documents<wbr>/specifications/19775-1/V3.3/<wbr>Part01/fieldsDef.html#<wbr>SFInt32AndMFInt32</a><u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>The text in the first paragraph reads:<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal">“The SFInt32 field specifies one 32-bit integer. The MFInt32 field specifies zero or more 32-bit integers. SFInt32 and MFInt32 fields are signed integers.”<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">We can also look at the corresponding text in ISO/IEC 19776-1:2015, clause 5.8 SFInt32 and MFInt32<u></u><u></u></p><p class="MsoNormal">Reference: <a href="http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#SFInt32" target="_blank">http://www.web3d.org/documents<wbr>/specifications/19776-1/V3.3/<wbr>Part01/EncodingOfFields.html#<wbr>SFInt32</a><u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">The text is similar.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span>And that is all the standards say on the subject. What they don’t tell us is what arithmetic system is in use. The vast majority use two’s-complement arithmetic. Hence, the maximum and minimum values are as above. But, that is not the only possibility. There could be one’s-complement or offset binary, for example.<u></u><u></u></span></p><p class="MsoNormal"><span>Reference: <a href="https://en.wikipedia.org/wiki/Signed_number_representations" target="_blank">https://en.wikipedia.org/wiki/<wbr>Signed_number_representations</a><u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>Finally, let’s look at one example of the use of an MFInt32 field. Find the node signature for the IndexedFaceSet node, at clause 13.3.6 IndexedFaceSet in ISO/IEC 19775-1:2013.<u></u><u></u></span></p><p class="MsoNormal"><span>Reference: <a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/geometry3D.html#IndexedFaceSet" target="_blank">http://www.web3d.org/documents<wbr>/specifications/19775-1/V3.3/<wbr>Part01/components/geometry3D.<wbr>html#IndexedFaceSet</a><u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>In particular, look at any of the four MFInt32 fields, e.g. colorIndex, coordIndex, normalIndex, texCoordIndex. Notice the limits given by the standard. They are [0,inf) or -1. Technically, therefore, if X3D file in, say, XML, ClassicVRML, or JSON has one value of, for example, 9876543210, then this is technically a legal value, and should pass validation. It would be up to the browser implementation to report that it can’t handle such a large number.<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>All that said, we might also consider the requirements for the profiles. Let’s look at the full profile, which can be found at Annex F in ISO/IEC 19775-1:2013. Table F.3 lists the minimum support requirements for nodes in the full profile (which is all nodes). <u></u><u></u></span></p><p class="MsoNormal"><span>Reference: <a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/fullProfile.html#t-NodesForConforming" target="_blank">http://www.web3d.org/documents<wbr>/specifications/19775-1/V3.3/<wbr>Part01/fullProfile.html#t-Node<wbr>sForConforming</a><u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>Scanning down to the IndexedFaceSet node, looking at the second column, which has the heading “X3D File Limit”, we see that the file should be limited to a maximum of 15000 indices. Now we have a different limit, which is way  below the two’s-complement maximum.<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>In conclusion, your simple question is not so easily answered. I’ve tried to present some of the relevant material. All comments weolcome.<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>All  the best,<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><span>Roy<u></u><u></u></span></p><p class="MsoNormal"><span><u></u> <u></u></span></p><p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> John Carlson [mailto:<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>] <br><b>Sent:</b> 11 August 2017 21:06<br><b>To:</b> Roy Walmsley <<a href="mailto:roy.walmsley@ntlworld.com" target="_blank">roy.walmsley@ntlworld.com</a>>; Don Brutzman <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>>; X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br><b>Subject:</b> JSON schema enhancement?<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">Roy, can we get an enhancement to the JSON schema limiting all SFInt32 and MFInt32 fields to the appropriate numeric range?  Thanks!<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Thanks!<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">John<u></u><u></u></p></div></div></div></div></blockquote></div></div>
</div></blockquote></div><br></div></div></div>