Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Titan runs simulations in a Simulation object which holds references to user defined objects, graphics buffers, constraints, and other data. Data is held on the GPU, with the user interacting with CPU objects which can fetch data from the GPU, modify it, and push it back to the simulation in real time. The Simulation object controls things like the duration of the run, graphics/rendering options like the viewport, and GPU parameters.
The simplest discrete simulation elements. Point masses have individual physical properties (mass, position, velocity, acceleration) and can be affected by forces exerted by different sources.
Once one or more masses have been created and the simulation environment has been defined, the user may run the simulation to obtain physical information about the configuration's response to the environment.
Springs connect pairs of masses together and apply simple Hooke's law forces. These forces are applied in parallel on the GPU, achieving a substantial performance improvement over a CPU based system.
Masses and springs may belong to Containers which enable efficient and convenient transfers of information to and from the GPU. Once a mass or spring has been created, it can be added to a container of related objects. This container can the be pushed to or pulled from the GPU as a single unit, avoiding expensive copies and tedious boilerplate code.
Forces in Titan are defined by 3D vectors and affect masses during the simulation. Forces can be a result of several interactions:
- Mass-Spring Hooke’s forces due to Springs connecting masses
- Mass interactions with contact elements
- Global accelerations (i.e. gravity) set up by the user
Contacts are predefined simulation elements that apply forces to masses when certain positional requirements are met. Contact elements only need to be initialized to start working.
Contacts included in Titan:
- Plane: Applies a normal force based on the masse’s displacement after breaching one face of the plane.
- Sphere: Applies a normal force based on the masses’ displacement after breaching the sphere’s surface.
Constraints are positional limitations imposed on masses. Constraints need to be initialized and then associated to masses in order to work.
Constraints included in Titan:
- Direction: Constraints the movement of masses to one direction only.
- Plane: Constraints the movement of masses to a plane. The plane is defined by a normal vector and and the masse’s position at the time of its application.
Masses can also be marked as "fixed", meaning that they cannot move, and drag can be specified on individual masses, which will be applied according to a C v^2 law.
The Titan simulation environment is asynchronous and dynamic. The user can make arbitrary modifications to the simulation on the run, and these will be immediately reflected in the simulation. The user can:
- Fetch values from the GPU using sim.get(...)
- Push values to the GPU using sim.set(...)
- Add constraints and modify parameters of the simulation.