《《计算机图形学教学资料》.ppt》由会员分享,可在线阅读,更多相关《《计算机图形学教学资料》.ppt(53页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、4.2 3D transformations nTranslate(平移)transformationsnScale(缩放)transformationsnShear(错切)transformations nRotate(旋转)transformationsnReflect(反射)transformationsnComposition(复合)of 3D transformationsn与二维平移变换类似地使用齐次坐标表示为:记为:其中Translate transformation记为:Scale transformationnAbout originCont.nAbout arbitrary
2、 pointThe arbitrary reference point is:Cont.nAbout arbitrary pointtranslate,scale about origin,inverse translatenConsists of:nThe arbitrary reference point is:Cont.则变换矩阵为:Shear transformationsnDependence axis(依赖轴):corresponding coordinate is remained nDirection axis(方向轴):corresponding coordinate is
3、changed linearly nRepresentations:n变换的一般表达式是:Shear transformationsnParameters:rotate axis,rotate anglen二维旋转变换是三维空间中绕Z轴的旋转记为:XYZRotate transformationRotate about X axisEqually with changing the coordinate system x,y,z to the coordinate system y,z,x.YZXXYZRotate about Y axisChanging system x,y,z to sy
4、stem z,x,yZXYXYZ?:about arbitrary linen是关于某直线或平面进行的n关于某个轴进行的反射变换等同于关于该轴做180度的旋转变换nFor instance:about Z axisReflect transformation(反射变换)?:about arbitrary symmetry axisCont.n当反射平面是坐标平面时,等同于进行左、右手坐标系的互换,相应变换矩阵是把第三维坐标值取反nFor instance:about XOY plane?About arbitrary symmetry planenFor instance:rotating a
5、bout arbitrary line Overlapping arbitrary line with Z axisnResolving a series of problems nReflect about an arbitrary symmetry linenReflect about an arbitrary symmetry plane Composition transformationsn旋转轴不与坐标轴重合时变换的实现:n经复合变换使旋转轴与某坐标轴重合n绕指定轴进行旋转变换n还原坐标系YZXP1P2Rotate about arbitrary line(1)translate
6、P1 to overlap origin不妨设P1P2为方向单位矢量,P2点坐标为(a,b,c)YZxP1P2YZxCont.XYZOP1P2XYZCont.Cont.P1P2XYZ(2)rotate about X axis to put the line on XOZXYZCont.(2)rotate about X axis to put the line on XOZXYZCont.(2)rotate about X axis to put the line on XOZXYZCont.(2)rotate about X axis to put the line on XOZXYZCo
7、nt.(2)rotate about X axis to put the line on XOZXYZCont.(2)rotate about X axis to put the line on XOZXYZCont.(2)rotate about X axis to put the line on XOZXYZCont.(2)rotate about X axis to put the line on XOZThen P2 is(a,0,d)Transformation matrix(变换矩阵)XYZCont.(3)Rotate about Y axis to overlap the lin
8、e with Z axisXYZCont.XYZ(4)Rotate about Z axis namely the line through Cont.XYZP1P2Cont.(4)recover the coordinate systemThe final transformation is:R()=T1-1Rx-1(-)Ry-1()Rz()Ry()Rx()T1Cont.n关于任意直线(或平面)的反射可以分解为平移、旋转(使得指定的反射直线或平面与某坐标轴或平面重合)和关于坐标直线(或坐标平面)的反射,再加恢复变换。Exercises out classroomExercise 4.11Gi
9、ven a unit cube with one corner at(0,0,0)and another opposite corner at(1,1,1),derive the transforations necessary to rotate the cube by degree about the main diagonal(对角线)(from(0,0,0)to(1,1,1)in the counterclockwise direction when looking along the diagonal toward the origin.Exercises out classroom
10、Exercise 4.14An object is to be scaled by a factor S in the direction whose direction cosines are(,).Derive the transformation matrix.Two methods of transformationnCoordinate system fixed,Graphics changednGraphics fixed,Coordinate system changed(1)坐标系不变,图形变换;(2)图形不变,坐标系变换.变换的两种实现方法:Transforming coor
11、dinate systemnTwo means:nDefine the new coordinate system directlynDefine a vector in y direction of the new coordinate systemCont.1.Define a new system:composition of transformations(x0,y0)(1)translate:T(-x0,-y0)(2)rotate:R(-)(3)scale(4)composition of above transformations(notice the sequence)Cont.
12、nThe matrix is:Cont.2.Define a vector in y direction of new system:Y axis is:(x0,y0)(x1,y1)X axis is:Transformation is:Contrast(x0,y0)(x0,y0)(x1,y1)VS.XYZXYZnTransform from an old coordinate system to another new coordinate systemnThe new system is shown in the right figure:Mode transformationCont.n
13、Composition of translation and rotation:当坐标系使用不同的缩放时,还需定义缩放补偿。4.3 window-to-viewport transformationnWorld Domain(用户域WD)n指程序员用来定义草图的整个自然空间.nWorld-coordinate system(用户坐标系WC).n世界坐标系n右手直角坐标系nWindow(窗口区W)n在用户坐标系(世界坐标系WC)中预先选定的将产生图形显示的区域称为窗口Related conceptsCont.nScreen Domain(屏幕域SD)n设备输出图形的最大区域,是有限的整数域.nV
14、iewport(视图区V)n在显示器坐标系中规定的显示图形的区域称为视(图)区.nScreen coordinates(屏幕坐标系)n(normalized)device coordinatesndevice coordinates:addressing by pixelsnNDC:-1,1-a,a窗口的取景器作用Window as a viewfinder利用窗口尺寸变化改变显示图形的大小 选窗口的视见变换选窗口的视见变换Cont.n视见变换将用户坐标系中窗口内的图形变换到显示器中的视见区中产生显示.Window-to-Viewport transformationwindowWxlWxrW
15、ybWytP(x,y)VxlVxrviewportVybVytP(x,y)Cont.Cont.transform matrix窗口WxlWxrWybWytWxlWxrWybWyt-VxlVxrVybVyt-VxlVxrvybVytCont.VxlVxrVybVytNDC-to-DC transformationnNDC:-1,1-a,anDC:0,M-10,N-1nConsidering its discrete feature:-0.5,M-1.5-0.5,N-1.5nThe same linear transformation as the W-to-V transformationnWhereas:Flow chart of 2D viewWC世界坐标系内的变换NDC规格化坐标系到设备坐标系的变换对窗口区进行裁剪WCDC设备输出二维图形显示流程窗口到视图区的规格化变换WC