Question: 2. (Problem 2.6, page 116) Space-filling curves have interested mathematicians for centuries. In the limit, these curves have infinite length, but they are confined to

 2. (Problem 2.6, page 116) Space-filling curves have interested mathematicians forcenturies. In the limit, these curves have infinite length, but they are

2. (Problem 2.6, page 116) Space-filling curves have interested mathematicians for centuries. In the limit, these curves have infinite length, but they are confined to a finite rectangle and never cross themselves. Many of these curves can be generated iteratively. Consider the "rule pictured in Figure 2.48 (page 111) that replaces a single line segment with four short segments. Write a program that starts with a triangle and iteratively applies the replacement rule to all the line segments. The object that you generate is called the Koch snowflake. A 1 1 1 1 1 The initial triangle is the start level 0. Try 1, 3, and 5 levels of recursive replacements respectively. Hint: To get started with this question, I suggest you first to modify "gasket2.html" and "gasket2.js" such that it simply draws the initial triangle in line style. If you have difficulty to do this, I have provided them as "gasket2a.html" and "gasket2a.js" for your reference. Next, you consider replacing each line with 4 short lines using the rule provided in the question. Each line is defined by two points. Therefore, this step requires you to find 3 new points in addition to the 2 given points. Specifically, given two points, PO = (x0, yo), and P1 = (x1, y1): P1 B A PO (a) We need first to find the coordinates for the points A and B respectively, such that A and B divide the line segment (PO -> P1) evenly into three sections. (b) Then, we find the coordinate of the point C, such that the triangle A-B-C has an equal side length. (The point C should be on the left-hand side if you "walk" from PO to P1.) To derive the points A, B, and C, you need some knowledge learned from Calculus. If you do not know how to derive them now, you can click the link "findABC" which provides two solutions to this problem. 2. (Problem 2.6, page 116) Space-filling curves have interested mathematicians for centuries. In the limit, these curves have infinite length, but they are confined to a finite rectangle and never cross themselves. Many of these curves can be generated iteratively. Consider the "rule pictured in Figure 2.48 (page 111) that replaces a single line segment with four short segments. Write a program that starts with a triangle and iteratively applies the replacement rule to all the line segments. The object that you generate is called the Koch snowflake. A 1 1 1 1 1 The initial triangle is the start level 0. Try 1, 3, and 5 levels of recursive replacements respectively. Hint: To get started with this question, I suggest you first to modify "gasket2.html" and "gasket2.js" such that it simply draws the initial triangle in line style. If you have difficulty to do this, I have provided them as "gasket2a.html" and "gasket2a.js" for your reference. Next, you consider replacing each line with 4 short lines using the rule provided in the question. Each line is defined by two points. Therefore, this step requires you to find 3 new points in addition to the 2 given points. Specifically, given two points, PO = (x0, yo), and P1 = (x1, y1): P1 B A PO (a) We need first to find the coordinates for the points A and B respectively, such that A and B divide the line segment (PO -> P1) evenly into three sections. (b) Then, we find the coordinate of the point C, such that the triangle A-B-C has an equal side length. (The point C should be on the left-hand side if you "walk" from PO to P1.) To derive the points A, B, and C, you need some knowledge learned from Calculus. If you do not know how to derive them now, you can click the link "findABC" which provides two solutions to this

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!