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.

Write a C++ SFML program that plots a Pythagoras tree using asquare as a base using recursion, as illustrated below. Your task is

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!