Write a method that takes a float w and draw a pair of lines

Assignment Help Computer Engineering
Reference no: EM131400835

Assignment

Task 1

1) Write a method that draws a square such that the center of the square is the location of the mouse. This method does not need to take any inputs.

2) Write a method that takes an (x,y) position, and draws a pair of circles at that location: one smaller and the other larger, like this:

2054_Pair of Circle.jpg

3) Write a method that takes three ints: x, y, and c. It should then draw a rectangle at the location (x,y), that is a shade of grey based on c. If c is 0 it should be completely black, if c is 255 it should be completely white.

Task 2

1) Write a method that takes an (x,y) position, and draws a smiley face centered on that position. You may find the arc() method useful, but you can make the smiley face out of rectangles, ellipses, and lines if you want. It doesn't need to look great.

2) Write a method that takes four ints: x1, y1, x2, y2. It should then draw a rectangle with the top-left corner at (x1,y1), and the bottom right corner at (x2,y2). You can assume that (x2,y2) will always be down and to the right of (x1,y1).

3) Write a method that takes a float, w, and draws a pair of lines that cross at the location of the cursor. w is the total horizontal width of the X-shape that they make.

4) Write a method that takes 6 floats: x1,y1,x2,y2,x3,y3. It should then use the line() method to draw the three edges of a triangle that has corners at (x1,y1), (x2,y2), and (x3,y3). (It's interesting to note that this is basically the same as the triangle() method that is built into processing, except that you won't be adding the fill.)

Task 3

1) Write a method that takes 5 floats: x1, y1, x2, y2, and fraction. Assuming fraction is between 0 and 1, it should draw a circle centered that fraction of the way between (x1, y1) and (x2, y2). In other words, if fraction is 0, it should draw a circle at (x1, y1). If fraction is 1, it should draw a circle at (x2, y2). If fraction is 0.25, it should draw a circle one quarter of the way along an imaginary line that goes from (x1, y1) to (x2, y2). (Hint: the x position of the circle will only depend on the x values and fraction, so you might first start by thinking about it on just the x axis. This problem is fairly math- heavy.)

2) Write a method, pastel(), that takes 3 ints: r, g, and b, and sets the fill to a pastel version of that color. (A pastel color is simply a pale color. It might be worth playing around in the color selector or a drawing program to look for patterns in the r,g,b values of pale colors.) For example, pastel(255,0,0) should set the fill to pink, and pastel(0,255,255) should set the fill to light teal. It should not set the fill to completely white unless given values extremely close to 255. Write a second method colorNeg(), that takes 3 ints: r, g, and b, and sets the fill to the negative of that color. For example, colorNeg(0,0,0) should set the fill to white, and colorNeg(0,255,0) should set the fill to magenta.

1) Write a method that takes 6 integers: x1, y1, x2, y2, x3, y3. It should then draw three ellipses centered at those locations. It should always draw them so that ellipses further up and left are drawn on top. For example, you could draw the following set of circles with this method:

1650_Three Ellipses Centered.jpg

But not the same circles with the rightmost one on top. The leftmost circle is drawn on top of the one in the middle even though it's further down, because it's further left than it is down.

Reference no: EM131400835

Questions Cloud

Prepare a block diagram of a home intercom system : Four intercoms (located at the front door, the back door, the workshop, and the recreation room) connect to a multiplexer which in turn connects to two units, a speech synthesizer, and speech recognition hardware.
Discuss the causes of acute and chronic abdominal pain : Discuss and differentiate between the causes of acute and chronic abdominal pain in a 20-year-old versus a 50-year-old male. Provide a rationale for including the appropriate differential diagnoses in each age group.
What do you expect his or her score to be : The average math achievement test score of the population of eighth graders in a large city is known to be 100. You have selected a child at random. Her score turns out to be 110. You select a second child at random. What do you expect his or her ..
Would you rather toss the coin 10 times or 100 times : You will win a prize if you toss a coin a given number of times and get between 40% and 60% heads. Would you rather toss the coin 10 times or 100 times, or is there any difference?
Write a method that takes a float w and draw a pair of lines : Write a method that takes a float, w, and draws a pair of lines that cross at the location of the cursor. w is the total horizontal width of the X-shape that they make.
How many heads do you expect to have at the end of 10 flips : How many heads do you expect to have at the end of 10 flips? What is the expected percentage of heads at the end of 10 flips?
Substitution effect is larger than the income effect : For normal goods, the demand curve is a. always upward sloping. b. always downward sloping. c. upward sloping only if the income effect is larger than the substitution effect. d. downward sloping only if the substitution effect is larger than the ..
Evaluate the changes implemented by the firm : PM303 / POG303 Strategic Management Spring Coursework Brief. Your report should consider the following: Evaluate the changes implemented by the firm during the period of 2014-2016, including an assessment of the drivers for the changes
What is the expected value for the location of the defect : What is the probability density function? Write it in function notation, and also graph it.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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