Return a list of (parent_stroke, point_index, child_stroke) representing splits
(strokes)
| 54 | |
| 55 | |
| 56 | def 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 | |
| 76 | def connect_strokes(moving_stroke, parent_stroke): |
no outgoing calls
no test coverage detected