1
0
mirror of https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git synced 2026-07-19 09:24:27 +00:00

Enhanced volumes manipulation - wip

This commit is contained in:
Enrico Turri
2018-11-12 08:54:22 +01:00
parent a72470079d
commit 22dbcbcd9c
5 changed files with 35 additions and 8 deletions
+5 -3
View File
@@ -1177,10 +1177,12 @@ void ModelVolume::set_material(t_model_material_id material_id, const ModelMater
}
#if ENABLE_MODELVOLUME_TRANSFORM
void ModelVolume::translate_geometry(const Vec3d& displacement)
void ModelVolume::center_geometry()
{
mesh.translate((float)displacement(0), (float)displacement(1), (float)displacement(2));
m_convex_hull.translate((float)displacement(0), (float)displacement(1), (float)displacement(2));
Vec3d shift = -mesh.bounding_box().center();
mesh.translate((float)shift(0), (float)shift(1), (float)shift(2));
m_convex_hull.translate((float)shift(0), (float)shift(1), (float)shift(2));
translate(-shift);
}
#endif // ENABLE_MODELVOLUME_TRANSFORM
+2 -1
View File
@@ -324,7 +324,8 @@ public:
void mirror(Axis axis);
#if ENABLE_MODELVOLUME_TRANSFORM
void translate_geometry(const Vec3d& displacement);
// translates the mesh and the convex hull so that the origin of their vertices is in the center of this volume's bounding box
void center_geometry();
#endif // ENABLE_MODELVOLUME_TRANSFORM
void calculate_convex_hull();