[x3d-public] X3dToJson.xslt, X3dToPython.xslt, BooleanSequencer keyValue

John Carlson yottzumm at gmail.com
Mon Jul 4 14:56:23 PDT 2022


Changed subject to be more focused on what's not working. Thanks for the
effort on VolumeEmitter.x3d, which despite not passing the x3d validator,
products of the XML are passing jsonlint and python. Note that the
VolumeEmitter.json passes jsonlint (and I guess the jshint and jslint or
whatever you use), but it does not pass the Ajv validator.  Will respond on
the other thread if something comes up.

Note extra commas in MFBool outputs from X3dToPython.xslt and
X3dToJson.xslt.

On Mon, Jul 4, 2022 at 4:23 PM John Carlson <yottzumm at gmail.com> wrote:

> Note, the following examples are unvalidated. Beware!
>
> For example, from:
> https://raw.githubusercontent.com/create3000/Library/main/Tests/Components/ParticleSystems/BoundedPhysicsModel.x3d
>     <BooleanSequencer DEF='_4'
>         key='0, 0.3, 1'
>         keyValue='true, false'/>
>
> Translates to JSON:
>
> { "BooleanSequencer":
>             {
>               "@DEF":"_4",
>               "@key":[0,0.3,1],
>               "@keyValue":[true,,false]
>             }
>           },
>
> And python:
>
> BooleanSequencer(DEF='_4',key=[0,0.3,1],keyValue=[True,,False]),
>
>
>
> On Mon, Jul 4, 2022 at 3:47 PM John Carlson <yottzumm at gmail.com> wrote:
>
>> Don, I am merely asking whether Holger’s examples with MFFloat (as is)
>> and MFBool converted to JSON and Python are acceptable JSON and Python or
>> not.  Misdirecting to SFVec4f, MFColor and SFColor is not progress.
>>
>> Please work on X3dToJson.xslt and X3dToPython.xslt improving MFBool and
>> MFFloat handling, or state that inputs to the stylesheets should be
>> canonical.
>>
>> Thanks!
>>
>> John
>>
>> On Mon, Jul 4, 2022 at 3:27 PM Brutzman, Donald (Don) (CIV) <
>> brutzman at nps.edu> wrote:
>>
>>> I was able to enter this issue in Mantis:
>>>
>>>
>>>
>>>    - Mantis 1398 OrthoViewpoint fieldOfView type needs to be SFVec4f,
>>>    not MFFloat
>>>    - https://www.web3d.org/member-only/mantis/view.php?id=1398
>>>
>>>
>>>
>>> Have applied changes to X3D XML DOCTYPE, Schema, X3DUOM, stylesheets,
>>> tooltips, X3DJSAIL, X3DPSAIL, and X3D Ontology.
>>>
>>>
>>>
>>> Note that python syntax for a MFFloat 4-tuple is identical to a SFVec3f
>>> 4-tuple, e.g. (-1,-1,1,1)
>>>
>>>
>>>
>>> Dick and I will double-check this during next specification editors
>>> meeting, but I think all actions are complete.
>>>
>>>
>>>
>>> Hopefully your tests continue to proceed well, every small issue
>>> detected and fixed continues to increase model validity and robustness.
>>>
>>>
>>>
>>> Have fun with steadily improving X3D4 reliability!   8)
>>>
>>>
>>>
>>> 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 https://
>>> faculty.nps.edu/brutzman
>>>
>>>
>>>
>>> *From:* Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>
>>> *Sent:* Sunday, July 3, 2022 9:24 PM
>>> *To:* John Carlson <yottzumm at gmail.com>
>>> *Cc:* X3D Graphics public mailing list <x3d-public at web3d.org>;
>>> holger.seelig at gmail.com; Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>
>>> *Subject:* RE: [x3d-public] X3dToJson.xslt, X3dToPython.xslt,
>>> OrthoViewpoint fieldOfView
>>>
>>>
>>>
>>> [Changed subject line for readability/searchability – this is about
>>> OrthoViewpoint fieldOfView]
>>>
>>>
>>>
>>>    1. Invalid source XML in your .x3d excerpt: simple types should not
>>>    have commas within them.
>>>
>>>
>>>
>>>    - OrthoViewpoint fieldOfView='-1.5, -1.5, 1.5, 1.5'
>>>
>>>
>>>
>>>    1. OrthoViewpoint fieldOfView is defined as MFFloat in specification
>>>    but ought to be SFVec4f, since it must always have four numbers defining
>>>    ordered values (minimum_x, minimum_y, maximum_x, maximum_y).
>>>
>>>
>>>
>>> I am somehow locked out of mantis and so can’t verify what we previously
>>> said about this (if anything).  Seems like a simple specification erratum.
>>>
>>>
>>> Correlation confirmation: TextureProjectorParallel has fieldOfView
>>> SFVec4f.  Meanwhile Viewpoint GeoViewpoint and TextureProjector have
>>> SFFloat.
>>>
>>>
>>>
>>>    1. I think that the various fieldOfView types are handled in the
>>>    stylesheet s correctly now, checked in.
>>>
>>>
>>>
>>> I have also applied a tentative fix to X3D DOCTYPE, Schema, Tooltips and
>>> X3DUOM, but will wait to deploy any updates (including X3DJSAIL, X3DPSAIL)
>>> until checking mantis to confirm status.
>>>
>>>
>>>
>>> Thanks John for reporting this error, very helpful.
>>>
>>>
>>>
>>> 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 https://
>>> faculty.nps.edu/brutzman
>>>
>>>
>>>
>>> *From:* x3d-public <x3d-public-bounces at web3d.org> *On Behalf Of *John
>>> Carlson
>>> *Sent:* Sunday, July 3, 2022 12:10 AM
>>> *To:* X3D Graphics public mailing list <x3d-public at web3d.org>;
>>> holger.seelig at gmail.com
>>> *Subject:* [x3d-public] X3dToJson.xslt, X3dToPython.xslt,
>>> create3000/Library Test ParticleSystem possible issues. Though may not pass!
>>>
>>>
>>>
>>> Don,
>>>
>>>
>>>
>>> Here are some issues with various X3dTo*.xslt:
>>>
>>>
>>>
>>> grep fieldOfView VolumeEmitter.py
>>> VolumeEmitter.py:
>>>  OrthoViewpoint(description='OrthoViewpoint',fieldOfView=-1.5,-1.5,1.5,1.5),
>>>
>>>
>>>
>>> $ grep fieldOfView VolumeEmitter*
>>> VolumeEmitter.json:              "@fieldOfView":-1.5,-1.5,1.5,1.5
>>> VolumeEmitter.x3d:        fieldOfView='-1.5, -1.5, 1.5, 1.5'/>
>>>
>>>
>>>
>>> In the JSON, the MFFloat is does not appear to be an array, with []
>>> around the numbers.
>>>
>>>
>>>
>>> In the python, there's no tuple or list markers denoting a tuple or list
>>>
>>>
>>>
>>> Note in the XML, both the "," and the space is separating the floats in
>>> the MFFloat.  I haven't seen that the MFBools with ", " as separators is
>>> working, but perhaps the problem is more general.
>>>
>>>
>>>
>>> Links to XML below.
>>>
>>> ====================================================
>>>
>>> Holger,
>>>
>>>
>>>
>>> I fully realize that these are test samples, and they may not pass, thus
>>> when I convert x3d  to python and run, these errors may appear (which may
>>> be totally valid).
>>>
>>>
>>>
>>> BoundedPhysicsModel.py
>>> x3d.py package 4.0.64.1 loaded, have fun with X3D Graphics!
>>> Traceback (most recent call last):
>>>   File
>>> "C:\Users\john\X3DJSONLD\src\main\python\net\x3djsonld\Library\Tests\Components\ParticleSystems\BoundedPhysicsModel.py",
>>> line 82, in <module>
>>>
>>> emitter=ConeEmitter(position=(0,-3,0),direction=(1,4,0),angle=0.4,speed=0.2,mass=3200),
>>>   File "C:\Users\john\X3DJSONLD\venv\lib\site-packages\x3d\x3d.py", line
>>> 29419, in __init__
>>>     self.direction = direction
>>>   File "C:\Users\john\X3DJSONLD\venv\lib\site-packages\x3d\x3d.py", line
>>> 29450, in direction
>>>     assertLessThanEquals('direction', direction, 1)
>>>   File "C:\Users\john\X3DJSONLD\venv\lib\site-packages\x3d\x3d.py", line
>>> 1847, in assertLessThanEquals
>>>     assert isLessThanEquals(value, maximum), fieldName + '=' +
>>> str(value) + ' fails assertLessThanEquals maximum=' + str(maximum)
>>> AssertionError: direction=(1, 4, 0) fails assertLessThanEquals maximum=1
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> PointEmitter.py
>>> x3d.py package 4.0.64.1 loaded, have fun with X3D Graphics!
>>> Traceback (most recent call last):
>>>   File
>>> "C:\Users\john\X3DJSONLD\src\main\python\net\x3djsonld\Library\Tests\Components\ParticleSystems\PointEmitter.py",
>>> line 92, in <module>
>>>     WindPhysicsModel(speed=0.8,gustiness=0.8,turbulence=2),
>>>   File "C:\Users\john\X3DJSONLD\venv\lib\site-packages\x3d\x3d.py", line
>>> 99589, in __init__
>>>     self.turbulence = turbulence
>>>   File "C:\Users\john\X3DJSONLD\venv\lib\site-packages\x3d\x3d.py", line
>>> 99643, in turbulence
>>>     assertZeroToOne('turbulence', turbulence)
>>>   File "C:\Users\john\X3DJSONLD\venv\lib\site-packages\x3d\x3d.py", line
>>> 1818, in assertZeroToOne
>>>     assert isZeroToOne(value), str(fieldName) + '=' + str(value) + '
>>> fails assertZeroToOne requirements: value(s) must be in range [0..1]'
>>> AssertionError: turbulence=2 fails assertZeroToOne requirements:
>>> value(s) must be in range [0..1]
>>>
>>>
>>>
>>>
>>>
>>> SurfaceEmitter.py
>>> x3d.py package 4.0.64.1 loaded, have fun with X3D Graphics!
>>> Traceback (most recent call last):
>>>   File
>>> "C:\Users\john\X3DJSONLD\src\main\python\net\x3djsonld\Library\Tests\Components\ParticleSystems\SurfaceEmitter.py",
>>> line 50, in <module>
>>>     MetadataSet(DEF='children',name='children',reference='
>>> http://titania.create3000.de
>>> <https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Ftitania.create3000.de%2F&data=05%7C01%7Cbrutzman%40nps.edu%7C21c0ec8ed9424e5b9d1808da5cc31d7f%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637924290510977644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=%2F4uxzeZzuYzvUqHz8AJaKk0zHgBuEfyrAyNzWK5XrYs%3D&reserved=0>
>>> ',
>>> TypeError: MetadataSet.__init__() got an unexpected keyword argument
>>> 'appearance'
>>>
>>>
>>>
>>> Original XML here:  Library/Tests/Components/ParticleSystems at main ·
>>> create3000/Library (github.com)
>>> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcreate3000%2FLibrary%2Ftree%2Fmain%2FTests%2FComponents%2FParticleSystems&data=05%7C01%7Cbrutzman%40nps.edu%7C21c0ec8ed9424e5b9d1808da5cc31d7f%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637924290510977644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=AXA6SvrhXPQysoFmBpTi8vsUFZPbJC9gW60AGXCyfW8%3D&reserved=0>
>>>
>>>
>>>
>>> Attached generated python code.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220704/2dca4129/attachment-0001.html>


More information about the x3d-public mailing list