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

Don Brutzman brutzman at nps.edu
Fri Mar 31 15:39:13 PDT 2017


cc: x3d-public

On 3/31/2017 12:38 PM, 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!


> BTW does someone know an easy way to attach JS files to emails?
>
> John

I just drag/drop or use menu item in Thunderbird.

> ================./www_web3d_org/x3d/content/examples/Basic/development/PhysicalUnitRepresentationPrototypes.new.x3d ==========================
>
> node xmldiff.js -w /c/x3d-code/www.web3d.org/x3d/content/examples/Basic/development/PhysicalUnitRepresentationPrototypes.x3d ./www_web3d_org/x3d/content/examples/Basic/development/PhysicalUnitRepresentationPrototypes.new.x3d
>
> diff C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/development/PhysicalUnitRepresentationPrototypes.x3d ./www_web3d_org/x3d/content/examples/Basic/development/PhysicalUnitRepresentationPrototypes.new.x3d
>
> @2 /X3D/Scene/0/Transform/0/$/scale/0/0 /X3D/Scene/0/Transform/0/$/scale/0/0
>
> < 1.0E-10
>
>> 1.0E-1
>
> @2 /X3D/Scene/0/Transform/0/$/scale/1/0 /X3D/Scene/0/Transform/0/$/scale/1/0
>
> < 1.0E-10
>
>> 1.0E-1
>
> @2 /X3D/Scene/0/Transform/0/$/scale/2/0 /X3D/Scene/0/Transform/0/$/scale/2/0
>
> < 1.0E-10
>
>> 1.0E-1
>
> @2 /X3D/Scene/0/ProtoDeclare/0/ProtoBody/0/Transform/0/$/scale/0/0 /X3D/Scene/0/ProtoDeclare/0/ProtoBody/0/Transform/0/$/scale/0/0
>
> < 1.0E-10
>
>> 1.0E-1
>
> @2 /X3D/Scene/0/ProtoDeclare/0/ProtoBody/0/Transform/0/$/scale/1/0 /X3D/Scene/0/ProtoDeclare/0/ProtoBody/0/Transform/0/$/scale/1/0
>
> < 1.0E-10
>
>> 1.0E-1
>
> @2 /X3D/Scene/0/ProtoDeclare/0/ProtoBody/0/Transform/0/$/scale/2/0 /X3D/Scene/0/ProtoDeclare/0/ProtoBody/0/Transform/0/$/scale/2/0
>
> < 1.0E-10
>
>> 1.0E-1
>
> Different


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



More information about the x3d-public mailing list