Added ModelInstance::world_matrix() method and stl_transform using eigen transform

This commit is contained in:
Enrico Turri 2018-09-04 14:42:14 +02:00
parent 5f2afad95e
commit 15b1340514
8 changed files with 89 additions and 46 deletions

View file

@ -264,7 +264,7 @@ void TriangleMesh::rotate(float angle, const Vec3d& axis)
Vec3f axis_norm = axis.cast<float>().normalized();
Transform3f m = Transform3f::Identity();
m.rotate(Eigen::AngleAxisf(angle, axis_norm));
stl_transform(&stl, (float*)m.data());
stl_transform(&stl, m);
}
void TriangleMesh::mirror(const Axis &axis)
@ -279,6 +279,11 @@ void TriangleMesh::mirror(const Axis &axis)
stl_invalidate_shared_vertices(&this->stl);
}
void TriangleMesh::transform(const Transform3f& t)
{
stl_transform(&stl, t);
}
void TriangleMesh::align_to_origin()
{
this->translate(
@ -523,9 +528,9 @@ BoundingBoxf3 TriangleMesh::transformed_bounding_box(const Transform3d& t) const
src_vertices(0, v_id) = (double)facet_ptr->vertex[i](0);
src_vertices(1, v_id) = (double)facet_ptr->vertex[i](1);
src_vertices(2, v_id) = (double)facet_ptr->vertex[i](2);
++v_id;
}
facet_ptr += 1;
++v_id;
}
}