Skip to main content

How to RBD solver, part 1

Ω This is just a small complimentary note for the RBD solver video that is here

To feel comfortable watching the video you should:
  • Be familiar with basics vector and matrix operations. 
  • Have basic physics knowledge 
  • Have heard about differential equations 
  • Have heard a bit about finite differences methods 
(last two will more like just help you understand some calculations, but not required to understand the point)
please, check 101 below the video, maybe it will be of any help.

https://vimeo.com/243886050

From description of the video:
I thought to try to contribute to the community with a little tutorial.
Everyone seem to know everything about fluid solvers these days, so i decided to cover basics
for a bit more obscure, at least for Houdini users, topic.
This is part one of possible 3 parts.
I tried to push everything into one video, but just got too tired. so let's see how this one goes and if this topic together with this kind of presenting of the material will be accepted by the viewers.
This part covers some common basics and Integration step of RBD solver
The video may be fast paced, so prepare to feel free to pause it to take a longer look at formulas.
Some examples for the stuff, described in the video can be found here
https://github.com/pedohorse/RBDtutorial
it may help understanding
I thought i won't yet publish the whole solver itself, but do it when all 3 parts are done, so the viewer will feel much more confident diving into it's structure.
Your comments and suggestions are welcome, but i cannot promise to take not of all of them since i'm doing these videos only during free evenings when i'm already half-exhausted.

vector - matrix 101


we will consider vectors to be rows, not columns, therefore vector-matrix multiplications will be performed in corresponding order: v∙M , therefore some matrices may be transposed compared to what you may know if you were raised on vectors being columns


we will be speaking about 3D, so all vectors will be 3 dimensional, all matrices are of size 3x3

Vector Matrix Multiplication

So vector v multiplied by matrix M is:
\[v\cdot M = \begin{bmatrix} v_0 & v_1 & v_2 \end{bmatrix} \cdot \begin{bmatrix} m_{00} & m_{01} & m_{02}\\ m_{10} & m_{11} & m_{12}\\ m_{20} & m_{21} & m_{22} \end{bmatrix} = \begin{bmatrix} \sum_{i=0}^{3}v_i\cdot m_{i0} & \sum_{i=0}^{3}v_i\cdot m_{i1} & \sum_{i=0}^{3}v_i\cdot m_{i2} \end{bmatrix} = \begin{bmatrix} v_0\cdot m_{00} + v_1\cdot m_{10} + v_2\cdot m_{20} & v_0\cdot m_{01} + v_1\cdot m_{11} + v_2\cdot m_{21} & v_0\cdot m_{02} + v_1\cdot m_{12} + v_2\cdot m_{22} \end{bmatrix}\]

Matrix Matrix Multiplication

matrix A multiplied by matrix B follows the same logic as vector-matrix multiplication, where each row of matrix A can be viewed as a vector 
\[A\cdot B = \begin{bmatrix} a_{00} & a_{01} & a_{02}\\ a_{10} & a_{11} & a_{12}\\ a_{20} & a_{21} & a_{22} \end{bmatrix} \cdot \begin{bmatrix} b_{00} & b_{01} & b_{02}\\ b_{10} & b_{11} & b_{12}\\ b_{20} & b_{21} & b_{22} \end{bmatrix} = \begin{bmatrix} \sum_{i=0}^{3}a_{0i}\cdot b_{i0} & \sum_{i=0}^{3}a_{0i}\cdot b_{i1} & \sum_{i=0}^{3}a_{0i}\cdot b_{i2}\\ \sum_{i=0}^{3}a_{1i}\cdot b_{i0} & \sum_{i=0}^{3}a_{1i}\cdot b_{i1} & \sum_{i=0}^{3}a_{1i}\cdot b_{i2}\\ \sum_{i=0}^{3}a_{2i}\cdot b_{i0} & \sum_{i=0}^{3}a_{2i}\cdot b_{i1} & \sum_{i=0}^{3}a_{2i}\cdot b_{i2} \end{bmatrix}\]

Matrix Transposition

if matrix M is:
\[M=\begin{bmatrix} a_{00} & a_{01} & a_{02}\\ a_{10} & a_{11} & a_{12}\\ a_{20} & a_{21} & a_{22} \end{bmatrix}\]

then \[M^{T}\] is called a transposition of matrix M and is a result of mirroring M from the main diagonal, so all elements \[a_{ij}\; becomes\; a_{ji}\]
\[M^{T}=\begin{bmatrix} a_{00} & a_{10} & a_{20}\\ a_{01} & a_{11} & a_{21}\\ a_{02} & a_{12} & a_{22} \end{bmatrix}\]

Matrix Inversion

matrix \[M^{-1}\] is called the inverted matrix M, or inversion of matrix M if
\[M^{-1}\cdot M=I\]
where I is the identity matrix
\[\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}\]

Basis Change

if we have 2 basises: b1 and b2, vector v2 is in basis b2 and and basis vectors of b2 in basis b1 are xb2 yb2 zb2. then matrix
\[Q=\begin{bmatrix} \overline{xb2}\\ \overline{yb2}\\ \overline{zb2} \end{bmatrix} = \begin{bmatrix} xb2_0 & xb2_1 & xb2_2\\ yb2_0 & yb2_1 & yb2_2\\ zb2_0 & zb2_1 & zb2_2 \end{bmatrix}\]
is the transition matrix from basis b2 to basis b1
and vector v2 in basis b1 can be calculated as follows:

\[v1=v2\cdot Q\]

Rotation Matrix

Rotation matrix is just another basis transition matrix, that translates from basis b2 to b1 where b2 is produced from b1 by rotating the basis vectors of b1 according the the rotation being represented.


Also