MCPcopy Create free account
hub / github.com/MaximeHerpin/modular_tree / find_splits

Function find_splits

grease_pencil.py:56–73  ·  view source on GitHub ↗

Return a list of (parent_stroke, point_index, child_stroke) representing splits

(strokes)

Source from the content-addressed store, hash-verified

54
55
56def find_splits(strokes):
57 """ Return a list of (parent_stroke, point_index, child_stroke) representing splits """
58 splits = []
59 for i in range(len(strokes)):
60 point = strokes[i][0]
61 for j in range(len(strokes)):
62 dist = inf
63 dist_index = 0
64 if j != i:
65 for k, new_point in enumerate(strokes[j]):
66 new_dist = (point - new_point).length
67 if new_dist < dist:
68 dist = new_dist
69 dist_index = k
70 if dist < .001:
71 splits.append((j, dist_index, i))
72 # print(splits)
73 return splits
74
75
76def connect_strokes(moving_stroke, parent_stroke):

Callers 1

build_tree_from_strokesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected