Lab3D simulations are files that you can use to make 3D models follow a predefined trajectory equation. It is also possible to set rotation and visibility of the 3D model. There are 4 steps to follow:
– Choose which 3D models will be displayed;
– Create their trajectories;
– Adjust settings: colors, trajectory display and simulation time step.
– Save your model. Important: I advise you to save your model files and simulation files in a subfolder of the Lab3D folder to make it easier to share simulations among different computers.
After saving the simulation file, you can load it just as you would load any 3D model.
The video below shows an example of how to create a Lab3D simulation:
2. Selecting models
The first step to create a simulation is to add 3D models. In the Create Simulation window you can:
– Give a name to the simulation;
– Load an existing model into the simulation;
– Remove a model from the simulation;
– Preview one of the models in the main screen;
– Load data from an existing simulation;
– Save simulation data to disk.
3. Creating trajectories
Trajectories are created using mathematical equations. Equations should be written as a function of variable t (time). There are two variables that store movement data: Trajectory and Rotation.
When you click Generate Code button, Lab3D will auto-generate templates for writing one Trajectory and Rotation data for each model. If you are a programmer you may want to use a for loop to iterate through the objects. The programming language is the OpenCL C99.
Data inside variable Trajectory control the displacement of the 3D model (xyz) and whether the model will be shown (w component). If, at a given time t, the w component is lesser than zero, the model associated with that trajectory will not be shown in the simulation. This is useful if you want to create a model of something being built, for example.
Data inside variable Rotation control the rotation that will be applied to the model in axes xyz. The order Lab3D applies the rotation is Z->Y->X.
From this screen it is possible to preview the simulation both as it will be saved and displaying all trajectories. If you choose to display all trajectories, all trajectories associated with the objects will be drawn even if the adjusted settings for the model don’t include Show trajectory. This is just a test mode. The model will always be saved using the configuration in “Settings”.
4. Simulation settings
You can customize simulation settings like models color, trajectory association and desired time step in the settings tab.
The model will move according to Trajectory[number] and Rotation[number], where number is the trajectory associated to it. If you choose to display the trajectory, Lab3D will draw the object’s trajectory when you start the simulation. The chosen color will both affect the model (even if it has a texture) and its drawn trajectory.
The time step setting lets you configure what should be the time step when the simulation is loaded.
Like in the 3D models design, it is possible to create advanced functions which can be called from the trajectories design.