Use Transform3d in place of Transform3f as parameter of mesh transform functions

This commit is contained in:
Enrico Turri 2018-11-02 13:47:47 +01:00
parent 3aad8b5fd2
commit 7114b80882
7 changed files with 15 additions and 15 deletions

View file

@ -627,7 +627,7 @@ const BoundingBoxf3& ModelObject::bounding_box() const
#if ENABLE_MODELVOLUME_TRANSFORM
{
TriangleMesh m = v->mesh;
m.transform(v->get_matrix().cast<float>());
m.transform(v->get_matrix());
raw_bbox.merge(m.bounding_box());
}
#else
@ -667,7 +667,7 @@ TriangleMesh ModelObject::raw_mesh() const
#if ENABLE_MODELVOLUME_TRANSFORM
{
TriangleMesh vol_mesh(v->mesh);
vol_mesh.transform(v->get_matrix().cast<float>());
vol_mesh.transform(v->get_matrix());
mesh.merge(vol_mesh);
}
#else
@ -1212,14 +1212,14 @@ void ModelInstance::set_mirror(Axis axis, double mirror)
void ModelInstance::transform_mesh(TriangleMesh* mesh, bool dont_translate) const
{
mesh->transform(get_matrix(dont_translate).cast<float>());
mesh->transform(get_matrix(dont_translate));
}
BoundingBoxf3 ModelInstance::transform_mesh_bounding_box(const TriangleMesh* mesh, bool dont_translate) const
{
// Rotate around mesh origin.
TriangleMesh copy(*mesh);
copy.transform(get_matrix(true, false, true, true).cast<float>());
copy.transform(get_matrix(true, false, true, true));
BoundingBoxf3 bbox = copy.bounding_box();
if (!empty(bbox)) {

View file

@ -1604,14 +1604,14 @@ std::vector<ExPolygons> PrintObject::_slice_volumes(const std::vector<float> &z,
#if ENABLE_MODELVOLUME_TRANSFORM
{
TriangleMesh vol_mesh(v->mesh);
vol_mesh.transform(v->get_matrix().cast<float>());
vol_mesh.transform(v->get_matrix());
mesh.merge(vol_mesh);
}
#else
mesh.merge(v->mesh);
#endif // ENABLE_MODELVOLUME_TRANSFORM
if (mesh.stl.stats.number_of_facets > 0) {
mesh.transform(m_trafo.cast<float>());
mesh.transform(m_trafo);
// apply XY shift
mesh.translate(- unscale<float>(m_copies_shift(0)), - unscale<float>(m_copies_shift(1)), 0);
// perform actual slicing

View file

@ -272,9 +272,9 @@ void TriangleMesh::rotate(float angle, const Vec3d& axis)
if (angle == 0.f)
return;
Vec3f axis_norm = axis.cast<float>().normalized();
Transform3f m = Transform3f::Identity();
m.rotate(Eigen::AngleAxisf(angle, axis_norm));
Vec3d axis_norm = axis.normalized();
Transform3d m = Transform3d::Identity();
m.rotate(Eigen::AngleAxisd(angle, axis_norm));
stl_transform(&stl, m);
}
@ -290,7 +290,7 @@ void TriangleMesh::mirror(const Axis &axis)
stl_invalidate_shared_vertices(&this->stl);
}
void TriangleMesh::transform(const Transform3f& t)
void TriangleMesh::transform(const Transform3d& t)
{
stl_transform(&stl, t);
}

View file

@ -49,7 +49,7 @@ public:
void mirror_x() { this->mirror(X); }
void mirror_y() { this->mirror(Y); }
void mirror_z() { this->mirror(Z); }
void transform(const Transform3f& t);
void transform(const Transform3d& t);
void align_to_origin();
void rotate(double angle, Point* center);
TriangleMeshPtrs split() const;