Skip to content

Commit

Permalink
effort toward #35
Browse files Browse the repository at this point in the history
  • Loading branch information
fstwn committed Jul 6, 2020
1 parent ad464ef commit 0eb26a7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions modules/Cockatoo/KnitNetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,10 @@ def AttemptWeftConnectionToCandidate(self, node, candidate, source_nodes, max_co
v_print("Connecting node {} to best ".format(node[0]) +
"candidate {}.".format(candidate[0]))
# if all conditions are met, make the 'weft' connection
self.CreateWeftEdge(node, candidate)
if node[1]["position"] < candidate[1]["position"]:
self.CreateWeftEdge(node, candidate)
else:
self.CreateWeftEdge(candidate, node)
return True
else:
return False
Expand Down Expand Up @@ -731,7 +734,10 @@ def _create_second_pass_weft_connections(self, contour_set, include_leaves=False
window[0][1]["position"]))

# connect weft edge
self.CreateWeftEdge(node, window[0])
if node[1]["position"] < window[0][1]["position"]:
self.CreateWeftEdge(node, window[0])
else:
self.CreateWeftEdge(window[0], node)
else:
# print info on verbose setting
v_print("Processing window nodes: {}".format(
Expand Down Expand Up @@ -801,7 +807,10 @@ def _create_second_pass_weft_connections(self, contour_set, include_leaves=False
fCand[1]["position"]))

# connect weft edge to best target
self.CreateWeftEdge(node, fCand)
if node[1]["position"] < fCand[1]["position"]:
self.CreateWeftEdge(node, fCand)
else:
self.CreateWeftEdge(fCand, node)

def InitializeWeftEdges(self, start_index=None, include_leaves=False, max_connections=4, least_connected=False, precise=False, verbose=False):
"""
Expand Down

0 comments on commit 0eb26a7

Please sign in to comment.