Untitled
unknown
plain_text
a year ago
734 B
21
Indexable
def transform(tree, dest_node, point):
path = []
# Search
def search(root, dest_node, path):
if not root:
return None
path.append(root)
if root.node_id == dest_node.node_id:
return True
if root.left and search(root.left, dest_node, path):
return True
if root.right and search(root.right, dest_node, path):
return True
path.pop()
return False
search(tree, dest_node, path)
if len(path) == 0:
return False
print(f'path:{[node.node_id for node in path]}')
path = path[1:]
# Transform
for transform in path:
point.location += transform.translation
return TrueEditor is loading...
Leave a Comment