majroy / d3dslic3r

Slic3s and dic3s!
Other
0 stars 1 forks source link

Point ordering based on default scipy.spatial distance.cdist faulty #1

Closed majroy closed 3 months ago

majroy commented 3 months ago

See below for issue seen on slice 23 of the Stanford Bunny when slicing with a 4 mm average height, will likely need an exception for self-intersecting outlines:

image

majroy commented 3 months ago

@leoxiaoyuan Your function for detecting this condition doesn't correctly identify the issue:

def is_self_intersecting(contour_points):
    """
    Check if a given contour is self-intersecting.

    Params:
    contour_points: list of tuples representing (x, y) points.

    Returns:
    bool: True if the contour is self-intersecting
    """
    line = LineString(contour_points[:-1])
    return not line.is_simple

The function returns False for all slices. Changing the LineString definition to line = LineString(contour_points), it does start to discriminate; for the slice in question, it returns True, but so does slice 11 and 24 which don't have any observable self-intersections. It also returns true for other slices that do have very subtle self-intersections. Holding the issue open, remedies are to use the alpha shape outline mod; I am retaining the function to flag to the user at the command line that there might be self-intersections.

leoxiaoyuan commented 3 months ago

Can not reproduce 'The function returns False for all slices'. At my end, slice 23 could be detected correctly and only that slice could be detected.

majroy commented 3 months ago

Solved with "ContourLoopExtractor" - see JavaScript implmentation here: https://kitware.github.io/vtk-js/examples/ContourLoopExtraction.html. Now rolled into *post2.

majroy commented 3 months ago

Version 0.3post2 now has removed the agglomerating filter to pick up 'sub slices'.