380 likes | 587 Views
????. ????Cohen-Sutherland???Nicholl-Lee-Nicholl?????????????-Barskey??,??????Sutherland-Hodgman???Weiler-Atherton??,?????. 3.1 ????? . ???????????,?????,????????????????????????????,?????????????????????????????Cohen-Sutherland??????????-barskey???. ?????????? . ?????:???????????????????????
E N D
1. ??? ?????? ??????????????????,???????????????????????????????????,?????????,?????????????????????????????????,????????????????,??????,?????????????????????????
2. ???? ????Cohen-Sutherland???Nicholl-Lee-Nicholl?????????????-Barskey??,??????Sutherland-Hodgman???Weiler-Atherton??,?????
3. 3.1 ????? ???????????,?????,????????????????????????????,????????????????????
?????????
Cohen-Sutherland?
??????
???-barskey???
4. ?????????? ?????:???????????????????????????
???????:
?????????????
????????
????: (1)??????----[xmin,xmax]X[ymin,ymax]
(2)?????----
???????????:(1)??????; (2)?????; (3)?????????????,???????.
5. ??
6. 3.1.1 ???????????
8. 3.1.2 ????Cohen-Sutherland???? ???????:??????P1P2?????????
(1)????P1P2??????,????????P1P2????????;
(2)???P1P2??????,??????,??????,???????;
(3)???????(1)???,????(2)???,???????????????????????,?????????????????
9. ????(P30) ????????????????????????,???????????????,??????????????????4???CtCbCrCl.???????????:
11. ???? ???????,???P1P2?????code1,code2?
(1)?code1=0,?code2=0,???P1P2????,????
(2)??????code1&code2?0,???????????????????????????????????,????
(3)??,?????????????????????,???????????,??????????,????????????????
???????,????????????????,???????????????0,???????????????
??:?????????????
12. Cohen-Sutherland???? #define LEFT 1
#define RIGHT 2
#define BOTTOM 4
#define TOP 8
int encode(float x,float y)
{ int c=0;
if(x<XL) c=LEFT;
if(x>XR) c=RIGHT;
if(y<YB) c=BOTTOM;
if(y<YT) c=TOP;
retrun c;
}
14. 3.1.3 ????????????(P31) ????????:?Cohen-Sutherland????,(1)?????????,????????????????( ???????????????)???(2)??????,????????(3)???????,???????????????????
?,?????????????????????,????????????????????,???????????,??????????????,?????????????????????????,??????????
15. ???????????? ?????????:
16. ?? ????:
?P0??????P0??????
?P1??????P1??????
??????????????,???????Cohen-Sutherland??????????????,???????????????????????????????????
???Pm=(P1+P2)/2?
17. ????? 1????????P1?P2???:C1?C2;
2???
??C1?C2????,???????:
(1)C1=C2=0,??????????,??????????,?????
(2)C1&C2?0(?????????????0),?C1?C2?????????1,??????????????????,??????????,?????
(3)?????????,???????
18. 3????
(1)??????P1,???????P1,?P1?P2????;
(2)??????P2?????;
(3)?P1???C1;
(4)?????????,????C;
(5)???????????:
?P1?P??,??P1?; If((C1&C)!=0) P1=P;
??,??P2?? else P2=P;
(6)???(3),??P1?P2???????:????P2,??????????P1,??????1?
20. 5.2 ?????(P31) ??????:?????
???????:???????????????????
??:
(1)???????????????????????
??????????????,???????????????????,???????
(2)????????????????
21. ??????
22. 5.2.1 ??????Sutherland-Hodgman?? ????:????????????????
(Step 1)????????????????????????????,(Step 2)????????????????????????
23. ?????
24. ???? ????????,????????????????????
???????????:
???????,??????;
????????????
???????????????S?P?????????????????
(1) S,P??????
(2) S,P???????
(3) S??,P???
(4) S???,P???
26. ??:???????????????????????,??????????????????,??????,?????????
????:
??????
?????(??)?????????????p1-pm?
?????(????)??????????????? q1-qn?
???????????????????,???????????????
?????????????,????????,???????
29. ????
30. 5.2.3 Weiler-Athenton?? Sutherland-Hodgeman???????????????????,????????????????(???????)????Weiler-Atherton???????????????????
34. Weiler-Atherton??????????? ?????????????????????????????????????,????????,?????????????????????,????,????????????????????,?????
????????????????,????,????????????????????;
???????,????????????????????
?????,?????????????????,??????????,???????????????????????
????????????,???????:??????????????,???????????????????????
35. Weiler-Atherton??????????? 1?????????????????????1??
2???????????????????2??
3?????????????????????,??????????????
??????????????????????,?????3?;
???????????????????????,????4?;
4????????Q,???Q????????3??????
???????,?????
5???????,??????S????
39. 5.3 ???? ????:????????????,???????,???????????
??????????:
???
????
??\????
?????:??????????????????????????????????,??????
??????:???????????????,?????????????????,??????
??\??????:???????????????,???????