Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Basically, we have to check if the list of the points x1, y1, and x2, y2 intersect the Sierpinski triangle. number 2 is the level

image text in transcribedimage text in transcribed

Basically, we have to check if the list of the points x1, y1, and x2, y2 intersect the Sierpinski triangle. number 2 is the level of the Sierpinski triangle, he can change that number to 5 level or 4. we just have these numbers to run a code. the professor will have four different input text files with different x1, y1, and x2, y2 numbers. we have to make sure it works for all those inputs. I personally prefer JAVA coding.

2 Sierpinski (Wikipedia) The Sierpinski triangle, also called the Sierpinski gasket or Sier- pinski sieve, is a fractal attractive fixed set with the overall shape of an equi- lateral triangle, subdivided recursively into smaller equilateral triangles. Orig- inally constructed as a curve, this is one of the basic examples of self-similar sets-that is, it is a mathematically generated pattern that is reproducible at any magnification or reduction. It is named after the Polish mathematician Wacaw Sierpinski, but appeared as a decorative pattern many centuries before the work of Sierpinski. sh Your goal for this assignment will be to deterine whether certain given line segments intersect the Sierpinski triangle of a given order n on a hexagonal grid. The n=1 Sierpinski triangle goes 1 step 60 degrees counterclockwise from horizontal (Horizontal is directly east.), 1 step horizontal, then 1 step 300 de- grees counterclockwise from horizontal. Given the nth Sierpinski triangle, in order to get the n+1th triangle, 1 1. Draw the nth Sierpinski triangle reflected about the c-axis and rotated by 60 degrees counterclockwise. 2. Draw the nth Sierpinski triangle with the beginning of this attached to the end of the first. 3. Draw the nth Sierpinski triangle reflected about the r-axis and rotated by 60 degrees clockwise with the beginning of this attached to the end of the second. The difference between the Sierpinski triangle and the triangle that you will create is that the steps in the Sierpinski triangle get smaller with each iteration. Your steps will always be length exactly 1. You will take in m line segments and determine whether each intersects the Sierpinski triangle of order n. 3 Input/Output The input (input.txt) will contain the value of n and then a sequence of values that represent line segments. Each line segment will be of the form (11, y) to (12,42), and each line holds the values in order 11911292- For example, 2 1.0760331826619962 0.3768219377107604 1.3886840037284933 0.8428993719422269 2.5761061173445765 0.48088033384281753 2.912440888830008 0.7802824833362976 1.0838045293362306 2.1113441674425886 1.3753554984450607 1.8283532673592844 The output (output.txt) should just hold a 0 (does not intersect the Sier- pinski structure) or 1 (does intersect the Sierpinski structure), one per line. For example, in this case: 0 1 1 The second and third line segments intersect the Sierpinski structure of order 2 but the first doesn't. 2 Sierpinski (Wikipedia) The Sierpinski triangle, also called the Sierpinski gasket or Sier- pinski sieve, is a fractal attractive fixed set with the overall shape of an equi- lateral triangle, subdivided recursively into smaller equilateral triangles. Orig- inally constructed as a curve, this is one of the basic examples of self-similar sets-that is, it is a mathematically generated pattern that is reproducible at any magnification or reduction. It is named after the Polish mathematician Wacaw Sierpinski, but appeared as a decorative pattern many centuries before the work of Sierpinski. sh Your goal for this assignment will be to deterine whether certain given line segments intersect the Sierpinski triangle of a given order n on a hexagonal grid. The n=1 Sierpinski triangle goes 1 step 60 degrees counterclockwise from horizontal (Horizontal is directly east.), 1 step horizontal, then 1 step 300 de- grees counterclockwise from horizontal. Given the nth Sierpinski triangle, in order to get the n+1th triangle, 1 1. Draw the nth Sierpinski triangle reflected about the c-axis and rotated by 60 degrees counterclockwise. 2. Draw the nth Sierpinski triangle with the beginning of this attached to the end of the first. 3. Draw the nth Sierpinski triangle reflected about the r-axis and rotated by 60 degrees clockwise with the beginning of this attached to the end of the second. The difference between the Sierpinski triangle and the triangle that you will create is that the steps in the Sierpinski triangle get smaller with each iteration. Your steps will always be length exactly 1. You will take in m line segments and determine whether each intersects the Sierpinski triangle of order n. 3 Input/Output The input (input.txt) will contain the value of n and then a sequence of values that represent line segments. Each line segment will be of the form (11, y) to (12,42), and each line holds the values in order 11911292- For example, 2 1.0760331826619962 0.3768219377107604 1.3886840037284933 0.8428993719422269 2.5761061173445765 0.48088033384281753 2.912440888830008 0.7802824833362976 1.0838045293362306 2.1113441674425886 1.3753554984450607 1.8283532673592844 The output (output.txt) should just hold a 0 (does not intersect the Sier- pinski structure) or 1 (does intersect the Sierpinski structure), one per line. For example, in this case: 0 1 1 The second and third line segments intersect the Sierpinski structure of order 2 but the first doesn't

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions

Question

What are the best ways to prevent white collar crime?

Answered: 1 week ago