Recursive MATLAB program for building the Pythagoras Tree
200 likes | 266 Views
This MATLAB program builds the Pythagoras Tree using recursion. It includes variations with different inclination angles and calculates the total area for each level.
Recursive MATLAB program for building the Pythagoras Tree
E N D
Presentation Transcript
Recursive MATLAB program for building the Pythagoras Tree Alexander Rozhok, IAN-103
Total area remains the same for each level 0.125 0.125 0.125 0.125 0.25 0.25 0.125 0.125 0.25 0.25 0.5 0.5 0.125 0.125 1
Pythagoras Tree variations with different angles of inclination
Recursive function header α i-th level point1 point2
Finding the triangle vertex pcenter Our goal is to find the coordinates of pcenter so we would be able to build new squares α dirVector i-th level point2 point1
Finding the coordinates of new squares p3 pcenter p2 i-th level point1 point2 Performing similar operation for the second square: