[x3d-public] JSON schema enhancement?

Roy Walmsley roy.walmsley at ntlworld.com
Sun Aug 13 06:46:57 PDT 2017


John,

 

It’s a simple question. However, the answer is not so simple!

 

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.

 

However, what is the maximum and minimum? I know, you’ll say that the maximum is 2^31-1, i.e. 2147483647, and the minimum is -2147483468. And 99.9% of the time, in practice, that is what it will be. But what does the specification say.

 

Let’s look at ISO/IEC 19775-1:2013, clause 5.3.7 SFInt32 and MFInt32.

Reference: http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/fieldsDef.html#SFInt32AndMFInt32

 

The text in the first paragraph reads:

 

“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.”

 

We can also look at the corresponding text in ISO/IEC 19776-1:2015, clause 5.8 SFInt32 and MFInt32

Reference: http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfFields.html#SFInt32

 

The text is similar.

 

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.

Reference: https://en.wikipedia.org/wiki/Signed_number_representations

 

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.

Reference: http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/geometry3D.html#IndexedFaceSet

 

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.

 

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). 

Reference: http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/fullProfile.html#t-NodesForConforming

 

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.

 

In conclusion, your simple question is not so easily answered. I’ve tried to present some of the relevant material. All comments weolcome.

 

All  the best,

 

Roy

 

From: John Carlson [mailto:yottzumm at gmail.com] 
Sent: 11 August 2017 21:06
To: Roy Walmsley <roy.walmsley at ntlworld.com>; Don Brutzman <brutzman at nps.edu>; X3D Graphics public mailing list <x3d-public at web3d.org>
Subject: JSON schema enhancement?

 

Roy, can we get an enhancement to the JSON schema limiting all SFInt32 and MFInt32 fields to the appropriate numeric range?  Thanks!

 

Thanks!

 

John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170813/06f1fd7c/attachment-0001.html>


More information about the x3d-public mailing list