Closed majroy closed 3 months ago
Tried to reproduce the issue while keeping generated paths not transformed back, found there were no intersections on the bottom contour.
Tried to give yrange a larger range. (change yrange = [limits[2]1.2,limits[3]1.2] to yrange = [limits[2]1.2-100,limits[3]1.2+100]) Problem solved.
Any reason why to choose this range? Is that OK to just give it a very big range?
Main issue attributed to simultaneous move to centroid and rotation for path calculation. A two-stage move, first to the centroid and then rotated by the target theta value seems to fix the main issue noted for most values of theta Leaving open as there is still a problem:
Problem location: As shown in the figure, the intersection points of that line are marked with "o", the starting points of that contour is marked with 🌟. Because the starting point f the contour is in the middle, which would cause problem of the intersection points order. Therefore, if the 'pack up/pair intersections for line paths' is used, it will cause this problem.
Solution: reorder the contour to make sure the starting point always has the largest y value: X = do_transform(outline,trans)
max_y_index = np.argmax(X[:, 1])
# Reorder the contour points to start from the point with the maximum y value
reordered_contour = np.concatenate((X[max_y_index:-1], X[:max_y_index]), axis=0)
# Add the starting point to the end to close the contour
X = np.vstack([reordered_contour, reordered_contour[0]])
Previous method did not solve the problem indeed, it will cause:
So, instead, reorder the intersection points directly with: intersections = intersections[np.lexsort((intersections[:, 1], intersections[:, 0]))]
Seems working for both cases.
See issue here: Confirmed that still occurs with 'Path outline' enabled, and on outlines that have been processed by an alpha shape, see settings above to replicate.