www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# cs 602 assignment 1 spring 2021

Views: 653

### Replies to This Discussion

Share the assignment Question & Discuss Here....

Stay touched with this discussion, Solution idea will be uploaded as soon as possible in replies here before the due date.

CS602-Assignment-01-Solution-Spring-2021-Complete-Solution

CS602-Assignment-01-Solution-Spring-2021-Complete-Solution.docx

Cs602 assignment no 1 solution spring 2021

Cs602 assignment no 1 solution spring 2021

CS602 Assignment 1 solution spring 2021 By Abid Farooq Bhutta CS602 Assignment No.1 Spring 2021 100% Correct Complete Solution By Abid Farooq Bhutta. CS602 Assignment 1 Complete Correct Solution Solved 2021 || Spring 2021 CS602 Solution Assignment no.1 2021 || Complete Correct Spring 2021 Solved. CS602 Assignment 1 Complete Solution Spring 2021, CS602 Assignment 1 Complete Solution, CS602 Assignment 1, CS602 , CS602 Assignment 1 solution, CS602 assignment Spring 2021, CS602 assignment solution Spring 2021, CS602 assignment, Assignment 1 CS602 solution, solution CS602 Assignment 1, CS602 Assignment 1 solution 2021, CS602 assignment solution 2021, CS602 Assignment 1, CS602 Assignment 1 solution Spring 2021, CS602 Assignment no 1 solution Spring 2021, CS602 Assignment no 1 solution 2021, CS602 1rd assignment solution 2021, CS602 1rd assignment solution, CS602 1st assignment solution Spring 2021,assignment solution Spring 2021, # CS602

# cs602 Assignment 1 solution spring 2021

CS602 Assignment#02 Solution Spring 2021

Question # 1

Write the midpoint circle algorithm in 5 to 6 steps. Calculate the pixel positions using addition and subtraction. Remember to access the screen coordinates as integer parameters.

Solution:

Step 1:

Step 2:

Initialize starting position as

x = 0 and y = r

Step 3:

Calculate initial value or decision as

P = 1.25 - r

Step 4:

do

{

plot (x,y)

if (d < 0)

{

x = x + 1

y = y – 1

d = d + 2x + 2y + 1

}

While (x<y)

Step 5:

Determine symmetry points

Step 6:

Stop.

ALGORITHM:

Step 1:

Put x = 0 and y = r in equation (2)

We have p = 1 - r

Step 2:

Repeat steps while x ≤y

plot (x,y)

if (p<0)

Then set p = p + 2x + 3

else

p = p + 2 (x - y) + 5

y = y – 1 (end if)

x = x + 1 (loop end)

Step 3:

End

Question # 2

Write a c++ program to display a raster tide using the midpoint algorithm. The radius of the circle and its coordinates are the inputs to your program. Use the frame buffer technique to set the pixel positions and colors.

Solution:

#include <iostream>

#include<conio.h>

#include<graphics.h>

using namespace std;

main ()

{

int h,k,x=0,y,r,d;

int gdriver= DETECT , gmode, errorcode;

initgraph(&gdriver,gmode,“”);

cout”ENTER CIRCLE X - AXIS”;

cin>>h;

cout”ENTER CIRCLE Y - AXIS”;

cin>>k

cin>>y

r=y;

d=1-r;

while(x>y);

{

If(d>0);

{

d=d+2*x+3;

}

else

{

d=d+2*(x-y)+5;

delay(200);

y=y-1;

}

x=x+1;

putpixel(x+h,y+k,1);

putpixel(y+h,x+k,2);

putpixel(-x+h,y+k,3);

putpixel(-y+h,x+k,4);

putpixel(-x+h,-y+k,5);

putpixel(-y+h,-x+k,6);

putpixel(x+h,-y+k,7);

putpixel(y+h,-x+k,8);

}

CS602-Assignment-01-Solution-Spring-2021-Complete-Solution

CS602-Assignment-01-Solution-Spring-2021-Complete-Solution.docx

1

2

3

4

5

59 minutes ago
59 minutes ago
3 hours ago
3 hours ago
3 hours ago
3 hours ago
3 hours ago
3 hours ago