User Tools

Site Tools


02_user_tutorials:21_exercices:03_exercises_binary_ternary_tree

From binary to ternary tree

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

Solution

solution

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
]
02_user_tutorials/21_exercices/03_exercises_binary_ternary_tree.txt · Last modified: 2025/12/10 16:22 by gaetan