diff --git a/xs/src/slic3r/GUI/GLCanvas3D.cpp b/xs/src/slic3r/GUI/GLCanvas3D.cpp index f1bbba934..45260544d 100644 --- a/xs/src/slic3r/GUI/GLCanvas3D.cpp +++ b/xs/src/slic3r/GUI/GLCanvas3D.cpp @@ -2209,14 +2209,49 @@ void GLCanvas3D::update_gizmos_data() TriangleMesh ch = model_object->mesh().convex_hull3d(); stl_facet* facet_ptr = ch.stl.facet_start; std::vector points; + const unsigned int k = 20; + const float ratio = 0.2f; + const unsigned int N = 3; // 3 - triangle + while (facet_ptr < ch.stl.facet_start+ch.stl.stats.number_of_facets) { Pointf3 a = Pointf3(facet_ptr->vertex[1].x - facet_ptr->vertex[0].x, facet_ptr->vertex[1].y - facet_ptr->vertex[0].y, facet_ptr->vertex[1].z - facet_ptr->vertex[0].z); Pointf3 b = Pointf3(facet_ptr->vertex[2].x - facet_ptr->vertex[0].x, facet_ptr->vertex[2].y - facet_ptr->vertex[0].y, facet_ptr->vertex[2].z - facet_ptr->vertex[0].z); + if (0.5 * sqrt(dot(cross(a, b), cross(a,b))) > 50.f) { - points.emplace_back(Pointf3s()); - for (unsigned int j=0; j<3; ++j) - points.back().emplace_back(Pointf3(facet_ptr->vertex[j].x, facet_ptr->vertex[j].y, facet_ptr->vertex[j].z)); + points.emplace_back(Pointf3s(2*k*N)); + + std::vector> neighbours; + if (k != 0) { + for (unsigned int j=0; jvertex[j].x, facet_ptr->vertex[j].y, facet_ptr->vertex[j].z); + neighbours.push_back(std::make_pair((int)(j*2*k-k) < 0 ? (N-1)*2*k+k : j*2*k-k, j*2*k+k)); + } + + for (unsigned int i=0; ivertex[j].x, facet_ptr->vertex[j].y, facet_ptr->vertex[j].z)); + points.back().emplace_back(Pointf3(facet_ptr->normal.x, facet_ptr->normal.y, facet_ptr->normal.z)); } facet_ptr+=1;