Lecture05-Clipping 计算机图形学ppt课件.ppt

  1. 1、本文档共82页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Lecture05-Clipping 计算机图形学ppt课件

Cohen-Sutherland Line Clipping Algorithm: if (code0 == code1 == 0000) accept the line if ((code0 code1 ) != 0) reject the line Clip the line against an edge (where both bits are nonzero) Assign the new vertex a 4-bit value Return to 1 Recursive Subdivision Clipping Recursive Subdivision Clipping Recursive Subdivision Level 1 Recursive Subdivision Level 2 Recursive Subdivision Level 3 Recursive Subdivision Level 3 Recursive Subdivision Level 3 Recursive Subdivision Level 3 Recursive Subdivision Level 3 Recursive Subdivision Clipping Accurate to 3 Binary Digits Liang-Barsky Line Clipping Consider the parametric definition of a line: x = x1 + u?x y = y1 + u?y ?x = (x2 - x1), ?y = (y2 - y1), 0 ≤ (u, v) ≤ 1 What if we could find the range for u and v in which both x and y are inside the viewport? Liang-Barsky Line Clipping Mathematically, this means xmin ≤ x1 + u?x ≤ xmax ymin ≤ y1 + u?y ≤ ymax Rearranging, we get -u?x ≤ (x1 - xmin) u?x ≤ (xmax - x1) -v?y ≤ (y1 - ymin) v?y ≤ (ymax - y1) In general: u * pk ≤ qk Liang-Barsky Line Clipping Cases: pk = 0 Line is parallel to boundaries If for the same k, qk 0, reject Else, accept pk 0 Line starts outside this boundary rk = qk / pk u1 = max(0, rk, u1) Cases: (cont’d) 3. pk 0 Line starts outside this boundary rk = qk / pk u2 = min(1, rk, u2) 4. If u1 u2, the line is completely outside Liang-Barsky Line Clipping Also extends to 3D Just add equations for z = z1 + u?z 2 more p’s and q’s Liang-Barsky Line Clipping In most cases, Liang-Barsky is slightly more efficient According to the Hearn-Baker textbook Avoids multiple shortenings of line segments However, Cohen-Sutherland is much easier to understand (I think) An important issue if you’re actually implementing Weiler-Atherton Polygon Clipping When using Sutherland-Hodgeman, concavities can end up linked A different clipping algorithm, the Weiler-Atherton algorithm, creates separate polygons Weiler-Atherton Clipping Gives “Right” Answer Weiler

文档评论(0)

qiwqpu54 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档