mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-06 01:56:08 +08:00
move transform function to volume class
This commit is contained in:
parent
25f3df624d
commit
44d6a7ff2b
@ -1010,6 +1010,21 @@ ModelVolume::swap(ModelVolume &other)
|
||||
std::swap(this->input_file_vol_idx, other.input_file_vol_idx);
|
||||
}
|
||||
|
||||
TriangleMesh
|
||||
ModelVolume::get_transformed_mesh(TransformationMatrix const * additional_trafo = nullptr) const
|
||||
{
|
||||
TransformationMatrix trafo = this->trafo;
|
||||
if(additional_trafo)
|
||||
{
|
||||
trafo.applyLeft(*(additional_trafo));
|
||||
}
|
||||
TriangleMesh mesh = TriangleMesh::TriangleMesh();
|
||||
std::vector<float> trafo_arr = trafo.matrix3x4f();
|
||||
stl_transform(&(this->mesh.stl), &(mesh.stl), trafo_arr.data());
|
||||
stl_invalidate_shared_vertices(&(mesh.stl));
|
||||
return mesh;
|
||||
}
|
||||
|
||||
t_model_material_id
|
||||
ModelVolume::material_id() const
|
||||
{
|
||||
|
@ -477,6 +477,11 @@ class ModelVolume
|
||||
/// \return ModelObject* pointer to the owner ModelObject
|
||||
ModelObject* get_object() const { return this->object; };
|
||||
|
||||
/// Get the ModelVolume's mesh, transformed by the ModelVolume's TransformationMatrix
|
||||
/// \param additional_trafo optional additional transformation
|
||||
/// \return TriangleMesh the transformed mesh
|
||||
TriangleMesh get_transformed_mesh(TransformationMatrix const * additional_trafo = nullptr) const;
|
||||
|
||||
/// Get the material id of this ModelVolume object
|
||||
/// \return t_model_material_id the material id string
|
||||
t_model_material_id material_id() const;
|
||||
|
@ -280,15 +280,6 @@ TriangleMesh::WriteOBJFile(const std::string &output_file) const {
|
||||
#endif
|
||||
}
|
||||
|
||||
TriangleMesh TriangleMesh::transform(const TransformationMatrix &trafo) const
|
||||
{
|
||||
TriangleMesh mesh = TriangleMesh::TriangleMesh();
|
||||
std::vector<float> trafo_arr = trafo.matrix3x4f();
|
||||
stl_transform(&this->stl, &(mesh.stl), trafo_arr.data());
|
||||
stl_invalidate_shared_vertices(&(mesh.stl));
|
||||
return mesh;
|
||||
}
|
||||
|
||||
void TriangleMesh::scale(float factor)
|
||||
{
|
||||
stl_scale(&(this->stl), factor);
|
||||
|
@ -63,8 +63,6 @@ class TriangleMesh
|
||||
bool is_manifold() const;
|
||||
void WriteOBJFile(const std::string &output_file) const;
|
||||
|
||||
TriangleMesh transform(const TransformationMatrix &trafo) const;
|
||||
|
||||
void scale(float factor);
|
||||
void scale(const Pointf3 &versor);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user