Skip to content

Commit

Permalink
Fixed a regression issue in the triangle mesh slicing code, where
Browse files Browse the repository at this point in the history
a broken contour was not glued together using the closest neighbors.
  • Loading branch information
bubnikv committed Mar 11, 2019
1 parent a0d5a96 commit c482933
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/admesh/connect.cpp
Expand Up @@ -293,8 +293,8 @@ static int stl_load_edge_nearby(stl_file *stl, stl_hash_edge *edge, stl_vertex *
{
// Index of a grid cell spaced by tolerance.
typedef Eigen::Matrix<int32_t, 3, 1, Eigen::DontAlign> Vec3i;
Vec3i vertex1 = (*a / tolerance).cast<int32_t>();
Vec3i vertex2 = (*b / tolerance).cast<int32_t>();
Vec3i vertex1 = ((*a - stl->stats.min) / tolerance).cast<int32_t>();
Vec3i vertex2 = ((*b - stl->stats.min) / tolerance).cast<int32_t>();
static_assert(sizeof(Vec3i) == 12, "size of Vec3i incorrect");

if (vertex1 == vertex2)
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Point.hpp
Expand Up @@ -224,7 +224,7 @@ template<typename ValueType, typename PointAccessor> class ClosestPointInRadiusL
const ValueType &value = it->second;
const Vec2crd *pt2 = m_point_accessor(value);
if (pt2 != nullptr) {
const double d2 = (pt - *pt2).squaredNorm();
const double d2 = (pt - *pt2).cast<double>().squaredNorm();
if (d2 < dist_min) {
dist_min = d2;
value_min = &value;
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/SupportMaterial.cpp
Expand Up @@ -2850,7 +2850,7 @@ void modulate_extrusion_by_overlapping_layers(
if (end_and_dist2.first == nullptr) {
// New fragment connecting to pt_current was not found.
// Verify that the last point found is close to the original end point of the unfragmented path.
//const double d2 = (pt_end - pt_current).squaredNorm();
//const double d2 = (pt_end - pt_current).cast<double>.squaredNorm();
//assert(d2 < coordf_t(search_radius * search_radius));
// End of the path.
break;
Expand Down
5 changes: 3 additions & 2 deletions src/libslic3r/TriangleMesh.cpp
Expand Up @@ -620,8 +620,9 @@ void TriangleMesh::require_shared_vertices()
for (int nbr_idx = 0; nbr_idx < 3; ++nbr_idx) {
int nbr_face = this->stl.neighbors_start[facet_idx].neighbor[nbr_idx];
if (nbr_face != -1) {
assert(stl.v_indices[nbr_face].vertex[(nbr.which_vertex_not[nbr_idx] + 1) % 3] == vertices[(nbr_idx + 1) % 3]);
assert(stl.v_indices[nbr_face].vertex[(nbr.which_vertex_not[nbr_idx] + 2) % 3] == vertices[nbr_idx]);
assert(
(stl.v_indices[nbr_face].vertex[(nbr.which_vertex_not[nbr_idx] + 1) % 3] == vertices[(nbr_idx + 1) % 3] && stl.v_indices[nbr_face].vertex[(nbr.which_vertex_not[nbr_idx] + 2) % 3] == vertices[nbr_idx]) ||
(stl.v_indices[nbr_face].vertex[(nbr.which_vertex_not[nbr_idx] + 2) % 3] == vertices[(nbr_idx + 1) % 3] && stl.v_indices[nbr_face].vertex[(nbr.which_vertex_not[nbr_idx] + 1) % 3] == vertices[nbr_idx]));
}
}
}
Expand Down

0 comments on commit c482933

Please sign in to comment.