- Implement the equations of truss
- Implement the animation for the behavior of the truss
The document captures the flow of how I implemented the project from start to finish
Equations of study:
-
The stress function
$F(\lambda ) = A\sigma(\lambda)$ -
The stored energy function
$W(\lambda) = \int_{1}^{\lambda} \sigma(\xi), d\xi$ -
Linear stress strain relationship
$\sigma = E\epsilon$
If you are using ubuntu for development of this project you'll require to install one library for rendering purposes that is the simple directmedia layer.
Installation
When you want to run the project
sudo apt install libsdl2-2.0-0
When developing/compiling programs with SDL
sudo apt install libsdl2-dev
When you want to upload images into the program
sudo apt install libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
The following are the header files required to accomplish the truss project
1. nelder-mead.[ch]
2. linked-list.[ch]
3. fetch_line.[ch]
4. xmalloc.[ch]
The files truss-io.[ch] handle the reading and writing of truss description files which has the extension .tdf
The files truss.[ch] contain the implementation of the equations and the solver utility needed to solve trusses
I used the file render-beta.c to solve and render the truss function.
Using the following file you can follow to get the steps I followed to render the truss filerender.
- I had to come up with a projection matrix to scale and translate the truss to fit the animation window.
- I realised I dragged on a bug that was allocating pointer size memory instead of data type's memory.