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...
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.
Explain how Java is both a compiled and interpreted language.
Explain how Java is both a compiled and interpreted language.
Java language. Create the following Java command line iterator application Lab4. Pass in three arguments when...
Java language. Create the following Java command line iterator application Lab4. Pass in three arguments when the program starts. For example java Lab4 4 3 5 The command line arguments get passed into the main method as a String array in the variable object named args. Remember they get passed in as strings so you need to parse them into integers using the Integer.parseInt(args[X]) before you can treat them as integers. Create four sections that perform the following functions. Create...
Please use the Java Programming language. This is the introductory course, chapter two. Please only use...
Please use the Java Programming language. This is the introductory course, chapter two. Please only use if/else if, else and while loop. We have not touch base with do and while do(I don't know if while do exist in Java). Create an application that converts number grades to letter grades. Console Welcome to the Letter Grade Converter Enter numerical grade: 90 Letter grade: A Continue? (y/n): y Enter numerical grade: 88 Letter grade: A Continue? (y/n): y Enter numerical grade:...
I need convert this java code to C language. There is no string can be used...
I need convert this java code to C language. There is no string can be used in C. Thank you! import java.util.Scanner; public class Nthword { public static void main( String args[] ) { String line; int word; Scanner stdin = new Scanner(System.in); while ( stdin.hasNextLine() ) { line = stdin.nextLine(); word = stdin.nextInt(); stdin.nextLine(); // get rid of the newline after the int System.out.println( "Read line: \"" + line + "\", extracting word [" + word + "]" );...
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(?, ?, ?, ?);   ...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT