Ported ModelObject::rotate() and ModelObject::flip() to XS, as well as axes constants

This commit is contained in:
Alessandro Ranellucci 2015-04-16 21:22:04 +02:00
parent be2f46ca68
commit 5eb3bc52ef
11 changed files with 84 additions and 46 deletions

View file

@ -1,4 +1,5 @@
#include "Model.hpp"
#include "Geometry.hpp"
namespace Slic3r {
@ -514,6 +515,29 @@ ModelObject::scale(const Pointf3 &versor)
this->invalidate_bounding_box();
}
void
ModelObject::rotate(float angle, const Axis &axis)
{
// we accept angle in radians but mesh currently uses degrees
angle = Slic3r::Geometry::rad2deg(angle);
for (ModelVolumePtrs::const_iterator v = this->volumes.begin(); v != this->volumes.end(); ++v) {
(*v)->mesh.rotate(angle, axis);
}
this->origin_translation = Pointf3(0,0,0);
this->invalidate_bounding_box();
}
void
ModelObject::flip(const Axis &axis)
{
for (ModelVolumePtrs::const_iterator v = this->volumes.begin(); v != this->volumes.end(); ++v) {
(*v)->mesh.flip(axis);
}
this->origin_translation = Pointf3(0,0,0);
this->invalidate_bounding_box();
}
size_t
ModelObject::materials_count() const
{