preserve order of rails in satin with rungs

pull/5/head
Lex Neva 2017-10-25 03:12:10 +01:00
rodzic 5986ea4f22
commit 806123b6ac
1 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -1271,7 +1271,9 @@ class SatinColumn(EmbroideryElement):
def flatten_beziers_with_rungs(self):
input_paths = [self.flatten([path]) for path in self.csp]
input_paths = [shgeo.LineString(path[0]) for path in input_paths]
input_paths.sort(key=lambda path: path.length, reverse=True)
paths = input_paths[:]
paths.sort(key=lambda path: path.length, reverse=True)
# Imagine a satin column as a curvy ladder.
# The two long paths are the "rails" of the ladder. The remainder are
@ -1279,6 +1281,10 @@ class SatinColumn(EmbroideryElement):
rails = input_paths[:2]
rungs = shgeo.MultiLineString(input_paths[2:])
# The rails should stay in the order they were in the original CSP.
# (this lets the user control where the satin starts and ends)
rails.sort(key=lambda rail: input_paths.index(rail))
result = []
for rail in rails: