why can't you just format the matrice like this?
matrice vertice 2d -
|x, y, z| row 1 - vertice 1
|x, y, z| row 2 - vertice 2
|x, y, z| row 3 - vertice 3... etc
|x, y, z|
|x, y, z|
|x, y, z|
So far this has worked for me in c++ when working with my own 3d prog.
Works well when dealing with other such as rotation, translation, and scaling matrices.
Live the life you love, love the life you live