When a MIF file is read, all the commands are executed as the reading
goes along. It is the reason why the commands written in a MIF really
look like the functions of description of a scene (cf Chapter
).
A MIF file always starts with the command p3d_beg_desc P3D_ENV env. When read, this command calls the function p3d_beg_desc(P3D_ENV,env). Then the description of the obstacles and robots of the environment can be done.
A p3d_beg_desc TYPE name command must always be closed by the command p3d_end_desc, that calls the function p3d_end_desc().
The description of an obstacle always start by the command p3d_beg_desc P3D_OBSTACLE obst, that calls the function p3d_beg_desc(P3D_OBSTACLE,obst). Before closing this description by a p3d_end_desc command, the user must add at least one polyhedron.
A general polyhedron can be described by the commands p3d_add_desc_poly poly, that calls the function void p3d_add_desc_poly(char name[20]) with the name poly as input, p3d_add_desc_vert x y z that calls the function void p3d_add_desc _vert(double x, double y, double z), p3d_add_desc_face a b c d, that calls the function void p3d_poly_add_face (p3d_poly *poly, int *listeV, int nb_Vert) and p3d_end_desc_poly, that calls the function void p3d_end_desc_poly(void).
Geometric primitives are described with commands that are the same than their functions of descriptions : the user must call the command p3d_add_desc_typeprim parameters, parameters being the right parameters for the type of primitive we choose (size of the side fo a cube, ray for a sphere,...).
The polyhedrons are placed in their position with the command p3d_set_prim_pos prim tx ty tz rz ry rz.The parameter prim is the name of the primitive we want to move, (tx, ty, tz) the translations along the 3 axes, and (rx, ry, rz) the rotations along the 3 axes.
Once its description has been closed with a p3d_end_desc command, the whole obstacle can be moved by a command p3d_set_obst_pos obst tx ty tz rz ry rz wich use is exactly the same than p3d_set_prim_pos.
The description of a robot always starts by the command p3d_beg_desc P3D_ROBOT robot and is also closed by a p3d_end_desc command. Between thos two commands the user must alternate the description of bodies and joints.
The description of a body starts by the command p3d_beg_desc P3D_BODY body and can be the described exactly like an obstacle. Its description is of course closed by a p3d_end_desc command. A joint is added with the command : p3d_add_desc_jnt P3D_ TYPE x0 y0 z0 axe1 axe2 axe3 v vmin vmax prev_jnt.
Once the description of the environment has been closed, the scene can be completed by the commands p3d_set_env_box xmin xmax ymin ymax zmin zmax that modifies the limits of the scene. After a p3d_sel_desc_name P3D_ROBOT robot_name command, the user can specify the robot box by a p3d_set_robot_box xmin xmax ymin ymax zmin zmax tmin tmax and the initial values of the first four degrees of freedom by a p3d_set_robot_pos x y z t command.