mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-04 08:30:38 +08:00
reinstate model volume transformations
This commit is contained in:
parent
d18fe56f8d
commit
098d428bb0
@ -1080,6 +1080,36 @@ ModelVolume::bounding_box() const
|
|||||||
return this->mesh.bounding_box();
|
return this->mesh.bounding_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelVolume::translate(double x, double y, double z)
|
||||||
|
{
|
||||||
|
TransformationMatrix trafo = TransformationMatrix::mat_translation(x,y,z);
|
||||||
|
this->apply_transformation(trafo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelVolume::scale(double x, double y, double z)
|
||||||
|
{
|
||||||
|
TransformationMatrix trafo = TransformationMatrix::mat_scale(x,y,z);
|
||||||
|
this->apply_transformation(trafo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelVolume::mirror(const Axis &axis)
|
||||||
|
{
|
||||||
|
TransformationMatrix trafo = TransformationMatrix::mat_mirror(axis);
|
||||||
|
this->apply_transformation(trafo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelVolume::mirror(const Vectorf3 &normal)
|
||||||
|
{
|
||||||
|
TransformationMatrix trafo = TransformationMatrix::mat_mirror(normal);
|
||||||
|
this->apply_transformation(trafo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelVolume::rotate(double angle_rad, const Axis &axis)
|
||||||
|
{
|
||||||
|
TransformationMatrix trafo = TransformationMatrix::mat_rotation(angle_rad, axis);
|
||||||
|
this->apply_transformation(trafo);
|
||||||
|
}
|
||||||
|
|
||||||
void ModelVolume::apply_transformation(TransformationMatrix const & trafo)
|
void ModelVolume::apply_transformation(TransformationMatrix const & trafo)
|
||||||
{
|
{
|
||||||
this->mesh.transform(trafo);
|
this->mesh.transform(trafo);
|
||||||
|
@ -504,7 +504,32 @@ class ModelVolume
|
|||||||
|
|
||||||
BoundingBoxf3 get_transformed_bounding_box(TransformationMatrix const & trafo) const;
|
BoundingBoxf3 get_transformed_bounding_box(TransformationMatrix const & trafo) const;
|
||||||
BoundingBoxf3 bounding_box() const;
|
BoundingBoxf3 bounding_box() const;
|
||||||
|
|
||||||
|
//Transformation matrix manipulators
|
||||||
|
|
||||||
|
/// performs translation
|
||||||
|
void translate(double x, double y, double z);
|
||||||
|
void translate(Vectorf3 const &vector) { this->translate(vector.x, vector.y, vector.z); };
|
||||||
|
void translateXY(Vectorf const &vector) { this->translate(vector.x, vector.y, 0); };
|
||||||
|
|
||||||
|
/// performs uniform scale
|
||||||
|
void scale(double factor) { this->scale(factor, factor, factor); };
|
||||||
|
|
||||||
|
/// performs per-axis scale
|
||||||
|
void scale(double x, double y, double z);
|
||||||
|
|
||||||
|
/// performs per-axis scale via vector
|
||||||
|
void scale(Vectorf3 const &vector) { this->scale(vector.x, vector.y, vector.z); };
|
||||||
|
|
||||||
|
/// performs mirroring along given axis
|
||||||
|
void mirror(const Axis &axis);
|
||||||
|
|
||||||
|
/// performs mirroring along given axis
|
||||||
|
void mirror(const Vectorf3 &normal);
|
||||||
|
|
||||||
|
/// performs rotation around given axis
|
||||||
|
void rotate(double angle_rad, const Axis &axis);
|
||||||
|
|
||||||
/// apply whichever matrix is supplied, multiplied from the left
|
/// apply whichever matrix is supplied, multiplied from the left
|
||||||
void apply_transformation(TransformationMatrix const &trafo);
|
void apply_transformation(TransformationMatrix const &trafo);
|
||||||
|
|
||||||
|
@ -290,7 +290,11 @@ ModelMaterial::attributes()
|
|||||||
}
|
}
|
||||||
%};
|
%};
|
||||||
|
|
||||||
|
void translate(double x, double y, double z);
|
||||||
|
void scale_xyz(Pointf3* versor)
|
||||||
|
%code{% THIS->scale(*versor); %};
|
||||||
|
void rotate(double angle, Axis axis);
|
||||||
|
|
||||||
Ref<DynamicPrintConfig> config()
|
Ref<DynamicPrintConfig> config()
|
||||||
%code%{ RETVAL = &THIS->config; %};
|
%code%{ RETVAL = &THIS->config; %};
|
||||||
Ref<TriangleMesh> mesh()
|
Ref<TriangleMesh> mesh()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user