mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-10-04 03:06:34 +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);
|
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
|
t_model_material_id
|
||||||
ModelVolume::material_id() const
|
ModelVolume::material_id() const
|
||||||
{
|
{
|
||||||
|
@ -477,6 +477,11 @@ class ModelVolume
|
|||||||
/// \return ModelObject* pointer to the owner ModelObject
|
/// \return ModelObject* pointer to the owner ModelObject
|
||||||
ModelObject* get_object() const { return this->object; };
|
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
|
/// Get the material id of this ModelVolume object
|
||||||
/// \return t_model_material_id the material id string
|
/// \return t_model_material_id the material id string
|
||||||
t_model_material_id material_id() const;
|
t_model_material_id material_id() const;
|
||||||
|
@ -280,15 +280,6 @@ TriangleMesh::WriteOBJFile(const std::string &output_file) const {
|
|||||||
#endif
|
#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)
|
void TriangleMesh::scale(float factor)
|
||||||
{
|
{
|
||||||
stl_scale(&(this->stl), factor);
|
stl_scale(&(this->stl), factor);
|
||||||
|
@ -63,8 +63,6 @@ class TriangleMesh
|
|||||||
bool is_manifold() const;
|
bool is_manifold() const;
|
||||||
void WriteOBJFile(const std::string &output_file) const;
|
void WriteOBJFile(const std::string &output_file) const;
|
||||||
|
|
||||||
TriangleMesh transform(const TransformationMatrix &trafo) const;
|
|
||||||
|
|
||||||
void scale(float factor);
|
void scale(float factor);
|
||||||
void scale(const Pointf3 &versor);
|
void scale(const Pointf3 &versor);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user