Home > matlab, Uncategorized > Print your Matlab models in 3D

## Print your Matlab models in 3D

The emergence of 3D printers opens a whole new level of creation possibilities. Any computer generated model could be materialized as soon as it can be transformed in a language that the 3D printer can use. This is also the case with objects and structures which emerge from various mathematical research topics. Since I’m working on shape optimization problems I have lots of structures that would look nice printed in 3D. Below you can see an example of a 3D model and its physical realization by a 3D printer.

I want to show below how can  you can turn a Matlab coloured patch into a file which can be used by a 3D printer. The first step is to export the Matlab information regarding the position of the points, the face structure and the colours into an obj file format. This is not at all complicated. Vertex information is stored on a line of the form

$\displaystyle v\ x\ y\ z\ R\ G\ B$

where ${v}$ is exactly the character ${v}$, ${x,y,z}$ give the coordinates of the points and ${R,G,B}$ give the colour associated to the point in the RGB format. The face information can be entered in a similar fashion:

$\displaystyle f\ t_1\ t_2\ t_3$

where ${t_1, t_2, t_3}$ are the indices of the points in the corresponding face. Once such an obj file is created, it can be imported in MeshLab (a free mesh editing software). Once you’re in MeshLab you should be able to export the structure into any file format you want, which can be understood by a 3D printer (like STL). Once you have the stl file, you can go on a 3D printing website like Sculpteo and just order your 3D object.