External Meshes

Another way of creating a usable solid is to read in a external mesh file. Mesh files contain a 3-dimensional object in form of a triangulated surface. The common file formats stl and 3mf are supported for inserting.

A mesh file is included via the constructor of the mesh data type. This receives a string as argument that holds a valid path to the mesh file:

Example

mesh m( "myfiles/figure.stl" )
make m

Mesh model of the author (low quality scan).

When reading from a 3mf file, the mesh can also have colors.

The mesh solid is a specialization of the solid data type, just like it is the case for the primitive solids. This means that the same operations can be applied to it that can be applied to any other solid data type, like modifier application, boolean operations, bi-selection modifier application and others.

Note

The application of modifiers for mesh data types leads to an implicit convertion into a solid, like for the primitive solid data types. This means that the variable s in the following example must be defined as solid. Would it be defined as mesh, the compiler would throw an error:

Example

solid s = rgb(64, 244, 124 ) >> m