[SOLVED] C++ html math Practice using functions.

$25

File Name: C++_html_math__Practice_using_functions..zip
File Size: 376.8 KB

5/5 - (1 vote)

Practice using functions.
Practice abstraction and using parameters.
Understand basics of computer rendering.
Learn about Lissajous Curves.
Write a program in C++ that will display the image subdivided into four colored sections as seen on the right. Teal on the top left, yellow on the top right, white on the bottom left and purple on the bottom right.
In the white square draw a filled yellow circle.
In the teal square draw a Lissajou curve with parameters x=5, y=6 or ratio=5/6.
In the yellow square draw a Lissajou curve with parameters x=3, y=5 or ratio=3/5.
In the purple square draw a Lissajou curve with parameters x=7, y=4 or ratio=7/4.
Select some contrasting colors so that the curves are visible.
Implement the background coloring and Lissajous curves using parameterized functions FillRectangle(); and DrawLissajou(); (so that each of the squares will be calling the same FillRectangle(); using a different set of parameters);
The Lissajou curves are a family of simple trigonometric curves parameterized as:
You can think of x as a parameter which dictates how quickly the cosine function revolves in that direction, influencing how many revolutions the curve will make as it spans its width. You can learn more about them here: http://mathworld.wolfram.com/LissajousCurve.html
To fill in the circle, you can think of it as coloring in all the points that are within a certain distance from the center. Consider the equation for the distance between two points:

CalcImage();
setPixel(int x, int y, unsigned char red, unsigned char green, unsigned char blue);
Sets the pixel at position [x,y] to the RGB color(red,green,blue) where the color
components are on the range 0-255.
MAX
The total width / height of the image in pixels.
Keyboard(int key);
Called whenever a key is hit. There is a switch inside to handle different inputs. glutPostRedisplay();
Informs the window that it should be repainted.
Extra credit will be awarded for making some element of the rendering animated.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] C++ html math Practice using functions.
$25