User Tools

Site Tools


tutorials:exercises_binary_ternary_tree

This is an old revision of the document!


From binary to ternary tree

Change the default 3d binary tree to a ternary version, a tree with tree instead of two brances.

Solution

To achieve this, we need to add another branch and explicitly rotate the branches to (0, 120, and 240) degree.

public void run3() [
  A(x) ==> F(x) 
    [RH(  0) RU(45) RH(90) A(x*0.8)]  // first branch  
    [RH(120) RU(45) RH(90) A(x*0.8)]  // second branch
    [RH(240) RU(45) RH(90) A(x*0.8)]; // third branch
]
tutorials/exercises_binary_ternary_tree.1761670043.txt.gz · Last modified: 2025/10/28 17:47 by MH