[x3d-public] X3dToJson.xslt, X3dToPython.xslt, OrthoViewpoint fieldOfView

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Mon Jul 4 09:04:54 PDT 2022

Hi John.


1.	Commas are treated as whitespace in ClassicVRML encoding.
2.	Commas are not allowed within SF field values in XML encoding.  They
are allowed between SF field values in MF field lists.
3.	For really long numeric value arrays, this is a helpful restriction
that helps localize errors and support tuple counting by authors
4.	Validation tools (included X3D regexes) diagnose this.
5.	This is documented in X3D Tooltips, which are based on XML encoding.
Example excerpts follow.


*	X3D Tooltips: Field Types Table
*	https://www.web3d.org/x3d/tooltips/X3dTooltips.html#FieldTypesTable
*	SFColor, "Warning: comma characters within attribute values do not
pass strict validation, and comma separators are not included in canonical
*	MFColor, "Warning: comma characters within contained singleton
3-tuple SFColor values do not pass strict validation. 
Hint: comma characters are allowed as whitespace between individual SFColor
values in the list."


So once again we see that being careful and strict about X3D XML validation
is very helpful when converting to other encodings.


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://


From: John Carlson <yottzumm at gmail.com> 
Sent: Sunday, July 3, 2022 11:25 PM
To: Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>
Cc: X3D Graphics public mailing list <x3d-public at web3d.org>;
holger.seelig at gmail.com
Subject: Re: [x3d-public] X3dToJson.xslt, X3dToPython.xslt, OrthoViewpoint


My recall isn't that good, and I can't recall if /,/ - comma, is treated as
white space in some field values and not in others.   I guess this is yet to
be specified for new architecture documents-it should be discussed in
encoding and binding standards.   I do think one can use commas between SF
values in an MF value (not within) in XML.   I believe python requires
commas within and between tuples and lists.


It maybe good to have test cases which aren't possible with current


I think this came up before in reference to HAnim Motion.


"Be liberal in what you accept and conservative in what you generate."  -
Jon Postel.


I totally understand the frustration of dealing with corners of XSLT.


I'm hoping something like Tidy can clear this up.




On Sun, Jul 3, 2022 at 11:24 PM Brutzman, Donald (Don) (CIV)
<brutzman at nps.edu <mailto:brutzman at nps.edu> > wrote:

[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'


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


3.	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
<mailto: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 <http://faculty.nps.edu/brutzman> 


From: x3d-public <x3d-public-bounces at web3d.org
<mailto: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
<mailto:x3d-public at web3d.org> >; holger.seelig at gmail.com
<mailto:holger.seelig at gmail.com> 
Subject: [x3d-public] X3dToJson.xslt, X3dToPython.xslt, create3000/Library
Test ParticleSystem possible issues. Though may not pass!




Here are some issues with various X3dTo*.xslt:


grep fieldOfView VolumeEmitter.py


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




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


x3d.py package loaded, have fun with X3D Graphics!
Traceback (most recent call last):
nts\ParticleSystems\BoundedPhysicsModel.py", line 82, in <module>
  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




x3d.py package loaded, have fun with X3D Graphics!
Traceback (most recent call last):
nts\ParticleSystems\PointEmitter.py", line 92, in <module>
  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]



x3d.py package loaded, have fun with X3D Graphics!
Traceback (most recent call last):
nts\ParticleSystems\SurfaceEmitter.py", line 50, in <module>
2FuX1A%3D&reserved=0> ',
TypeError: MetadataSet.__init__() got an unexpected keyword argument


Original XML here:  Library/Tests/Components/ParticleSystems at main
d=0> . create3000/Library (github.com)


Attached generated python code.






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220704/27e40168/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5353 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220704/27e40168/attachment-0001.p7s>

More information about the x3d-public mailing list