Describe the animated sine curve

Assignment Help Computer Engineering
Reference no: EM132628935

Assignment: Task 1: Animated Sine Curve

Write a Python program one.py with PyOpenGL to display an animation of sine function y = Asin(x+B), satifying the following requirements:

• The window application's size is (600, 600), and its upper-left corner is at (250, 250) on the screen;

• The window application's title is Animated Sine Curve.

• The ranges of x and y are [-4, 4] (x is in radians);

• The amplitude A is a random float in [1, 2], and it is updated each time the window application restarts;

• The phase shift B is a float; it is initialized as 0, and incremented by 0.01 each time the screen refreshes;

• The two axes are drawn in white, with an arrow towards the positive direction at the end of each axis;

• The sine curve is drawn in yellow.

• Orthogonal projection is used in this task.

The following figure illustrates the expected window application.

Task 2: Clamped B-Spline

Write a Python program two.py with PyOpenGL to display a clamped B-spline, satifying the following requirements:

• The window application's size is (550, 550), and its upper-left corner is at (150, 150) on the screen;

• The window application's title is Special B-Splines.

• The program reads a text file named control-points.txt, including an x,y coordinate pair in each line as a control point, in the same folder;

• Control points are drawn with size 4 in green.

• Based on the control points, a clamped B-spline is drawn.

• P(t)'s color, mixed by red and blue, depends on its curvature (R = curvature / 5, G = 0.0, B = 1 - curvature / 5);

• Curvature is clipped by [0, 5].

• Orthogonal projection is used in this task.

The following figure illustrates the expected window application, reading the sample control-points.txt provided.

Task 3: Hexagonal Pyramid

Write a Python program three.py with PyOpenGL to display a 3D hexagonal pyramid, satifying the following requirements:

• The window application's size is (400, 400), and its upper-left corner is at (100, 100) on the screen;

• The window application's title is Hexagonal Pyramid.

• The program reads a text file named pyramid-params.txt, including one line as x,y,z,H,R, in the same folder, where x, y and z are the coordinates of the top vertex v, H is the height, and R is the radius; we assume the top vertex v and the base centroid c are on the same vertical axis, and c is always under v; the distance between c and any base vertex vi is always R.

• Based on the above information, a hexagonal pyramid is drawn.

• All faces are randomly and differently colored, except for the base in white.

• When the key R is pressed, the radis increases by 0.01 and the hexagonal pyramid is redrawn.

• When the key H is pressed, the height decreases by 0.01 and the hexagonal pyramid is redrawn.

• The hexagonal pyramid is static by default; When the key X, Y or Z is pressed, the hexagonal pyramid toggles between being static and rotating 1 degree/refresh along the corresponding axis (i.e., the key X corresponds to the x axis), taking c as the origin.

• Perspective projection is used in this task (FoV is 90 degrees towards the y-axis; Camera looks at the origin and uses the y-axis direction as the up-vector).

The following figure illustrates the expected window application, reading the sample pyramid-params.txt provided.

Reference no: EM132628935

Questions Cloud

What the estimated direct labor-hours at the beginning : If the predetermined overhead rate, What the estimated direct labor-hours at the beginning of the year used in the predetermined overhead rate must have been
Which is the best or most adequate approach to morality : Which is the best or most adequate approach to morality: egoism, utilitarianism, or deontology? Why?
Notable ethical theories on the topic of justice : Relate one's moral framework to notable ethical theories on the topic of justice.
What journal entry to record the purchase of raw materials : During the month, the Corporation purchased an additional $83,000 of raw materials. The journal entry to record the purchase of raw materials would include a
Describe the animated sine curve : Write a Python program one.py with PyOpenGL to display an animation of sine function y = Asin(x+B), satifying the following requirements.
Compute for the expected maintenance cost for june : Using the least-squares regression method, compute for the expected maintenance cost for June if expected labor hours is 150 hours.
Balanced Scorecard for Mercy Hospital : Look at the Balanced Scorecard for Mercy Hospital. Use Memorandum format and direct it to your faculty.
Plot the data on a graphing paper : Using the scattergraph method, derive a cost formula for utilities cost. Use your cost formula to predict the utilities cost if 5,200 meals are served.
Explain the causes of the french revolution : Explain the causes of the French Revolution. Why did Louis XVI call a meeting of the Estates-General in May 1789?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Sector specific challenges in crafting security policy

Compare and contrast at least two U.S. Critical Infrastructure sector specific challenges in crafting security policy

  Show the data-path for the small computer

If the CPU architecture supports 8-registers (R0, R1, ..., R8) and a maximum of 32-instructions.

  Developing a formal risk management plan for an organization

You will gain an overall understanding of risk management, its importance, and critical processes required when developing a formal risk management plan.

  Explain the operation of the modified register

One input of the NAND gate receives the clock pulses from the clock-pulse generator. The other input of the NAND gate provides a parallel-load control. Explain the operation of the modified register.

  Assume that queue is a queue type object

assume that queue is a queue type object and the size of the array-implementing queue is 100. Also, suppose that the value of the queueFront is 25 and the value of queueRear is 25.

  Advantages and disadvantages of nonstatistical sampling

Nonstatistical Sampling. Marley Brown is planning the substantive procedures for the audit of Longhorn Company's inventory, which had a recorded (unaudited).

  How to releasing the memory using the delete operat

In class, we have been discussing creating objects using the new operator and releasing the memory using the delete operator. Two other similar operators are new[] and delete[]. These operators work the similar as the new and delete but with arrays..

  The tabular output has to include these cross-totals

Thus, each salesperson passes in between 0 and 5 sales slips per day. suppose that the information from all the slips for last month is available.

  Construct a 3-bit counter

Construct a 3-bit counter using three D flip-flops and a selection of logic gates. The inputs should consist of a signal that resets the counter to 0, called reset, and a signal to increment the counter, called inc.

  Why is the organizational culture important

Why is the organizational culture important to consider in implementing ERM. Explain how the culture of an organization can have advantages and disadvantages.

  What are the benefits of doing a pilot program

ITS-836: Data Science and Big Data Analytics - What are the benefits of doing a pilot program before a full-scale rollout of a new analytical methodology?

  Write a c program to compute the check digit for the upc

Write a C program to compute the check digit for the UPC. Compute the Checksum as follows: Add the odd digits together in one sum.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd