Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You must not use any of Processings built-in drawing commands such as point(), line(), triangle(), etc. All images must be created pixel by pixel. The

You must not use any of Processings built-in drawing commands such as point(), line(), triangle(), etc. All images must be created pixel by pixel.

image text in transcribed

The following parametric equations draw a Fourier knot of type (1,1,2). x(t)y(t)z(t)=Rcos(nxt+x)=Rcos(nyt+y)=cos(nz,1t+z,1)+cos(nz,2t+z,2) In these equations, the constants nx,ny,nz,1 and nz,2 are positive integers. The constants x,y, z,1 and z,2 are phase angles. The phase angles can be any real numbers, but I recommend trying decimal values between 0 and 1 . You will get the best results if nx and ny are relatively prime. The constant R is used to rescale the knot so that it is a reasonable size on the raster. The x and y coordinates will range from R to R. The complete knot is drawn as the parameter t ranges from 0 to 2. Complete the function drawFourierKnot() so that it uses the parametric equations given above to draw a Fourier knot on the raster. You do not need to rigorously calculate a step size. Simply experiment with the number of steps for the parameter t until you get a reasonably smooth curve. To start with, ignore the z coordinate and just plot the (x,y) coordinates. Once that's working, use the z coordinate to scale the shade of each pixel so that pixels with large z values are brighter than those with small z values. The result should convey the 3D structure of the knot. The shades do not have to vary all the way from 0 to 1 , as long as the pixels get brighter as they come closer to the viewer. The details are up to you. Generated with x(t)=200cos(2t+0.8),y(t)=200cos(3t+0.15),z(t)=cos(4t+1)+cos(5t). Parameter values obtained from the paper linked above. You can create a wide range of different shapes by varying the parameters. Experiment until you get an image that you like. In your final submission, your curve must cross itself at least once. Programming note. The parameter t will have to be floating point. However, you should not accumulate floats in your for loop. Use integers for the counter and the number of steps, and calculate each value of t from them

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

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

Students also viewed these Databases questions