Writing a Model Description
- Dynamics Modelling and Culling -
[ Home | Modeller | Compiler | to-vrml | Dynamics | Models | JavaDoc | Examples ]

Introduction

Model descriptions in DMC are written in ".dyn" files. The ".dyn" file is the file format understood by the modeller and to-vrml utilities. It contains all the model transformations, links to model prototypes, and all relationships to the dynamics.

This document describes how to write a ".dyn" file by hand, though it should not be necessary.

.dyn File Format

The ".dyn" format is written in ASCII text. There are two sections: variable definitions, and the model hierarchy. There is no file header and no section separator.

The keywords in this file format are "translate", "rotate", "vrml", "group", and "bound". A valid identifier is not a keyword and begins with a letter or '_' followed by 0 or more letter, digit or '_' characters. A string in the ".dyn" file starts with a quote and continues until a closing quote.

Variable Definitions

The variable definition section declares the variables used in the model, their initial phase, and initialization arguments. Each variable declaration has the form:

name type phase [ arg1 [ arg2 ... ] ]

name declares the variable name as it will be referenced in the model hierarchy. It may be any unused identifier as defined above.

type is the type of the variable. It must be the name of a java class that implements the berkeley.cs.dmc.DynamicsVariable interface.

phase is the initial phase of the variable. This value can be any real number.

arg1..n are the arguments to the variable's initialization routine. They may be either numbers or strings.

Model Hierarchy

The model hierarchy is defined using using tree nodes "translate", "rotate", "vrml", "group", and "bound". Each of the tree nodes has a similar format:

nodetype {
    [ attribute value
      . . . ]
    [ nodetype { ... }
      . . . ]
}

nodetype is one of "translate", "rotate", "vrml", "group", or "bound".

attibute is node-type dependent. Attributes for each of the nodes are listed below.

Translate Node

Attributes for the translate node are: "x", "y", and "z". They define the translation associated with the node, and may be either a real number of variable reference.

Rotate Node

Attributes for the rotate node are: "x", "y", "z", and "angle". "x", "y", and "z" define the axis of rotation and "angle" defines the angle of rotation about the axis in radians. All rotate node attributes may be either real numbers or variables references.

VRML Node

The only field for a VRML node is "url", which may be either a relative or absolute url for a VRML prototype.

Bound Node

The attributes of the bound node are "x", "y", "z", and "var". "x", "y", and "z" define the x, y, and z bounds of the bound node, and may be either real numbers or variables. "var" defines the variable bounded by this node. The "var" attribute must be a previously defined variable.

There may be multiple "var" attributes per bound node.

Group Node

The group node has no attributes. It is merely container for other nodes. Since all nodes can contain sub-nodes. The group node is functionally equivaltent to a translate node of x=0, y=0, and z=0, or a rotate node with a 0 degree rotation.


[ Home | Modeller | Compiler | to-vrml | Dynamics | Models | JavaDoc | Examples ]
Last updated: 01-Oct-98