Answered step by step
Verified Expert Solution
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 : Rotate Helicopter Blades: Trigonometry Marks
Purpose: Using the program to draw a Helicopter in Assignment Question 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 by
Based on the Trigonometry discussed in class, declare variables: delta and theta.
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 deltatheta
Initially, the blades should rotate with a constant speed.
Use the primitive data types int andor float
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 : Add a speed controller to change the Helicopter speed
with mouse clicks. 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 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
This function is only used to change the speed of the blades.
Step : Enable scaling with the speed buttons: Common Scaling Problem 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. Eg DELTAMAX, DELTAMIN, SCALEMAX and
SCALEMIN.
o DELTAMAX should be adjusted to give the best maximum speed in terms of appearance. Higher
speeds may not appear visibly pleasing.
o DELTAMIN is the value at which your Blades are at the minimum speed.
o SCALEMAX is the value that will make your Helicopter fill the x area. Note: Helicopter
may not be visible completely, but make your best judgement.
o SCALEMIN is the smallest scale possible that will give a good appearance.
Declare methods as needed to achieve the following:
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 DELTAMAX to DELTAMIN and
provide the corresponding scale value in the range SCALEMAX to SCALEMIN.
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 andor float where necessary.
All the max and min values are final constants.
Note: This is an active processing program with setup and draw
Use AQmp 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started