mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-05 15:50:38 +08:00
add function of transformed bb in mesh
This commit is contained in:
parent
564377e17a
commit
4e148608eb
@ -576,6 +576,26 @@ TriangleMesh::bounding_box() const
|
||||
return bb;
|
||||
}
|
||||
|
||||
BoundingBoxf3
|
||||
TriangleMesh::get_transformed_bounding_box(TransformationMatrix const & trafo) const
|
||||
{
|
||||
BoundingBoxf3 bbox;
|
||||
for (int i = 0; i < this->stl.stats.number_of_facets; ++ i) {
|
||||
const stl_facet &facet = this->stl.facet_start[i];
|
||||
for (int j = 0; j < 3; ++ j) {
|
||||
double v_x = facet.vertex[j].x;
|
||||
double v_y = facet.vertex[j].y;
|
||||
double v_z = facet.vertex[j].z;
|
||||
Pointf3 poi;
|
||||
poi.x = float(trafo.m11*v_x + trafo.m12*v_y + trafo.m13*v_z + trafo.m14);
|
||||
poi.y = float(trafo.m21*v_x + trafo.m22*v_y + trafo.m23*v_z + trafo.m24);
|
||||
poi.z = float(trafo.m31*v_x + trafo.m32*v_y + trafo.m33*v_z + trafo.m34);
|
||||
bbox.merge(poi);
|
||||
}
|
||||
}
|
||||
return bbox;
|
||||
}
|
||||
|
||||
void
|
||||
TriangleMesh::require_shared_vertices()
|
||||
{
|
||||
|
@ -75,6 +75,7 @@ class TriangleMesh
|
||||
ExPolygons horizontal_projection() const;
|
||||
Polygon convex_hull();
|
||||
BoundingBoxf3 bounding_box() const;
|
||||
BoundingBoxf3 get_transformed_bounding_box(TransformationMatrix const & trafo) const;
|
||||
void reset_repair_stats();
|
||||
bool needed_repair() const;
|
||||
size_t facets_count() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user