Vortex Simulation Toolkit - File Format

As complex scene is described most conveniently within an external file. Vortex already provides a simple xml-parser to load scenes which was much improved for NEO/NST in order to simplify scenes descriptions. Nevertheless the meaning of most xml-tags has not changed, so that we only describe the overall syntax of a scene file here and refer to the Vortex documentation for more details.

<ME>
    <WORLD>
        <!-- definition of global world properties -->
    </WORLD>

    <IMPORT>
        <!-- importing other xml-files allows to build complex scenes hierachically -->
    </IMPORT>

    <GEOMETRIES>
        <!-- definition of model primitives -->
        <BOX> ... </BOX>
        <SPHERE> ... </SPHERE>
        <CYLINDER> ... </CYLINDER>
        <PLANE> ... </PLANE>
    </GEOMETRIES>

    <SOLID>
        <!-- definition of solid bodies -->
    </SOLID>

    <!-- definition of joints between bodies -->
    <BSJOINT> ... </BSJOINT>  <!-- ball-and-socket-joint -->
    <HINGE> ... </HINGE>           <!-- hinge joint -->
    <PRISMATIC> ... </PRISMATIC> <!-- prismatic joint -->
    <SPRING> ... </SPRING>                  <!-- spring -->
    <LINEAR1> ... </LINEAR1>            <!-- restricts movement to a plane -->
    <LINEAR2> ... </LINEAR2>            <!-- restricts movement to a line -->

    <GRAPHICPRIMS>
        <!-- definition of graphic primitives -->
        <BOX> ... </BOX>
        <SQUARE> ... </SQUARE>
        <SPHERE> ... </SPHERE>
        <CYLINDER> ... </CYLINDER>
        <CONE> ... </CONE>
        <FRUSTUM> ... </FRUSTUM>
        <LINE> ... </LINE>
        <FRAME> ... </FRAME>
    </GRAPHICPRIMS>

    <GRAPHICS>
        <!-- definition of graphics-only objects -->
    </GRAPHICS>
</ME>

<WORLD>
    <GRAVITY> x, y, z </GRAVITY>
    <EPSILON> x </EPSILON>
    <GAMMA> x </GAMMA>

    <!-- The following parameters determine, when a body is disabled -->
    <VEL_THRESH> x </VEL_THRESH>
    <ANGVEL_THRESH> x </ANGVEL_THRESH>
    <ACC_THRESH> x </ACC_THRESH>
    <ANGACC_THRESH> x </ANGACC_THRESH>
    <ALIVE_WINDOW> n </ALIVE_WINDOW>

    <MATERIAL>
        <!-- material name, given both NUM and ID changes the name of n-th material -->
        <NUM> n </NUM> <!-- material index -->
        <ID> name </ID> <!-- material name -->
        <DENSITY> x </DENSITY>
   </MATERIAL>

    <MATERIALPAIR>
        <!-- definition of friction properties for contacts between solids of material1 and material2 -->
        <IDS> material1, material2 </IDS>
        <RESTITUTION> x </RESTITUTION>
        <SOFTNESS> x </SOFTNESS>
        <FORCE> x </FORCE> <!-- maximal friction force -->
        <FORCES> x </FORCES> <!-- maximal friction forces for both directions seperately -->

        <!-- friction coefficients (not used yet) -->
        <STATIC_FRICTION> x </STATIC_FRICTION>
        <DYNAMIC_FRICTION> x </DYNAMIC_FRICTION>
        <FRICTION> muStatic, muDynamic </FRICTION>

    </MATERIALPAIR>
</WORLD>

Because several solids usually share common geometry forms, Vortex uses these model primitives, called geometries to build solids. Each defined geometry is identified and accessed through a unique name specified within the <ID> tag. The following geometry primitives are supported:

<GEOMETRIES>
<BOX>
        <ID> name </ID>
        <DIMS> x, y, z </DIMS>
    </BOX>

<SPHERE>
        <ID> name </ID>
        <RADIUS> x </RADIUS>
    </SPHERE>

<CYLINDER>
        <ID> name </ID>
        <RADIUS> x </RADIUS>
        <HEIGHT> x </HEIGHT>
        <PARAMS> radius, height </PARAMS>
    </CYLINDER>

<PLANE> <!-- a plane restricts all dynamics to the upper halfplane (z>0) -->
        <ID> name </ID>
    </PLANE>
</GEOMETRIES>
 

A solid can be a simple, i.e. composed from one geometry primitive, or a "composite" solid, composed from several geometry parts. Each used geometry is referenced by its name and must be defined before its use. The location is given by a 4x4 transformation matrix or the explicit position and rotation. Using the tag <RELTO> all location information is relative to the specified solid.

<SOLID>
    <ID> name </ID>

    <RELTO> solid name </RELTO> <!-- location relative to given solid -->
    <TM> 4x4 matrix, column-wise </TM>
    <POS> x, y, z </POS>
    <ROT> 3x3 rotation matrix, column-wise </ROT>
    <QUAT> w, x, y, z </QUAT> <!-- quaternion -->
    <EULER> x, y, z </EULER> <!-- three euler angles (in radians or with explicit '°' after number in degrees) -->

    <GEOMETRY_ID> geometry name </GEOMETRY_ID> <!-- a single geometry -->
    <PART> ... </PART> <!-- or several parts -->

    <MATERIAL> material name </MATERIAL>
    <DENSITY> x </DENSITY>
    <COLOR> name, alpha </COLOR>  or  <COLOR> r,g,b,alpha </COLOR>
    <FROZEN> 0 | 1 </FROZEN> <!-- create a static object, default=0 -->

    <BODY>
        <ENABLED> 0 | 1 </ENABLED> <!-- enabled dynamic simulation, default=1 -->
        <MASS> m </MASS>
        <!-- inertia tensor, given by the six different inertia moments -->
        <MOI> xx, xy=yx, xz=zx, yy, yz=zy, zz </MOI>
        <COM> x, y, z </COM> <!-- offset for center of mass, relative to solid's frame -->
        <FORCE> x, y, z </FORCE> <!-- initial force -->
        <TORQUE> x, y, z </TORQUE> <!-- initial torque -->
        <VEL> x, y, z </VEL> <!-- initial linear velocity -->
        <ANGVEL> x, y, z </ANGVEL> <!-- initial angular velocity -->
        <DAMP> linear damping, angular damping </DAMP>
        <FASTSPIN> x, y, z </FASTSPIN>
    </BODY>

    <!-- with each solid a graphic object can be associated, by default this graphic
              object corresponds to the appropriate geometry primitive -->
    <GRAPHIC> ... </GRAPHIC>
</SOLID>

<PART>
    <GEOMETRY_ID> geometry name </GEOMETRY_ID> <!-- a single geometry -->

    <TM> 4x4 matrix, column-wise </TM>
    <POS> x, y, z </POS>
    <ROT> 3x3 rotation matrix, column-wise </ROT>
    <QUAT> w, x, y, z </QUAT> <!-- quaternion -->
    <EULER> x, y, z </EULER> <!-- three euler angles (in radians or with explicit '°' after number in degrees) -->

    <MATERIAL> material name </MATERIAL>
    <DENSITY> x </DENSITY>
    <COLOR> name, alpha </COLOR>  or  <COLOR> r,g,b,alpha </COLOR>

    <GRAPHIC> ... </GRAPHIC>
</PART>

A joint connects to solids with each other. All different joint types share the following common description: Each joint must be given a name, and the two solids to be connected must be specified. The second solid might be the special word "WORLD", in order to connect the solid with the fixed world frame. Each joint can be disabled or enabled. Their position can be given relative to a solid.

<JOINT> <!-- the identifier JOINT must be replace by the concrete joint type identifier -->
    <ID> name </ID>
    <SOLID_IDS> solid1, solid2 </SOLID_IDS>
    <ENABLED> 0 | 1 </ENABLED>

    <RELTO> solid name </RELTO> <!-- location relative to given solid -->
    <TM> 4x4 matrix, column-wise </TM>
    <POS> x, y, z </POS>
    <ROT> 3x3 rotation matrix, column-wise </ROT>
    <QUAT> w, x, y, z </QUAT> <!-- quaternion -->
    <EULER> x, y, z </EULER> <!-- three euler angles (in radians or with explicit '°' after number in degrees) -->
</JOINT>

The following joints have additional properties:

<HINGE>
    <AXIS> x, y, z </AXIS>
    <LIMIT> ... </LIMIT>
</HINGE>

<PRISMATIC>
    <AXIS> x, y, z </AXIS>
    <LIMIT> ... </LIMIT>
</PRISMATIC>

<SPRING>
    <POS1> x, y, z </POS1> <!-- connection position in frame of solid 1 -->
    <POS2> x, y, z </POS2> <!-- connection position in frame of solid 2 -->
    <LENGTH> natural length </LENGTH>
    <STIFFNESS> spring constant </STIFFNESS>
    <DAMPING> spring damping </DAMPING>
    <LIMIT> ... </LIMIT>
</SPRING>

<LINEAR1>
    <!-- restriction of movements to the plane,
            with the normal given by the relocation-vector of the two bodies -->
</LINEAR1>

<LINEAR2> <!-- restriction of movements to a line -->
    <AXIS> x, y, z </AXIS> <!-- both methods define the moving direction -->
    <DIR> x, y, z </DIR>
</LINEAR2>

Some joints have limits and a motor connected to them:
<LIMIT>
    <ACTIVE> 0 | 1 </ACTIVE> <!-- limit activated or not -->
    <STIFF_THRESH> x </STIFF_THRESH>

    <!-- lower and upper bound for movements (joint angles or distances) -->
    <LO_STOP> x </LO_STOP>
    <UP_STOP> x </UP_STOP>
    <STOPS> x, y </STOPS>

    <LO_STIFF> x </LO_STIFF>
    <UP_STIFF> x </UP_STIFF>
    <STIFFS> x, y </STIFFS>

    <LO_DAMP> x </LO_DAMP>
    <UP_DAMP> x </UP_DAMP>
    <DAMPS> x, y </DAMPS>

    <LO_REST> x </LO_REST>
    <UP_REST> x </UP_REST>
    <RESTS> x, y </RESTS>

    <!-- motor properties -->
    <POWERED> 0 | 1 </POWERED>
    <DESVEL> x </DESVEL> <!-- desired motor velocity -->
    <MAXFORCE> x </MAXFORCE> <!-- maximally available motor force -->
</LIMIT>

In analogy to geometry primitives, graphic primitives can be defined, which can be used by several objects.
Graphic objects are not subject to collision detection or dynamical simulation.

<GRAPHICPRIMS>
    <BOX>
        <ID> name </ID>
        <DIMS> x, y, z </DIMS>
    </BOX>

    <SPHERE>
        <ID> name </ID>
        <RADIUS> x </RADIUS>
    </SPHERE>

    <SQUARE>
        <ID> name </ID>
        <PARAMS> x, y </PARAMS>
    </SQUARE>

    <CYLINDER>
        <ID> name </ID>
        <RADIUS> x </RADIUS>
        <HEIGHT> x </HEIGHT>
        <PARAMS> radius, height </PARAMS>
    </CYLINDER>

    <CONE>
        <ID> name </ID>
        <RADIUS> x </RADIUS>
        <HEIGHT> x </HEIGHT>
        <PARAMS> radius, height </PARAMS>
    </CONE>

    <FRUSTUM> <!-- a general prisma with n corners -->
        <ID> name </ID>
        <RADII> r1, r2 </RADII>
        <HEIGHT> h </HEIGHT>
        <CORNERS> n </CORNERS>
        <PARAMS> r1, r2, height </PARAMS>
    </FRUSTUM>

    <LINE>
        <ID> name </ID>
        <START> x, y, z </START>
        <END> x, y, z </END>
    </LINE>

    <FRAME> <!-- draw a coordinate frame with red x-axis, green y-axis and blue z-axis -->
        <ID> name </ID>
        <WITDH> w </WIDTH> <!-- witdh of the arrows -->
        <LEN> l </LEN> <!-- length of an arrow -->
        <PARAMS> w, l <PARAMS>
    </FRAME>
</GRAPHICPRIMS>

<GRAPHICS>
    <ID> name </ID>
    <PRIMID> graphics primitive </PRIMID>
    <COLOR> name, alpha </COLOR>  or  <COLOR> r,g,b,alpha </COLOR>

    <RELTO> solid name </RELTO> <!-- location relative to given solid -->
    <TM> 4x4 matrix, column-wise </TM>
    <POS> x, y, z </POS>
    <ROT> 3x3 rotation matrix, column-wise </ROT>
    <QUAT> w, x, y, z </QUAT> <!-- quaternion -->
    <EULER> x, y, z </EULER> <!-- three euler angles (in radians or with explicit '°' after number in degrees) -->
</GRAPHICS>

Using <IMPORT> tags it is possible to build a scene hierarchical from several files. Objects within imported
files are references by the chain of import ID's, separated by dots, followed by the object ID itself, i.e. "import1.import2.object"

<IMPORT>
    <ID> name </ID> <!-- import name used as path for referenced objects-->
    <NAME> file name </NAME>

    <RELTO> solid name </RELTO> <!-- location relative to given solid -->
    <TM> 4x4 matrix, column-wise </TM>
    <POS> x, y, z </POS>
    <ROT> 3x3 rotation matrix, column-wise </ROT>
    <QUAT> w, x, y, z </QUAT> <!-- quaternion -->
    <EULER> x, y, z </EULER> <!-- three euler angles (in radians or with explicit '°' after number in degrees) -->
</IMPORT>