Question

In: Computer Science

Interactive computer graphics course. by java language, no need to explain. Q1: Draw a line between...

Interactive computer graphics course.

by java language, no need to explain.

Q1: Draw a line between P0 and Pe

P0= (x,y)=(2,5)

Pe=(xe,ye)=(7,9)

Q2: P=(3,5) Scale P by (5,7) and then sheer by -3 along y-axis

Solutions

Expert Solution

Ans a) P0=(x,y)=(2,5)

Pe=(xe,ye)=(7,9)

Parametric equation of line is y=mx+b

where m=(ye-ys)/(xe-xs)

m=(9-5)/(7-2)=4/5=0.8

m<1 indicates that line is closer to x

then xi+1=xi+1

and yi+1=yi+m at each step of DDA algorithm

x y plotted y
2 5 2,5
2+1=3 5+0.8=5.8 3,6
3+1=4 5.8+0.8=6.6 4,7
4+1=5 6.6+0.8=7.4 5,7
5+1=6 7.4+0.8=8.2 6,8
6+1=7 8.2+0.8=9.0 7,9

now we have reached the point 7,9 so we will stop here and according to the plotted pts line can be drawn(we always use integer value for plotting a line in dda algorithm so pt y is rounded off for plotting).

Ans 2)P(x,y)=3,5

scaling factor Sx=5 and Sy=7 are given

After scaling

P(x')=Sx.x=5*3=15

P(y')=sy.y=7*5=35

So after scaling the point will be P(15,35)

Now On shearing this pt by -3 along y axis

means

now we have x=15,y=35

formula for shearing along y axis is

y'=y+shy.x and x'=x

where shy is shearing value along y axis

which is given as -3

now using the formula we get

x'=x=15

y'=35+15*(-3)=35-45=-10

So after shearing new coordinates will be 15,-10

So answer will be P(15,-10)


Related Solutions

Q1: Draw the graphics pipeline? Q2: Differentiate between Phong and Modified Phong model?
Q1: Draw the graphics pipeline? Q2: Differentiate between Phong and Modified Phong model?
Using any existing 2D or 3D graphics library ( Java 2D, Java 3D, draw a scene...
Using any existing 2D or 3D graphics library ( Java 2D, Java 3D, draw a scene within one of the following categories: Satire or humor Promote a cause You are free to create whatever you choose but it must conform to the following guidelines.   Show evidence of at least four colors. Have a textual composition on the finished product. Imagery or images Scene composition of at least six (6) elements One of the following 1) Shadows or Glows. May be...
Your task for this assignment is use the Java Canvas and Graphics classes to create an example of a computer generated image.
Your task for this assignment is use the Java Canvas and Graphics classes to create an example of a computer generated image. This is an opportunity for you to explore computer graphics and exercise some individual creativity. You should submit well-documented code, and once your program is done, create a presentation of your program. The presentation can be a PowerPoint or Word document, or something created with similar software. It could be a PDF file. Tell us what your prject is and...
Explain how Java is both a compiled and interpreted language.
Explain how Java is both a compiled and interpreted language.
Subject: Computer Graphics. 1. Explain how the projection process works; explain the various terms 2. Derive...
Subject: Computer Graphics. 1. Explain how the projection process works; explain the various terms 2. Derive the Npar Transformation matrix for parallel projection.
Hello! *Need in C language also need full documentation/explanation of each line* Designing and implementing an...
Hello! *Need in C language also need full documentation/explanation of each line* Designing and implementing an Array of Structures - Course Grade Write a program that uses a structure to store the following data: Member Name Description Name Student name Idnum Student ID number Scores [NUM_TESTS] an array of test scores Average Average test score Grade Course grade Declare a global const directly above the struct declaration
const int NUM_TESTS = 4; //a global constant The program should ask the...
I need to draw a cylinder in java with user input, and I can't seem to...
I need to draw a cylinder in java with user input, and I can't seem to get my lines to line up with my ovals correctly from the users input... I know I will have to either add or subtract part of the radius or height but I'm just not getting it right, here is how I'm looking to do it.            g.drawOval(80, 110, radius, height);            g.drawLine(?, ?, ?, ?); g.drawLine(?, ?, ?, ?);   ...
​​​​​​​LANGUAGE IS JAVA Part One A hotel salesperson enters sales in a text file. Each line...
​​​​​​​LANGUAGE IS JAVA Part One A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: The name of the client, the service sold (such as Dinner, Conference, Lodging, and so on), the amount of the sale, and the date of that event. Prompt the user for data to write the file. Part Two Write a program that reads the text file as described above, and that writes a separate file for each service...
*Need in C language also need full documentation/explanation of each line* Thank you! Write a program...
*Need in C language also need full documentation/explanation of each line* Thank you! Write a program that records high-score data from a simulated FIFA soccer game available online. The program will ask the user to enter the number of scores, create two dynamic arrays sized accordingly, ask the user to enter the indicated number of names and scores, and then print the names and scores sorted by score in descending order. The output from your program should look exactly like...
Course: Computer Architecture Theme: Internal Memory Draw the diagram of a typical 16 Mb DRAM (4M...
Course: Computer Architecture Theme: Internal Memory Draw the diagram of a typical 16 Mb DRAM (4M X 4) and explain its action. Draw the diagram of an SRAM cell and explain its action.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT