Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Step 1 : Rotate Helicopter Blades: Trigonometry [ 1 0 Marks ] Purpose: Using the program to draw a Helicopter in Assignment 1 Question 2

Step 1: Rotate Helicopter Blades: Trigonometry [10 Marks]
Purpose: Using the program to draw a Helicopter in Assignment 1 Question 2, update the code to enable rotation
of the Helicopters Blades at a constant speed.
Details: To complete your sketch should meet the following criteria:
Use a canvas size of 500 by 500.[1]
Based on the Trigonometry discussed in class, declare variables: delta and theta. [2]
o theta will be the initial angle of the propeller.
o delta is the angle by which theta would change each frame
to give Blades a rotating effect.
o Note: Depending on how the blade has been drawn, you
may need to declare more than one delta/theta.
Initially, the blades should rotate with a constant speed.
Use the primitive data types int and/or float [2].
Other requirements:
o For this question, at all times, your Helicopter should be at
the center of the canvas, although it may not necessarily
fill the canvas.
o The setup and draw functions are required in this
question.
Step 2: Add a speed controller to change the Helicopter speed
with mouse clicks. [10 Marks]
Purpose: Create a speed controller that will allow user to change the speed
of the Helicopter blades interactively.
Draw a speed controller as shown in Figure 1. It should consist of two buttons: a button with UP displayed
on it and a button with a DN displayed on it. The UP button will increase the speed of the Helicopter and
DN button will decrease the speed.
You should create a function for this functionality. This function will then call the two functions that will
be added in step 3.
This function is only used to change the speed of the blades.
Step 3: Enable scaling with the speed buttons: Common Scaling Problem [10 Marks]
Purpose: Update your program to give a flying effect to the Helicopter, so that it appears to be rising up out of the
canvas toward the user. When the program starts, the blades should be moving with constant speed and should be
drawn at the smallest scale. When the UP button is pressed, the blades should start to rotate and the size of the
Helicopter should increase. The rotation speed and the Helicopters size should continue to increase every time the
top button is pressed. When the DN button is pressed, the speed and size should decrease.
Details:
Declare four final named constants: This is to assign maximum and minimum values to the Helicopters
scale and delta (rotation speed) individually. E.g., DELTA_MAX, DELTA_MIN, SCALE_MAX and
SCALE_MIN.[4]
o DELTA_MAX should be adjusted to give the best maximum speed in terms of appearance. Higher
speeds may not appear visibly pleasing.
o DELTA_MIN is the value at which your Blades are at the minimum speed.
o SCALE_MAX is the value that will make your Helicopter fill the 500x 500 area. Note: Helicopter
may not be visible completely, but make your best judgement.
o SCALE_MIN is the smallest scale possible that will give a good appearance.
Declare methods as needed to achieve the following: [6]
These methods should be called to update the value of delta so that speed of the blades
increases or decreases when UP and DN buttons are pressed on the controller.
o Other purpose will be to take the value of delta in the range DELTA_MAX to DELTA_MIN and
provide the corresponding scale value in the range SCALE_MAX to SCALE_MIN.
o Use the formula explained in the common scaling problem slide to achieve the result.
o Again, this will ensure that the speed of the propeller scales according to the size of the
Helicopter. When the speed is maximum, the Helicopter should be scaled to fit the canvas. When
the blades stop moving, the Helicopters scale should be the smallest.
Use the primitive data types int and/or float where necessary.
All the max and min values are final constants.
Note: This is an active processing program (with setup and draw).
Use A2Q1.mp4 for reference. Please note, the video is buggy. The rotation of blades at high speed appear as if
the blades are not rotating at all.

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

A discriminative classifier models the posterior Ply | x ) directly

Answered: 1 week ago

Question

Summarize the reactive strategy of your organization.

Answered: 1 week ago