tree structure mutation and arbitrary rotation in patterns