[x3d-public] Basic examples. -geometry field should be array(MFNode) for RigidBody and according to X3DUOM

John Carlson yottzumm at gmail.com
Sun Jan 6 01:05:34 PST 2019


Fix X3D JSON hand generated schema to make the following errors.  I would tend towards going to the autogenerated schema, but it needs review, perhaps. This is part of the review of the schema.

Note these are under development,

BallBounce.json:            "@name":"warning",                                  
BallBounceSimple.json:            "@name":"warning",                            
BallJoint.json:            "@name":"warning",                                   
BodyGeometry.json:            "@name":"warning",                                
BounceTrimesh.json:            "@name":"warning",                               
CarDemoMain.json:            "@name":"warning",                                 
CarDemoMain.json:            "@name":"warning",                                 
CarDemoWorldModel.json:            "@name":"warning",                           
DoubleHingeJoint.json:            "@name":"warning",                            
MotorJoint.json:            "@name":"warning",                                  
MovingBody.json:            "@name":"warning",                                  
SingleHingeJoint.json:            "@name":"warning",                            
SliderJoint.json:            "@name":"warning",                                 
UniversalJoint.json:            "@name":"warning",                              

This error has been reported many times with out any action.
0 Ajv 3.2 Validation failed on C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/BallBounce.json                                                           
0 Ajv 3.2 Validation failed on C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/BallBounceSimple.json                                                     
0 Ajv 3.2 Validation failed on C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/BallJoint.json                                                            
0 Ajv 3.2 Validation failed on C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/BodyGeometry.json                                                         
0 Ajv 3.2 Validation failed on C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/BounceTrimesh.json                                                        
0 Ajv 3.2 Validation failed on C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/DoubleHingeJoint.json                                                     
0 Ajv 3.2 Validation failed on C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/MotorJoint.json                                                           
0 Ajv 3.2 Validation failed on C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/MovingBody.json                                                           
0 Ajv 3.2 Validation failed on C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/SingleHingeJoint.json                                                     
0 Ajv 3.2 Validation failed on C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/SliderJoint.json                                                          
0 Ajv 3.2 Validation failed on C:/x3d-code/www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/UniversalJoint.json                                                      
John


Sent from Mail for Windows 10

From: Brutzman, Donald (Don) (CIV)
Sent: Saturday, January 5, 2019 8:55 PM
To: John Carlson
Cc: X3D Graphics public mailing list
Subject: Re: [x3d-public] Basic examples. -geometry field should be array(MFNode) for RigidBody and according to X3DUOM

On 1/4/2019 9:04 PM, John Carlson wrote:
[...]
> When should -geometry be an SFNode and when should it be an MFNode (array in JSON Schema)?
> 
> Geometry is still an MFNode for NurbsSet and RigidBody in X3DUOM.

X3D Architecture Specification ISO 19775-1 governs all typing.

Strict typing in X3D is of course our best friend, it prevents Garbage In Garbage Out (GIGO) in scene content so that players and loaders can do the right thing exceedingly well.

To facilitate checking on important questions like this, the X3D Tooltips include convenience links to various references relating to each node.  Let's explore.

===================================
Shape geometry field is SFNode:

X3D Tooltips: Shape
	http://www.web3d.org/x3d/tooltips/X3dTooltips.html#Shape.geometry
  	[geometry accessType inputOutput, type SFNode, NULL node] [X3DGeometryNode]

X3D Architecture, 12.4.5 Shape
	http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/shape.html#Shape
	SFNode  [in,out] geometry   NULL     [X3DGeometryNode]

X3D Architecture, 11.3.5 X3DGeometryNode
	http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/rendering.html#X3DGeometryNode

Thus Shape geometry only accepts a single node which must in turn implement X3DGeometryNode interface - there are a lot of those.

===================================
RigidBody geometry field is MFNode:

X3D Tooltips: RigidBody
	http://www.web3d.org/x3d/tooltips/X3dTooltips.html#RigidBody
	TODO missing entry for geometry field

X3D Architecture, 37.4.10 RigidBody
	http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/rigid_physics.html#RigidBody
	MFNode     [in,out] geometry             []      [X3DNBodyCollidableNode]

X3D Architecture, 37.3.1 X3DNBodyCollidableNode
	http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/rigid_physics.html#X3DNBodyCollidableNode

Thus RigidBody geometry only accepts an array of nodes implementing X3DNBodyCollidableNode interface.  The only two such nodes are CollidableOffset and CollidableShape.

=====================================
Similar patterns for 27.4.9 NurbsSet:

	http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/nurbs.html#NurbsSet

   MFNode  [in]     addGeometry                [X3DNurbsSurfaceGeometryNode]
   MFNode  [in]     removeGeometry             [X3DNurbsSurfaceGeometryNode]
   MFNode  [in,out] geometry          []       [X3DNurbsSurfaceGeometryNode]

etc.

===================================

And so, as you well know, (...wait for it...) this is why we have X3D Unified Object Model (X3DUOM) to help define these specification requirements.  Excerpt documenting the RigidBody case follows, see definition for "geometry" field matching the above references.

	X3D Unified Object Model (X3DUOM)
	http://www.web3d.org/specifications/X3DUOM.html

	http://www.web3d.org/specifications/X3dUnifiedObjectModel-4.0.xml

<ConcreteNode name="RigidBody">
    <InterfaceDefinition specificationUrl="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/rigid_physics.html#RigidBody">
       <componentInfo name="RigidBodyPhysics" level="2"/>
       <Inheritance baseType="X3DNode"/>
       <field type="SFFloat"
              accessType="inputOutput"
              name="angularDampingFactor"
              default="0.001"/>
       <field type="SFVec3f"
              accessType="inputOutput"
              name="angularVelocity"
              default="0 0 0"/>
       <field type="SFBool"
              accessType="inputOutput"
              name="autoDamp"
              default="false"/>
       <field type="SFBool"
              accessType="inputOutput"
              name="autoDisable"
              default="false"/>
       <field type="SFVec3f"
              accessType="inputOutput"
              name="centerOfMass"
              default="0 0 0"/>
       <field type="SFFloat"
              accessType="inputOutput"
              name="disableAngularSpeed"
              default="0"/>
       <field type="SFFloat"
              accessType="inputOutput"
              name="disableLinearSpeed"
              default="0"/>
       <field type="SFTime"
              accessType="inputOutput"
              name="disableTime"
              default="0"
              minInclusive="0"/>
       <field type="SFBool"
              accessType="inputOutput"
              name="enabled"
              default="true"/>
       <field type="SFVec3f"
              accessType="inputOutput"
              name="finiteRotationAxis"
              default="0 1 0"/>
       <field type="SFBool"
              accessType="inputOutput"
              name="fixed"
              default="false"/>
       <field type="MFVec3f" accessType="inputOutput" name="forces"/>
       <field type="MFNode"
              accessType="inputOutput"
              name="geometry"
              acceptableNodeTypes="X3DNBodyCollidableNode"/>
       <field type="SFMatrix3f"
              accessType="inputOutput"
              name="inertia"
              default="1 0 0 0 1 0 0 0 1"/>
       <field type="SFFloat"
              accessType="inputOutput"
              name="linearDampingFactor"
              default="0.001"/>
       <field type="SFVec3f"
              accessType="inputOutput"
              name="linearVelocity"
              default="0 0 0"/>
       <field type="SFFloat" accessType="inputOutput" name="mass" default="1"/>
       <field type="SFNode"
              accessType="inputOutput"
              name="massDensityModel"
              default="NULL"
              acceptableNodeTypes="Sphere|Box|Cone"/>
       <field type="SFNode"
              accessType="inputOutput"
              name="metadata"
              default="NULL"
              acceptableNodeTypes="X3DMetadataObject"
              inheritedFrom="X3DNode"/>
       <field type="SFRotation"
              accessType="inputOutput"
              name="orientation"
              default="0 0 1 0"/>
       <field type="SFVec3f"
              accessType="inputOutput"
              name="position"
              default="0 0 0"/>
       <field type="MFVec3f" accessType="inputOutput" name="torques"/>
       <field type="SFBool"
              accessType="inputOutput"
              name="useFiniteRotation"
              default="false"/>
       <field type="SFBool"
              accessType="inputOutput"
              name="useGlobalGravity"
              default="true"/>
       <field type="SFString"
              accessType="inputOutput"
              name="DEF"
              inheritedFrom="DEF_USE"/>
       <field type="SFString"
              accessType="inputOutput"
              name="USE"
              inheritedFrom="DEF_USE"/>
       <field type="SFString"
              accessType="inputOutput"
              name="class"
              inheritedFrom="globalAttributes"/>
       <containerField default="bodies" type="">
          <enumeration value="body1" appinfo=""/>
          <enumeration value="body2" appinfo=""/>
          <enumeration value="bodies" appinfo=""/>
       </containerField>
       <ContentModel>
          <GroupContentModel name="ChildContentModelCore" minOccurs="0"/>
          <GroupContentModel name="RigidBodyContentModel" minOccurs="0"/>
       </ContentModel>
    </InterfaceDefinition>
</ConcreteNode>

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/20190106/0b66c7d2/attachment-0001.html>


More information about the x3d-public mailing list