Heart pulse simulation using cellular automata

This is a project created for my graduation work at Howest University of Applied Sciences in the major Game Development. This was in collaboration with KULeuven.

About

This project was created to see if we could simulate a heart pulse going through a 3D volumetric mesh using cellular automata as opposed to the currently mainly used differential equations.

Cellular automata is a system that uses a grid of cells, where each cell has a certain state. Depending on the state of one cell's neighboring cells, that cell might change to a different state. The given rule-set determines what state the cell is going to change in to. One of the most famous examples of an application of cellular automata is Conway's Game of Life, which is one of the first projects I created in the custom framework I made.

This is a "Glider Cannon" created in my version of Conway's Game of Life. It's a device that creates the smaller tiny airplane-like objects flying to the bottom-right of the screen.


In this project the cellular automata is applied in such a way that the vertices of the mesh are considered the cells and can be either 1 of 3 given states. The states correspond to the phases a pulse can be in:

  • Active Potential Duration
  • Recovery Time
  • Diastolic Interval



  • The pulse propagates from one vertex to it's connected vertices, taking in to account the distance they have to travel. Because it's a volumetric mesh, the mesh has a thickness. Because of this I had to connect the outer part of the mesh with the inner part of the mesh. I used an algorithm that takes in to account the distance and the normal to determine if a point should be connected.

    example of surface mesh versus a volumetric mesh


    One of the last thing I tried to implement, but sadly didn't get working was the fibre direction. A heart is made out of fibres which go a certain direction. Depending on the direction the pulse can go faster of slower. A pulse going alongside the fibre direction will travel much faster than one that travels against one.

    Framework

    The framework I used is a custom made framework that I made for this project. It's created in C++. I have 2 renderers implemented, one using SDL2 (mainly for 2D rendering) while the other one uses DirectX 11 alongside legacy DirectX effects.
    The math library I used was GLM.
    For the drawing of the GUI I used Dear ImGUI, which I used a lot for triggering functions and putting in data.


    The main class is the "Application" class that initializes the entire program and handles the update loop.
    This class also contains a "Renderer" class which is used to draw to the screen.

    Checking the states and changing them is handled on the CPU, while the drawing and rendering is handled on the GPU with the help of DirectX.