Chapter4Transformations概述.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
(2)Rotate:绕原点逆时针方向旋转θ角 P’ →P” (3)Translate:旋转中心由坐标原点→原来位置 图形P” →P’” P’” = P·T(-Vx, -Vy)·TR(θ)·T(Vx, Vy) 其中, (Vx, Vy)为旋转中心的坐标 T(-Vx, -Vy)·TR(θ)·T(Vx,V y)= 图形关于任意直线的对称变换 P0(x0, y0) P1(x1, y1) P(x, y) P P’ P’ θ P” P” P(3) θ P(4) P(3) 1)平移变换T(x, y)使对称轴l过原点;2)旋转变换TR(θ)使之与x轴重合;3) 对称变换T1,求图形关于x轴的对称图形;4)旋转变换TR(-θ) ;5)平移变换T(-x, -y)使对称轴l回原位置。 P0 P1 P P(5) P(4) P(5) = P·T(-x, -y)·TR(-θ)·T1·TR(θ)·T(x, y) , 其中, cosθ= a / c sinθ= b / c a = x1 - x0, b = y1 - y0 c2 = a2 + b2 例:程序4.1 先平移后旋转 Translate2D(1,0);//向右平移一个单位 Rotate2D(45); //旋转45度 House( );//显示变换结果 4.3 2D graphics display process 二维图形的显示流程 坐标系建立了图形与数之间的关系。 世界坐标系(用户坐标系:用户用来定义图形对象的整个自然空间。) 局部坐标系(相对坐标系:用户用来定义局部图形相对位置的的坐标系。) 屏幕坐标系(设备坐标系:在输出设备上定义的坐标系。) 窗口(用户在世界坐标系中选择一个矩形域来指定要表示的图形。) 视区(用户在屏幕坐标系上选择一个矩形区来表示窗口内的图形。) 二维图形的显示流程 世界坐标系内的变换 关于窗口的裁剪 窗口到视区的变换 扫描转换 显示 世界 坐标系 设备坐标系 屏幕坐标系 视口2 viewport2 世界坐标系 world coordinates 屏幕坐标系 Screen coordinates 窗口 world window1 窗口到视区变换 window to viewport 视口1 viewport1 4.4 the window to viewport transformation窗口到视区的变换 WXL WXR WYB WYT VXL VXR VYB VYT (xw, yw) (xv, yv) 变换公式 Transformation formula the window to viewport transformation 窗口到视口的变换 xv = a·xw + b yv = c·yw + d 式中:a = (VXR – VXL)/(WXR-WXL) b=VXL – WXL*(VXR – VXL)/(WXR – WXL) c=(VYT – VYB)/(WYT – WYB) d=VYB – WYB*(VYT – VYB)/(WYT – WYB) The constants A and B scale the x and y coordinates, and C and D shift (or translate) them。常数A和B缩放x,y坐标,C和D平移x,y。 The mapping can be used with any point (x, y) inside or outside the window. Points inside the window map to points inside the viewport, and points outside the window map to points outside the viewport. 该映射可以用于所有点,窗口内映射视口内,窗口外映射是口外。 Ex. Consider the window and viewport of Fig.The window has (W.l, W.r, W.b, W.t) = (0, 2.0, 0, 1.0) and the viewport has (V.l, V.r, V.b, V.t) = (40, 400, 60, 300). Using the formulas,we obtain A = 180, C = 40, B = 240, D = 60 The center of the window (1.0, 0.5) maps to the center of the viewport (220, 180 ). Thus, the window to viewport mapping is: sx =

文档评论(0)

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

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

1亿VIP精品文档

相关文档