CG_Pr Flashcards

1
Q

Flow of code 4 (chessboard)

A

1 ddaLine (4 var)
2 bresenham (4 var) - err,sx,sy,e2
3 seedfill (4 var)
4 main (gd, gm, xStart = 100, yStart = 100, sqaureSize = 50)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

Flow of code 12(tic tac toe)

A

1 5 -var (WIND_HEIGHT, WIND_WIDTH, board[][], currentplayer, gameover bool)
2 drawX function
3 drawO function (angle = 2pi*i/300)
4 drawBoard
5 display (drawBoard, X, O)
6 checkWinner (tie)
7 mouse (currplayer, result - gameover )
8 init (ortho2d = 0,600,600,0)
9 main

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Flow of the code 6 SuthHodgClip

A

1 struct point (float)
2 variables (2 vector, 3 bool, 2 Point)
3 void drawPolygon ( vector<Point>& poly, r, g, b)
4 void clipRect()
5 bool inside (Point p, edge, value)
6 Point intersect (Point p1, p2, edge value)
7 void suthHodg () - clippingpolygon = polygon, xmin,xman..., for(edge) input = cP, for(size_t i) bool curr = inside()
if (!curr, prev) {pushback intersect}
8 display()
9 mouse(button, state, x,y) - !polygoncomplete, !clippingIP and clippingIP, elseif !polygoncomplete
10 init
11 main</Point>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Flow of code 11 sunrise and sunset

A

1 variables sunY and isSunRising
2 void init
3 void drawCircle (xc, yc, r, num_seg) - TriangleFAN, theta = 2M_PIi/num_seg
4 display
5 timer (int value) - (+-=)0.01 timerFunc(50, timer, 0) postRedisplay()
6 main

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Flow of code 2 DDA Line color palette

A

1 struct Point
2 variables = currentcolor, vector vertices
3 setColor()
4 draw ddaLine()
5 void colorPalette() - palHeight, colorwidth, plotting (colorwidth*i, 0)
6 void display() - draw color palette, color3vf(currcolor) for size_t i…..drawddaLine(vertices[i])
7 mouse() - windowHeight, y, switch using colorindex= x/50, if y<=50, colorpalette, else Point p

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Flow of code 7

A

library graphics.h
1 struct Point{}
2 void drawPolygon(Point pts[]) - setcolor()
3 void translate()
4 void rotate() - angle_rad=ang_deg*M_PI/180.0;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Flow of code 10

A

1 var = flagY=-250f, bool hoisting
2 drawCircle(xc,yc,r)
3 drawFlag() - all three colors GL_QUADS
4 display()
5 timer - flagY+=2.0f, timerFunc(30, timer, 0)
6 init() - clearcolor, ortho(-300, 300, -300, 300)
7 int main() - windowSize(600,600)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly