Translation of ModelVolume as transformation component (without modifying the mesh)

This commit is contained in:
Enrico Turri 2018-11-02 12:11:28 +01:00
parent 93ef2de667
commit 3aad8b5fd2
11 changed files with 384 additions and 39 deletions

View file

@ -1601,7 +1601,15 @@ std::vector<ExPolygons> PrintObject::_slice_volumes(const std::vector<float> &z,
//FIXME better to perform slicing over each volume separately and then to use a Boolean operation to merge them.
TriangleMesh mesh;
for (const ModelVolume *v : volumes)
mesh.merge(v->mesh);
#if ENABLE_MODELVOLUME_TRANSFORM
{
TriangleMesh vol_mesh(v->mesh);
vol_mesh.transform(v->get_matrix().cast<float>());
mesh.merge(vol_mesh);
}
#else
mesh.merge(v->mesh);
#endif // ENABLE_MODELVOLUME_TRANSFORM
if (mesh.stl.stats.number_of_facets > 0) {
mesh.transform(m_trafo.cast<float>());
// apply XY shift