Question
Write a C++ SFML program that plots a Pythagoras tree using a square as a base using recursion, as illustrated below. Your task is to
Write a C++ SFML program that plots a Pythagoras tree using a square as a base using recursion, as illustrated below.
Your task is to write a program PTree.cpp with a recursive function pTree(), and a main() program that calls the recursive function. Your program shall take two command-line arguments L and N: L size of the base square (double) N the depth of the recursion
Your Makefile should contain two targets: all and clean. The former should build both executables, and the latter should remove the executables, .o files, and all other temporary files created during the build.
Notes:
You should create a PTree class that derives from sf::Drawable. Then, you can have it just draw itself to your main window.
Review Jon's LineSegment example to see a simple example of how to do this: LineDemo.tar.gz.
Using SFML's ConvexShape class is a good way to draw a square.
Your executable must read two parameters (integers): recursion-depth and window-size. You should create a square SFML window that's exactly as big as the window-size argument, and your triangle should fill it.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started