Fixed FFF slicing of meshes with left hand oriented transformations applied.

Slight optimization of FFF slicing - optimized copy of an object with just
a single volume.
This commit is contained in:
bubnikv 2019-04-03 11:12:03 +02:00
parent eeae1c0495
commit 382326ffc8
3 changed files with 16 additions and 10 deletions

View file

@ -1790,15 +1790,16 @@ std::vector<ExPolygons> PrintObject::_slice_volumes(const std::vector<float> &z,
if (! volumes.empty()) {
// Compose mesh.
//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)
{
TriangleMesh vol_mesh(v->mesh);
vol_mesh.transform(v->get_matrix());
TriangleMesh mesh(volumes.front()->mesh);
mesh.transform(volumes.front()->get_matrix(), true);
for (size_t idx_volume = 1; idx_volume < volumes.size(); ++ idx_volume) {
const ModelVolume &model_volume = *volumes[idx_volume];
TriangleMesh vol_mesh(model_volume.mesh);
vol_mesh.transform(model_volume.get_matrix(), true);
mesh.merge(vol_mesh);
}
if (mesh.stl.stats.number_of_facets > 0) {
mesh.transform(m_trafo);
mesh.transform(m_trafo, true);
// apply XY shift
mesh.translate(- unscale<float>(m_copies_shift(0)), - unscale<float>(m_copies_shift(1)), 0);
// perform actual slicing
@ -1819,9 +1820,9 @@ std::vector<ExPolygons> PrintObject::_slice_volume(const std::vector<float> &z,
// Compose mesh.
//FIXME better to perform slicing over each volume separately and then to use a Boolean operation to merge them.
TriangleMesh mesh(volume.mesh);
mesh.transform(volume.get_matrix());
mesh.transform(volume.get_matrix(), true);
if (mesh.stl.stats.number_of_facets > 0) {
mesh.transform(m_trafo);
mesh.transform(m_trafo, true);
// apply XY shift
mesh.translate(- unscale<float>(m_copies_shift(0)), - unscale<float>(m_copies_shift(1)), 0);
// perform actual slicing