Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the java language to answer the following question. I will rate you up if you make me fully understand the question. The template is

Use the java language to answer the following question. I will rate you up if you make me fully understand the question.

image text in transcribed

The template is stated as following;

final int NUM_BALLS = 6; //This includes the "rogue" ball, too. final float BALL_SPACING = PI/12; //Angle between 2 balls in the "pack" final float BALL_DIAMETER = 8; //The size (diameter) of the balls final float BALL_ORBIT_RADIUS = 32; final float ORBIT_SPEED = PI/60.0; //Change in angle per frame final float ROGUE_BALL_SPEEDUP = 2.0; //How much faster does the rogue ball move?

//Keep track of the position of the "pack" of balls moving together //And also the one "rogue" ball moving on its own. float rogueBallAngle = 0; float trailingBallAngle = rogueBallAngle-BALL_SPACING*(NUM_BALLS+2); //Give it a slight head start

//Constants to control the colours final int BG_COLOUR = 192; final int BALL_COLOUR = 150; final int ROGUE_BALL_COLOUR = 255;

void setup() { size(500, 500); }//setup

void draw() { }//draw

Lab07 Gold X A lot of fancy cursors are used these days, with cool animations, to keep you from getting impatient while you wait for your computer to do something. (I'm not sure it really works.) Here's one for you to try to implement. A static picture is shown on the right. The description of the problem is as follows: There are N small circles (dots) in a ring around the mouse cursor. All of them are moving slowly clockwise. N-1 them are in a tight group, touching each other, and moving at the same speed. One of them (the white one) is not with the others, and is moving twice as fast. When this rogue dot catches up to the group of dots, then here's what should appear to happen: The rogue dot should join onto the trailing end of the group. The leading dot should now break away and become the rogue dot, moving twice as fast. This will repeat forever. The effect is like Newton's cradle (look it up in Wikipedia), except in a circle. This might keep you entertained while you wait for that huge file to download. Or not. Start with the supplied file Labo7GoldTemplate.pde, which contains the setup function and global declarations, to save you some typing (and give you a hint or two). Complete the draw function to obtain the desired effect. Notes: First try to get NUM_BALLS-1 dots moving correctly around the mouse, without the rogue" one. Your program should handle any value of NUM_BALLS (2) without changing any other code at all. This is important. Then add the rogue dot moving twice as fast (but just passing right through the others). Then try to detect when the rogue dot hits the others, and implement the required effect. That's the tricky bit, but it shouldn't take much code at all. Good luck! . Lab07 Gold X A lot of fancy cursors are used these days, with cool animations, to keep you from getting impatient while you wait for your computer to do something. (I'm not sure it really works.) Here's one for you to try to implement. A static picture is shown on the right. The description of the problem is as follows: There are N small circles (dots) in a ring around the mouse cursor. All of them are moving slowly clockwise. N-1 them are in a tight group, touching each other, and moving at the same speed. One of them (the white one) is not with the others, and is moving twice as fast. When this rogue dot catches up to the group of dots, then here's what should appear to happen: The rogue dot should join onto the trailing end of the group. The leading dot should now break away and become the rogue dot, moving twice as fast. This will repeat forever. The effect is like Newton's cradle (look it up in Wikipedia), except in a circle. This might keep you entertained while you wait for that huge file to download. Or not. Start with the supplied file Labo7GoldTemplate.pde, which contains the setup function and global declarations, to save you some typing (and give you a hint or two). Complete the draw function to obtain the desired effect. Notes: First try to get NUM_BALLS-1 dots moving correctly around the mouse, without the rogue" one. Your program should handle any value of NUM_BALLS (2) without changing any other code at all. This is important. Then add the rogue dot moving twice as fast (but just passing right through the others). Then try to detect when the rogue dot hits the others, and implement the required effect. That's the tricky bit, but it shouldn't take much code at all. Good luck

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 Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

What types of problems?

Answered: 1 week ago

Question

What did they do? What did they say?

Answered: 1 week ago