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

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Sat Jan 5 18:55:52 PST 2019


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


More information about the x3d-public mailing list