[x3d-public] Ran into an interesting diff, X3DJSAIL JavaScript development, trailing 0s issue again.

yottzumm at gmail.com yottzumm at gmail.com
Fri Apr 7 04:26:10 PDT 2017


Setting strip trailing zeroes doesn’t seem to have any effect in some cases (JavaScript?). (You’ll have to add the setting it to the Java yourself).  I can strip trailing zeros in Java.  The JSON diff is fine, just the X3D product from X3DJSAIL has trailing zeros.  You can download X3Dautoclass.js from https://github.com/coderextreme/X3DJSONLD/

node xmldiff.js /c/x3d-code/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter10Geometry2D/ArcClose2D.X3d www_web3d_org/x3d/content/examples/X3dForWebAuthors/Chapter10Geometry2D/ArcClose2D.new.x3d
diff C:/x3d-code/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter10Geometry2D/ArcClose2D.X3d www_web3d_org/x3d/content/examples/X3dForWebAuthors/Chapter10Geometry2D/ArcClose2D.new.x3d
@3 /X3D/Scene/0/Transform/0/Shape/0/ArcClose2D/0/$/endAngle /X3D/Scene/0/Transform/0/Shape/0/ArcClose2D/0/$/endAngle
< 0
> 0.0
@3 /X3D/Scene/0/Transform/0/Shape/0/ArcClose2D/0/$/radius /X3D/Scene/0/Transform/0/Shape/0/ArcClose2D/0/$/radius
< 3
> 3.0
@3 /X3D/Scene/0/Transform/1/Shape/0/ArcClose2D/0/$/startAngle /X3D/Scene/0/Transform/1/Shape/0/ArcClose2D/0/$/startAngle
< 6
> 6.0
Different
Sent from Mail for Windows 10

From: Don Brutzman
Sent: Wednesday, April 5, 2017 3:08 AM
To: John Carlson
Cc: X3D Graphics public mailing list
Subject: Re: Ran into an interesting diff, X3DJSAIL JavaScript development,trailing 0s issue again.

OK now added to ConfigurationProperties, default is to strip trailing zeroes but now overidable for regular output:

ConfigurationProperties.setStripTrailingZeroes(boolean) and isStripTrailingZeroes()

http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/ConfigurationProperties.html#setStripTrailingZeroes-boolean-

http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/ConfigurationProperties.html#isStripTrailingZeroes--


On 3/31/2017 3:47 PM, John Carlson wrote:
> Can you make it a configuration property as to whether trailing zeroes are stripped on not?
>
> Thanks,
>
> John
>> On Mar 31, 2017, at 6:39 PM, Don Brutzman <brutzman at nps.edu <mailto:brutzman at nps.edu>> wrote:
>>
>> cc: x3d-public
>>
>> On 3/31/2017 12:38 PM, yottzumm at gmail.com <mailto:yottzumm at gmail.com> wrote:
>>> I don’ think the trailing 0 issue is finished yet.  Perhaps remove the feature?  It’s of little utility, I think.
>>>
>>> JS is not attached.  But original XML and XML produced from JS/Nashorn (X3DJSAIL) is.  Perhaps run the original through X3DLoader, dump to file and compare?  There should be a difference in small numbers.
>>
>> Excellent catch, as your excerpts show it was not handling exponents for scientific notation properly.  Now fixed.
>>
>> Incidentally these functions are exposed for X3DJSAIL programmer use.  I refactored them to be even more convenient, either providing a current value or else (via static method) converting any other value.
>>
>> ======================
>> Class org.web3d.x3d.jsail.fields.SFFloatObject
>> public java.lang.String stripTrailingZeroes()
>> public static java.lang.String stripTrailingZeroes(float value)
>> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/fields/SFFloat.html#stripTrailingZeroes--
>> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/fields/SFFloat.html#stripTrailingZeroes-float-
>>
>> Class org.web3d.x3d.jsail.fields.SFDoubleObject
>> public java.lang.String stripTrailingZeroes()
>> public static java.lang.String stripTrailingZeroes(double value)
>> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/fields/SFDouble.html#stripTrailingZeroes--
>> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/fields/SFDouble.html#stripTrailingZeroes-double-
>>
>> Utility method to strip trailing fractional zeroes from double value First converting an integer (such as 100) to String results in trailing decimal point and zero (such as 100.0) which then allows rest of regex filter to work.
>> ======================
>>
>> Fixed and deployed, hope your next tests run clean on this one!


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170407/ef43a660/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ArcClose2D.json
Type: application/json
Size: 4491 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170407/ef43a660/attachment-0001.json>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ArcClose2D.new.x3d
Type: application/octet-stream
Size: 2137 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170407/ef43a660/attachment-0003.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ArcClose2D.txt
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170407/ef43a660/attachment-0001.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ArcClose2D.x3d
Type: application/octet-stream
Size: 1987 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170407/ef43a660/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ArcClose2D.java
Type: application/octet-stream
Size: 6535 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170407/ef43a660/attachment-0005.obj>


More information about the x3d-public mailing list