mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-05 19:56:05 +08:00
add required functions
This commit is contained in:
parent
f8e6bbafae
commit
402358f346
@ -111,6 +111,31 @@ void TransformationMatrix::translate(double x, double y, double z)
|
||||
this->multiplyLeft(mat);
|
||||
}
|
||||
|
||||
void TransformationMatrix::translateXY(Slic3r::Pointf position)
|
||||
{
|
||||
TransformationMatrix mat = mat_translation(position.x, position.y, 0.0);
|
||||
this->multiplyLeft(mat);
|
||||
}
|
||||
|
||||
void TransformationMatrix::setTranslation(double x, double y, double z)
|
||||
{
|
||||
this->m14 = x;
|
||||
this->m24 = y;
|
||||
this->m34 = z;
|
||||
}
|
||||
|
||||
void TransformationMatrix::setXYtranslation(double x, double y)
|
||||
{
|
||||
this->m14 = x;
|
||||
this->m24 = y;
|
||||
}
|
||||
|
||||
void TransformationMatrix::setXYtranslation(Slic3r::Pointf position)
|
||||
{
|
||||
this->m14 = position.x;
|
||||
this->m24 = position.y;
|
||||
}
|
||||
|
||||
void TransformationMatrix::scale(double factor)
|
||||
{
|
||||
this->scale(factor, factor, factor);
|
||||
|
@ -37,6 +37,17 @@ public:
|
||||
|
||||
/// Perform Translation
|
||||
void translate(double x, double y, double z);
|
||||
void translateXY(Slic3r::Pointf position);
|
||||
|
||||
/// Set translation vector directly
|
||||
void setTranslation(double x, double y, double z);
|
||||
|
||||
/// Set X and Y components of translation directly
|
||||
void setXYtranslation(double x, double y);
|
||||
void setXYtranslation(Slic3r::Pointf position);
|
||||
|
||||
/// Set Z component of translation directly
|
||||
void setZtranslation(double z);
|
||||
|
||||
/// Perform uniform scale
|
||||
void scale(double factor);
|
||||
|
@ -280,6 +280,12 @@ TriangleMesh::WriteOBJFile(const std::string &output_file) const {
|
||||
#endif
|
||||
}
|
||||
|
||||
void TriangleMesh::transform(const TransformationMatrix &trafo)
|
||||
{
|
||||
stl_transform(&this->stl, trafo.matrix3x4f);
|
||||
stl_invalidate_shared_vertices(&this->stl);
|
||||
}
|
||||
|
||||
void TriangleMesh::scale(float factor)
|
||||
{
|
||||
stl_scale(&(this->stl), factor);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "Point.hpp"
|
||||
#include "Polygon.hpp"
|
||||
#include "ExPolygon.hpp"
|
||||
#include "TransformationMatrix.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@ -61,6 +62,9 @@ class TriangleMesh
|
||||
float volume();
|
||||
bool is_manifold() const;
|
||||
void WriteOBJFile(const std::string &output_file) const;
|
||||
|
||||
void transform(const TransformationMatrix &trafo);
|
||||
|
||||
void scale(float factor);
|
||||
void scale(const Pointf3 &versor);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user