mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-19 04:37:52 -06:00
Scale of ModelVolume as transformation component (without modifying the mesh)
This commit is contained in:
parent
7114b80882
commit
385b0f261d
2 changed files with 18 additions and 13 deletions
|
@ -749,12 +749,7 @@ void ModelObject::translate(double x, double y, double z)
|
||||||
{
|
{
|
||||||
for (ModelVolume *v : this->volumes)
|
for (ModelVolume *v : this->volumes)
|
||||||
{
|
{
|
||||||
#if ENABLE_MODELVOLUME_TRANSFORM
|
|
||||||
v->translate(x, y, z);
|
v->translate(x, y, z);
|
||||||
#else
|
|
||||||
v->mesh.translate(float(x), float(y), float(z));
|
|
||||||
v->m_convex_hull.translate(float(x), float(y), float(z));
|
|
||||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_bounding_box_valid)
|
if (m_bounding_box_valid)
|
||||||
|
@ -765,11 +760,12 @@ void ModelObject::scale(const Vec3d &versor)
|
||||||
{
|
{
|
||||||
for (ModelVolume *v : this->volumes)
|
for (ModelVolume *v : this->volumes)
|
||||||
{
|
{
|
||||||
v->mesh.scale(versor);
|
v->scale(versor);
|
||||||
v->m_convex_hull.scale(versor);
|
|
||||||
}
|
}
|
||||||
|
#if !ENABLE_MODELVOLUME_TRANSFORM
|
||||||
// reset origin translation since it doesn't make sense anymore
|
// reset origin translation since it doesn't make sense anymore
|
||||||
this->origin_translation = Vec3d::Zero();
|
this->origin_translation = Vec3d::Zero();
|
||||||
|
#endif // !ENABLE_MODELVOLUME_TRANSFORM
|
||||||
this->invalidate_bounding_box();
|
this->invalidate_bounding_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1142,11 +1138,6 @@ size_t ModelVolume::split(unsigned int max_extruders)
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelVolume::translate(double x, double y, double z)
|
|
||||||
{
|
|
||||||
translate(Vec3d(x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelVolume::translate(const Vec3d& displacement)
|
void ModelVolume::translate(const Vec3d& displacement)
|
||||||
{
|
{
|
||||||
#if ENABLE_MODELVOLUME_TRANSFORM
|
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||||
|
@ -1157,6 +1148,16 @@ void ModelVolume::translate(const Vec3d& displacement)
|
||||||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelVolume::scale(const Vec3d& scaling_factors)
|
||||||
|
{
|
||||||
|
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||||
|
m_transformation.set_scaling_factor(m_transformation.get_scaling_factor().cwiseProduct(scaling_factors));
|
||||||
|
#else
|
||||||
|
mesh.scale(scaling_factors);
|
||||||
|
m_convex_hull.scale(scaling_factors);
|
||||||
|
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||||
|
}
|
||||||
|
|
||||||
#if !ENABLE_MODELVOLUME_TRANSFORM
|
#if !ENABLE_MODELVOLUME_TRANSFORM
|
||||||
void ModelInstance::set_rotation(const Vec3d& rotation)
|
void ModelInstance::set_rotation(const Vec3d& rotation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -163,6 +163,7 @@ public:
|
||||||
void translate(double x, double y, double z);
|
void translate(double x, double y, double z);
|
||||||
void scale(const Vec3d &versor);
|
void scale(const Vec3d &versor);
|
||||||
void scale(const double s) { this->scale(Vec3d(s, s, s)); }
|
void scale(const double s) { this->scale(Vec3d(s, s, s)); }
|
||||||
|
void scale(double x, double y, double z) { this->scale(Vec3d(x, y, z)); }
|
||||||
void rotate(float angle, const Axis &axis);
|
void rotate(float angle, const Axis &axis);
|
||||||
void rotate(float angle, const Vec3d& axis);
|
void rotate(float angle, const Vec3d& axis);
|
||||||
void mirror(const Axis &axis);
|
void mirror(const Axis &axis);
|
||||||
|
@ -246,8 +247,11 @@ public:
|
||||||
// Return the number of volumes created from this one.
|
// Return the number of volumes created from this one.
|
||||||
// This is useful to assign different materials to different volumes of an object.
|
// This is useful to assign different materials to different volumes of an object.
|
||||||
size_t split(unsigned int max_extruders);
|
size_t split(unsigned int max_extruders);
|
||||||
void translate(double x, double y, double z);
|
void translate(double x, double y, double z) { translate(Vec3d(x, y, z)); }
|
||||||
void translate(const Vec3d& displacement);
|
void translate(const Vec3d& displacement);
|
||||||
|
void scale(const Vec3d& scaling_factors);
|
||||||
|
void scale(double x, double y, double z) { scale(Vec3d(x, y, z)); }
|
||||||
|
void scale(double s) { scale(Vec3d(s, s, s)); }
|
||||||
|
|
||||||
ModelMaterial* assign_unique_material();
|
ModelMaterial* assign_unique_material();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue