mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-18 05:25:59 +08:00
Fix of d43ae66ecaaac762b5ee452e6d500bbb81ccc496
reduced copy / paste redudancy by extracting a new function to produce convex hull: its_convex_hull()
This commit is contained in:
parent
8d0a4c7cd6
commit
7e780380ee
@ -622,12 +622,12 @@ void GLVolume::calc_convex_hull_3d()
|
|||||||
{
|
{
|
||||||
const std::vector<float> &src = this->indexed_vertex_array.vertices_and_normals_interleaved;
|
const std::vector<float> &src = this->indexed_vertex_array.vertices_and_normals_interleaved;
|
||||||
std::vector<Vec3f> pts;
|
std::vector<Vec3f> pts;
|
||||||
|
assert(src.size() % 6 == 0);
|
||||||
pts.reserve(src.size() / 6);
|
pts.reserve(src.size() / 6);
|
||||||
for (auto it = src.begin() + 3;;) {
|
for (auto it = src.begin(); it != src.end(); ) {
|
||||||
|
it += 3;
|
||||||
pts.push_back({ *it, *(it + 1), *(it + 2) });
|
pts.push_back({ *it, *(it + 1), *(it + 2) });
|
||||||
it += 3;
|
it += 3;
|
||||||
if (it == src.end())
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
this->set_convex_hull(TriangleMesh(its_convex_hull(pts)));
|
this->set_convex_hull(TriangleMesh(its_convex_hull(pts)));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user