Computer Graphics - 12

9. Suppose edge AB is an edge of the pruning window, P 0 P 1 ..... P N-1 is the list of vertices of the polygon to be pruned (convex convex polygon). According to Hogman's algorithm, P i-1 and P i are both on the right side of edge AB, then the vertex included in the list of polygons after pruning (VertexOutput) is:

[a]--P i-1

[b]--P i

[c]--Both P i-1 and P i

Maybe you are interested!

[d]--No peaks

10. Suppose edge AB is an edge of the pruning window, P 0 P 1 ..... P N-1 is the list of vertices of the polygon to be pruned (convex convex polygon). According to Hogman's algorithm, P i-1 is on the right and Pi is on the left of edge AB, then the vertex is included in the list of the polygon after pruning (VertexOutput) is:

Computer Graphics - 12

[a]--Intersection point I of Pi-1 P i with sides AB and P i [b]--Intersection point I and P i-1

[c]--Only intersection I [d]--Both P i-1 and P i

11. Suppose edge AB is an edge of the pruning window, P 0 P 1 ..... P N-1 is the list of vertices

of the polygon that needs to be trimmed (sunflower convex polygon). According to Hogman's algorithm, P i-1 is on the left and P i is on the right of side AB, then the vertex is included in the list of polygons after trimming (VertexOutput) is:

[a]--Both P i-1 and P i

[b]--Intersection point I of P i-1 P i with edge AB and P i [c]--Intersection point I of P i-1 P i with edge AB

[d]--No peaks

12. Given a rectangular pruning window with lower left corner L(3,1) and upper right corner R(7,4). Given segment IJ with coordinates I(8,2) and J(8,3), use the Lyangbarsky algorithm to calculate the values ​​of P 1 ,

P 2 , P 3 and P 4

[a]--P 1 =0, P 2 =0, P 3 = -1 and P 4 =1

[b]--P 1 = -1, P 2 = 1, P 3 = 0 and P 4 = 0 [c]--P 1 = 1, P 2 = - 1, P 3 = 0 and P 4 = 0 [d]--P 1 = 1, P 2 = - 1, P 3 = 1 and P 4 = -1

13. Which of the following sentences is incorrect? (according to Cohen Sutherland algorithm)

[a]--A line segment lies completely outside when it violates any one of the following four inequalities: X 1 .X 2 > X max ; X 1 .X 2 ‹ X min ; Y 1 .Y 2 > Y max ; Y 1 .Y 2 ‹ Y min ;

[b]--A line segment lies completely outside when it violates any one of the following four inequalities: X 1 .X 2 ≥ X max ; X 1 .X 2 ≤ X min ; Y 1 .Y 2 ≥ Y max ; Y 1 .Y 2 ≤ Y min ;

[c]--The line segment is displayed when both endpoints are in the display window

[d]--The line segment is displayed when: P 1 code or P 2 code =0000

14. LyangBarsky algorithm based on straight line equation: [a]--Unexplicit f(x,y) = 0

[b]--By him

[c]--Explicitly y=f(x)

[d]--Parameters x = x(t), y = y(t) have t Є [0,1]

15. Given a rectangular pruning window with lower left corner L(-2,-2) and upper right corner R(9,4). Given segment CD with coordinates C(1,-3) and D(6,5), use the Lyangbarsky algorithm to calculate the values ​​P 1 , P 2 , P 3 and P 4

[a]--P 1 = -1, P 2 = 1, P 3 = 7 and P 4 = -7

[b]--P 1 = -6, P 2 = 6, P 3 = 8 and P 4 = -8

[c]--P 1 = -2, P 2 = 2, P 3 = 5 and P 4 = -5 [d]--P 1 = -5, P 2 = - 5, P 3 = 8 and P 4 = -8

16. Based on the LyangBarsky algorithm, we want to calculate the new values ​​u 0 and u 1 as follows: [a]--


[b]--


[c]--


[d]--


17. In the LyangBarsky algorithm, to calculate the intermediate values ​​q 1 , q 2 , q 3 and q 4 as follows:

[a]--q 1 =x min - x 1 , q 2 =x 1 -x max , q 3 =y min - y 1 , q 4 =y 1 -y max . [b]--q 1 =x min - x 1 , q 2 =x max -x 1 , q 3 =y min - y 1 , q 4 =y max -y 1 .

[c]--q 1 =x min - x 1 , q 2 =x max -x 1 , q 3 =y 1 - y min , q 4 =y 1 -y max . [d]--All are wrong

18. Given a rectangular pruning window with lower left corner L(-3,1) and upper right corner R(2,6). Use Cohen Sutherland's algorithm to find the pruning items of MN with M(-4,2) and N(-1,3).

[a]--(-4,2) and (-1,2)

[b]--(2, 3) and (-1,3)

[c]--(-3, 7/3) and (-1,3)

[d]--(-3,5) and (-1,3)

19. Given a rectangular pruning window with lower left corner L(1,1) and upper right corner R(6,5). Use Cohen Sutherland's algorithm to find the pruning items of EF with E(2,2) and F(7,4).

[a]--(1,2) and (7,4)

[b]--(2, 2) and (6, 18/5)

[c]--(2, 3) and (-1,3)

[d]--(2, 2 ) and (1.18/5)

20. Normalized Devices coordinates:

[a]--An image that is displayed correctly on one device may not be displayed correctly on another device.

[b]--An image that displays correctly on one device will certainly display correctly on another device.

[c]--An image displayed on one device will produce the same image on another device

[d]--All are wrong

Exercise

1. Given a window with boundaries: x min = 10, y min = 47, x max = 76, y max = 165 and straight lines:

+ Line segment AB with point A(33, 210); point B(121, 187)

+ Line segment CD with point C(-56, 173); point D(142, 2)

+ Line segment EF with point E(76, 68); point F(19, 156)

Apply the Liang-Barsky algorithm to determine exactly which of the above line segments are displayed.

2. Given a window with boundaries: x min = 10, y min = 47, x max = 76, y max = 165 and a quadrilateral ABCD with points A(-33, 141); B(53, 145); C(45, 76); D(-25, 82). Apply the Hodgman algorithm to determine exactly which part of the quadrilateral ABCD is displayed.

3. Find the image of triangle ABC with coordinates A(20,60), B(10,5), C(60,5) in the mapping from the window with boundaries x wmin =y wmin = 20, x wmax =80, y vmax =60 to the viewport with boundaries x vmin =y vmin = 0, x vmax =y vmax =120

4. Given a window with the borders: x min = 40, y min = 40, x max = 180, y max = 100 and points A(93, 147); point B(121, 187); point C(77, 82); point D(136, 60); point E(93, - 20); point F(168, 160)

a. Apply the Liang-Barsky algorithm to determine exactly which part of the line segments AB, CD, EF is displayed.

b. Find the image of triangle AEF in the mapping from window to viewport with boundaries xvmin = 10, yvmin = 20, xvmax= 290, yvmax =200.

5. Given a window with the boundaries: xmin = 10, ymin = 20, xmax = 50, ymax = 80 and points A(-30, 116); point B(90, 8); point C(0, 0); point D(5, 75); point E(50, 40); point F(82, 64)

a. Apply the Cohen-Sutherland algorithm to determine exactly which part of the line segments AB, CD, EF is displayed.

b. Find the image of triangle ABC in the mapping from window to viewport with boundaries xvmin = 20, yvmin = 10, xvmax= 140, yvmax =130.

6. Given a window with boundaries: x min = 20, y min = 20, x max = 80, ymax = 50 and points A(-28, 92); point B(36, 92); point C(35, 16); point D(155, 4); point E(36, 36); point F(66, 41).

a. Apply the Midpoint Division algorithm to determine exactly which part of the line segments AB, CD, EF is displayed.

b. Find the image of triangle ABE in the mapping from window to viewport with boundaries xvmin = 20, yvmin = 10, xvmax= 140, yvmax =130.

7. Given a window with boundaries x min = 55, x max = 105, y min = 35, ymax =85, and triangle ABC with points A(27, 31); B(111, 112); C(200, 0).

a. Apply Hodgman algorithm to accurately determine the visible part of the triangle

ABC?

b. Find the image of triangle ABC in the mapping from window to viewport with

The boundaries x vmin = 0, y vmin = 10, x vmax = 100, y vmax = 110.

8. Given a window with boundaries x min = 30, x max =90, y min = 70, y max =130, and a quadrilateral ABCD with points A(30, 194); B(130, 34); C(90, 70); D(0, 0).

a. Apply Hodgman algorithm to accurately determine the visible part of triangle ABCD?

b. Find the image of quadrilateral ABCD in the mapping from window to viewport with boundaries xvmin = 30, yvmin = 70, xvmax= 90, yvmax = 130.

9. Given a window with borders x min = 18, x max =81, y min = 115, y max =147 and straight lines:

+ Line segment AB with point A(112, 190); point B(42, 39)

+ Line segment CD with point C(48, 123); point D(169, 117)

+ Line segment EF with point E(87, 67); point F(198, 48)

Apply the Liang-Barsky algorithm to determine exactly which of the above line segments are displayed.

10. Given a window with borders x min = 18, x max =100, y min = 81, y max =120 and straight lines:

+ Line segment AB with point A(6, 86); point B(72, 146)

+ Line segment CD with point C(86, 101); point D(181, 107)

+ Line segment EF with point E(35, 101); point F(72, 108)

Apply the Cohen - Sutherland algorithm to determine exactly which part of the above line segments is displayed.

11. Given a window with boundaries x min = 48, x max =133, y min = 64, y max =149, and a quadrilateral ABCD with points A(15, 107); B(103, 125); C(170, 82); D(0, 0).

a. Apply Hodgman algorithm to accurately determine the visible part of triangle ABCD?

b. Find the image of quadrilateral ABCD in the mapping from window to viewport with boundaries xvmin = 30, yvmin = 70, xvmax= 90, yvmax = 130.

Exercise instructions

1.

+ Trim line segment AB: we have:

p 1 = -88, q 1 = 23, p 2 = 88, q 2 = 43, p 3 = 23, q 3 = 163, p 4 = -23, q 4 = -45

u 1 = 1.956522, u 2 = 0.4886364

u 1 > u 2 so we can conclude that line segment AB lies outside the window.

+ Trim line segment CD: we have

p 1 = -198, q 1 = -66, p 2 = 198, q 2 = 132, p 3 = 171, q 3 = 126, p 4 = -171,

q4 = -8

u 1 = -66/-198, u 2 = 132/198

The line segment after CD is trimmed to C'D' with C'(10, 116); D'(76, 59)

+ Trim line segment EF: we have

p 1 = 57, q 1 = 66, p 2 = -57, q 2 = 0, p 3 = -88, q 3 = 21, p 4 = 88, q 4 = 97

u1 = 0, u2 = 1

The line segment is in the window.

2. Trim line segment AB with the left variable of the window with intersection point A'(10, 143), point A is outside, point B is inside, save points A' and B. Trim line segment BC with two points B, C both inside the window, save point C. Trim line segment CD with the left border with intersection point D'(10, 79), point C is inside, point D is outside, save point D. Trim line segment DA with two points A, D both outside, so do not save any points. Quadrilateral ABCD is trimmed to A'BCD'.

3. Trim line segment AB with the left border of the window having the intersection point (20, 60) coinciding with point A with point A inside the window, point B outside, keep point A. Trim line segment BC with the left border having the intersection point B'(20, 50) with point B outside, C inside, keep points B' and C. Trim CD with the window having A, C inside, keep point C, triangle ABC is trimmed to AB'C.

Calculate s x = 2 Calculate s y = 3

Mapping the window to the view, applying the formula we have A(20, 6) becomes A'(0, 120). B'(20, 50) becomes B''(0, 90). C(60, 50) becomes C'(89, 90).

4.

a.

+ Trim line segment AB:

p 1 = -28, q 1 = 53, p 2 = 28, q 2 = 87, p 3 = -40, q 3 = 107, p 4 = 40, q 4 = -47 u 1 = 0= 0/0, u 2 = -1.175= -47/40

Because u 1 > u 2 the line segment lies outside the window

+ Trim CD line segment

p 1 = -59, q 1 = 37, p 2 = 59, q 2 = 103, p 3 = 22, q 3 = 42, p 4 = -22, q 4 = 18 u 1 = 0= 0/0

u 2 = 1= 1/1

The line segment is in the window.

+ Trim line segment EF

p 1 = -75, q 1 = 53, p 2 = 75, q 2 = 87, p 3 = -180, q 3 = -60, p 4 = 180, q 4 = 120 u 1 = -60/-180, u 2 = 120/180

Straight line after trimming: E' (118, 40)

F' (143, 100)


b.

Trim line segment AE with window, AE becomes A'(93, 100) E'(93, 40)

Trim line segment AF with the window so that AF lies outside the window. Triangle AEF becomes A'HE'F'

Map point A'; H to viewport as A''(116, 200) H'(116, 20) Map point E'; F' to viewport as E''(166, 20) F''(216, 200)

5.

a. Line segment AB with point A has code 1001, point B has code 0110, trim AB with the left border of line segment AB into line segment A'B with A'(10, 80) has code 0000. Continue trimming line segment A'B with the right border to get intersection point B'(50, 44) has code 0000, finish trimming line segment AB into line segment A'B'. Trim line segment CD with point C has code 0101, point D has code 0001, these two points have the first code equal to 1 so they are both on the left side of the window, finish trimming. Trim line segment EF with point E has code 0000, point F has code 0010, trim with the right border to get point F' (50, 40) has code 0000 coinciding with point E, finish

b. Trim triangle ABC with the left border to get polygon A'BC' with point A'(10, 80), point C is below the window. Trim A'BC' with the top border of the polygon kept intact. Trim polygon A'BC' with the right border to get polygon A'B' D'C' with point B'(50, 44), D' is below the window. Trim A'B'D'C' with the bottom border to get polygon A'B'D''C‖, with D''(50, 20) C''(10, 20). Map point A' through the viewport to A''(20, 130). Map point B' through the viewport to B''(140, 58). Map point D'' through the viewport to D'''(140, 10). Map point B' through the viewport to B''(20, 10)

6.

a. Line segment AE has point A with code 1001, point E with code 0000, call A1 the midpoint of line segment AE with A1(4, 64) with code 1001, line segment AE is shortened to A1E. Call A2 the midpoint of A1E with A2(4, 50) with code 0000, line segment A1E is trimmed to A2E. Finish. Line segment CD has point C with code 0100, point D with code 0110, code(C) and code(D) ≠ 0000 so line segment CD is outside the window. Line segment EF has point E with code 0000, point F with code 0000, so line segment EF is completely inside the window

b. Trimming triangle ABE with the left border, we get quadrilateral A'B'BE with point A'(20,

50) B'(20, 92). Trim ABE with the upper boundary to get triangle A'CE with C(36, 50). Map point A' through the viewport to A''(20, 130). Map point C through the viewport to C'(53, 130). Map point E through the viewport to E'(52, 74)

7.

a. Trim triangle ABC with left border, triangle becomes quadrilateral A'BCD with A(55, 58) D is the point below the window. Trim quadrilateral A'BCD with upper border, polygon A'B'ECD with point B'(83, 85) point E is on the right side of the window. Trim polygon A'B'ECD with right border, polygon A'B'ECD into polygon A'B'E'C'D with E'(105, 85) C' below the window. Trim polygon A'B'E'C'D with lower border, polygon becomes A'B'E'C'D' with point D'(55, 35), C''(105, 35). Finish

b. Map point A' through the viewport to A''(0, 56), Map point B' through the viewport to B''(56, 110), Map point E' through the viewport to E''(100, 110), Map point D' through the viewport to D''(0, 10), Map point C'' through the viewport to C'''(100, 10)

8.

a. Trim the quadrilateral ABCD with the left border to become quadrilateral ABCD'; with point D' below the window. Trim the polygon with the upper border of the polygon to become pentagon A'BCD'E with points A'(70, 130), E (30, 130). Trim the polygon with the right border of the polygon to become A'B'CD'E with B'(90, 98). Trim the polygon with the lower border of the polygon to become A'B'CD''E with D''(30, 70)

b. Map point A' to A''(0, 56), Map point B' to B''(56, 110), Map point C to C'(100, 110), Map point D' to D''(100, 10), Map point E to E'(0, 10)

Comment


Agree Privacy Policy *