Create a graphical user interface (GUI) for control and display of the Sierpinsk
ID: 3677332 • Letter: C
Question
Create a graphical user interface (GUI) for control and display of the Sierpinski fractal
Use the graphical user interface development environment (guide) to create a graphical user interface with the following properties. Your interface will provide (1) a plotting area, (2) allow for input of fractal specific parameters, (3) option to enable grid lines and clear the plotting area. The parameters will include the three triangle vertices and number of iterations. It should also be possible to (4) select the point color and style to be used. There also should be an option to (5) show progressive as well as aggregate rendering, i.e. a ckeckbox to specify that each point should be rendered as soon as it has been computed, versus plotting being deferred until the computation of all points is complete. The later will result in a major performance gain and you may label this toggle button “Optimize”. Your application should also (6) measure the time that it takes to run the computation and report it back in a static text field. Make sure that all widgets are properly labeled and self-explanatory. The name of your gui .fig and the associated .m file should be “sierpinskiGUI”.
Explanation / Answer
Ans: Working on problem 5, you will have learned that the resulting Sierpinski triangle provides a self-similar surface, where certain geometric features repeat over and over. You may also have observedthat the geometry changes at the midpoint of each triangle edge, knowledge that you can use to writea subdivision algorithm using the following pseudo code(a)Define the three vertices of the triangle, e.g. v1 = [0 0]; v2=[1 0]; v3 = [0.5 sqrt(3)/2];(b)For each of the three triangle edges, find the midpoint and plot it.(c)Subdivide the original triangle into four (imagine connecting the midpoints).(d)For each of the three smaller corner triangles repeat from step (b).(e)Terminate when a specified number of recursions has been reached.Use the following for your recursive function:function points = createSierpinskiRecursive(v1, v2, v3, reclevel)Hint: Generally, matlab will wait with printing your points until the recursive call has beencompleted. You can force matlab to update its active figure by calling “drawnow” in your function.Bonus Points:You will receive extra credit (2 points) if you also create a 3D version (tetrix) of theSierpinski triangle.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.