《计算机图形学3D变换》由会员分享,可在线阅读,更多相关《计算机图形学3D变换(42页珍藏版)》请在金锄头文库上搜索。
1、4.3 3D transformations nTranslate(平移) transformationsnRotate(旋转) transformationsnScale(缩放) transformationsnReflect(反射) transformationsnShear(错切) transformationsnComposition(复合) of 2D transformationsn与二维平移变换类似地使用齐次坐标表示 为:记为:其中Translate transformationTranslate transformationRemarked:Whereas:nTranslate
2、 记为:Scale transformationnAbout originCont.nAbout arbitrary pointThe arbitrary reference point is :Consists of:translate, scale about origin, inverse translateCont.则变换矩阵为:nAbout arbitrary pointtranslate, scale about origin, inverse translatenConsists of:nThe arbitrary reference point is :Cont.nAbout
3、arbitrary pointtranslate, scale about origin, inverse translatenConsists of:nThe arbitrary reference point is :Cont.则变换矩阵为:nParameters: rotate axis, rotate anglen二维旋转变换是三维空间中绕Z轴的旋转记为:XYZRotate transformationRotate about X axisEqually with changing the coordinate system x,y,z to the coordinate system
4、 y,z,x. YZXXYZRotate about Y axisChanging system x,y,z to system z,x,yZXYXYZ?:about arbitrary linen是关于某直线或平面进行的n关于某个轴进行的反射变换等同于关于该轴 做180度的旋转变换nFor instance: about Z axisReflect transformation?:about arbitrary symmetry axisCont.n当反射平面是坐标平面时,等同于进行左、右手坐标系的互换,相应变换矩阵是把第三维坐标值取反nFor instance: about XOY pla
5、ne?About arbitrary symmetry planeCont.n关于任意直线(或平面)的反射可以分解为平移、旋转(使得指定的反射直线或平面与某坐标轴或平面重合)和关于坐标直线(或平面)的反射。Shear transformationsnDependence axis: corresponding coordinate is remained nDirection axis: corresponding coordinate is changed linearly nRepresentations:Cont. Representationn变换的一般表达式是:nFor instan
6、ce: rotating about 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 l
7、ine(1)translate 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
8、 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 XOZXYZCont.(2)rotate about X axis to put the line on XOZThen P2 is (a,0,d)Transformation matrixXYZCont.(3) Rotate about Y axisto overlap
9、the line with Z axisXYZCont.YXZ(4) Rotate about Z axis namely the line through Cont.XYZP1P2Cont.(4)recover the coordinate systemThe final transformation is:R()=T1-1R x(-)Ry()R z()Ry(-)Rx()T1Two methods of transformationnCoordinate system fixed, Graphics changednGraphics fixed, Coordinate system chan
10、gednnew coordinate system is saw as a graphics and transformed to overlap with the original coordinate systemTransforming coordinate systemnTwo means:nDefine the new coordinate system directlynDefine a vector in y direction of the new coordinate systemCont.Define a new system: composition of transfo
11、rmations(x0,y0)(1)translate: T(-x0,-y0)(2)rotate:R(-)(3)scale(4)composition of above transformations (notice the sequence)Cont.nThe matrix is:Cont.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.nComposition of translation and rotation:当坐标系使用不同的缩放时,还需定义缩放补偿 。Exercises out classroomnExercise 4.11nExercise 4.14