Skip to content

CS602 - Computer Graphics

3 Topics 22 Posts
  • CS602 GDB1 Solution and discussion

    cs602 gdb 1 solution discussion fall 2019
    1
    0 Votes
    1 Posts
    390 Views
    No one has replied
  • 0 Votes
    2 Posts
    1k Views
    zareenZ
    Q. 1 Solution Idea a. Final intensity of light is (0.4,0.7,0) +(0.2,0.1,0.5) +(-0.5, -0.6,0.5) +(-0.1, - 0.2,0) = (0,0,1) b. Overall Contribution: id ⨂ cs = (0,0,1) ⨂ (0.5,0.7,0.8) = (0,0,0.8) c. Red and Green components will remain absent from the scene d. The object will look blue in the presence of light sources. Q. 2 Solution Idea: [image: swrVJac.png]
  • CS602 Assignment 2 Solution and Discussion

    Solved cs602 assignment 2 solution discussion fall 2019
    3
    0 Votes
    3 Posts
    958 Views
    zareenZ
    //<!--CS602 ASSIGNMENT 2 SOLUTION--> //<!--FALL 2019--> //<!--DUE DATE: 27 NOVEMBER, 2019--> //PRE-PARED BY: SUPERSTARWEBTECH.COM //CONNECT WITH US:FACEBOOK.COM/SUPERSTARWEBTECH //E-MAIL: SUPERSTARWEBTECH@GMAIL.COM #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <graphics.h> #include <math.h> class House { private: int x1,x2,x3,x4,x5; int y1,y2,y3; int dx1, dx2; int dy1, dy2; int xc,yc; public: House() { xc=45; yc=65; //center of figure x1=30; x2=x1+50; x3=20; x4=x3+20; x5=x4+50; y1=30; y2=y1+20; y3=y2+50; dx1=x3+5; dx2=dx1+10; dy1=y2+30; dy2=dy1+20; } void translate(int tx, int ty) //draw translate house { x1+=tx; x2+=tx; x3+=tx; x4+=tx; x5+=tx; y1+=ty; y2+=ty; y3+=ty; dx1+=tx; dx2+=tx; dy1+=ty; dy2+=ty; } void scale(int sx, int sy) //draw scaled house { x1=xc+(x1-xc)*sx; x2=xc+(x2-xc)*sx; x3=xc+(x3-xc)*sx; x4=xc+(x4-xc)*sx; x5=xc+(x5-xc)*sx; y1=yc+(y1-yc)*sy; y2=yc+(y2-yc)*sy; y3=yc+(y3-yc)*sy; dx1=xc+(dx1-xc)*sx; dx2=xc+(dx2-xc)*sx; dy1=yc+(dy1-yc)*sy; dy2=yc+(dy2-yc)*sy; } void reflectx(int rx) { y1=-y1+rx; y2=-y2+rx; y3=-y3+rx; dy1=-dy1+rx; dy2=-dy2+rx; } void reflecty(int ry) { x1=-x1+ry; x2=-x2+ry; x3=-x3+ry; x4=-x4+ry; x5=-x5+ry; dx1=-dx1+ry; dx2=-dx2+ry; } void drawH() //draw house { int arr[]={x1,y1,x2,y1,x5,y2,x5,y3,x3,y3,x3,y2,x1,y1,x4,y2,x4,y3,x3,y3,x3,y2,x5,y2}; drawpoly(12,arr); //draw house rectangle(dx1,dy1,dx2,dy2); //draw house door } void fillH() { setfillstyle(HATCH_FILL,GREEN); floodfill(x1+1,y1+10,WHITE); floodfill(x1+1,y1+1,WHITE); setfillstyle(SOLID_FILL,RED); floodfill(x3+1,y2+1,WHITE); setfillstyle(SOLID_FILL,YELLOW); floodfill(x4+1,y2+1,WHITE); setfillstyle(SOLID_FILL,GREEN); floodfill(dx1+1,dy1+1,WHITE); } void fillH2(){ setfillstyle(HATCH_FILL,GREEN); floodfill(x1+1,y1-10,WHITE); floodfill(x1+1,y1-1,WHITE); setfillstyle(SOLID_FILL,RED); floodfill(x3+1,y2-1,WHITE); setfillstyle(SOLID_FILL,YELLOW); floodfill(x4+1,y2-1,WHITE); setfillstyle(SOLID_FILL,GREEN); floodfill(dx1+1,dy1-1,WHITE); } }; int main() { int gd=DETECT, gm; initgraph(&gd,&gm,(char*)" "); setcolor(WHITE); settextstyle(DEFAULT_FONT, HORIZ_DIR, 2); outtextxy(2, 2, (char*)"BC123456789"); House house; //draw main house house.drawH(); house.fillH(); outtextxy(2, 110, (char*)"1) Original"); //draw translated house house.translate(200,0); house.drawH(); house.fillH(); outtextxy(200, 110, (char*)"2) Translated"); //draw scaled house house.translate(-190,70); house.scale(2,2); house.drawH(); house.fillH(); outtextxy(2, 280, (char*)"3) Scaled"); int x=90; int y=350; House h2; // draw reflected house h2.translate(200,70); h2.reflecty(x); h2.reflectx(y); h2.reflecty(x); h2.drawH(); h2.fillH2(); outtextxy(200, 270, (char*)"4) Reflected"); getch(); closegraph(); } //<!--NOTE--> //<!--MAKE CHANGES ACCORDING TO YOUR REQUIREMENTS--> //<!--DO NOT POST ON OTHER PORTALS THIS WILL LEAD TO COPYING OF CODE AND THEN YOU WILL GET ZERO MARKS FOR IT--> //<!--PLUS TYPE YOUR OWN SOLUTION FOR NOT LOSING MARKS--> //<!--DO NOT COPY PASTE--> //<!--WE ARE NOT RESPONSIBLE FOR GETTING ZERO MARKS IN ASSIGNMENT--> //PRE-PARED BY: SUPERSTARWEBTECH.COM //CONNECT WITH US:FACEBOOK.COM/SUPERSTARWEBTECH //E-MAIL: SUPERSTARWEBTECH@GMAIL.COM CS602_2_FALL_2019.txt Displaying CS602_2_FALL_2019.txt.
How to Build a $1,000/Month PAK VS BAN Live Live Cricket Streaming
File Sharing

1

Online

3.0k

Users

2.8k

Topics

8.2k

Posts
| |