2015春计算机图形学空间信息04.2d geometric_第1页
2015春计算机图形学空间信息04.2d geometric_第2页
2015春计算机图形学空间信息04.2d geometric_第3页
2015春计算机图形学空间信息04.2d geometric_第4页
2015春计算机图形学空间信息04.2d geometric_第5页
免费预览已结束,剩余32页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、中国地质大学计算机学院2D Geometric Transformations1中国地质大学计算机学院Introduction to TransformationsTransformation changes an objects:Position (translation)Size (scaling)Orientation (rotation)Shapes (shear)We will introduce first in 2D or (x,y), build intuitionLater, talk about 3D and 4D?Transform object by applying

2、sequence of matrix multiplications to object vertices2中国地质大学计算机学院Why Matrices?All transformations can be performed using matrix/vector multiplicationAllows pre-multiplication of all matricesNote: point (x,y) needs to be represented as (x,y,1), also called Homogeneous coordinates(齐次坐标)3中国地质大学计算机学院Poi

3、nt RepresentationWe use a column matrix (2x1 matrix) to represent a 2D pointGeneral form of transformation of a point (x,y) to (x,y) can be written as:or4中国地质大学计算机学院TranslationTo reposition a point along a straight lineGiven point (x,y) and translation distance (tx, ty)The new point: (x,y)x=x + txy=

4、y + ty(x,y)(x,y)orwhere5中国地质大学计算机学院3x3 2D Translation Matrixuse 3x1 vectorNote: it es a matrix-vector multiplication6中国地质大学计算机学院Translation of ObjectsHow to translate an object with multiple vertices?Translate individualvertices 7中国地质大学计算机学院2D RotationDefault rotation center is origin (0,0)q 0 : Rot

5、ate counter clockwise Rotate about the origin by q(x, y)How to compute (x, y) ?fx = r cos () y = r sin ()rx = r cos ( +) y = r sin ( +)9中国地质大学计算机学院Rotation(x,y) (x,y) qfrx = x cos(q) y sin(q) y = y cos(q) + x sin(q) Matrix form?3 x 3? Using trig identities10中国地质大学计算机学院3x3 2D Rotation Matrix(x,y) (x,

6、y) qfr11中国地质大学计算机学院RotationHow to rotate an object with multiple vertices? Rotate individualVertices q12中国地质大学计算机学院2D ScalingScale: Alter object size by scaling factor (sx, sy). i.ex = x . Sx y = y . Sy (1,1)(2,2)Sx = 2, Sy = 2 (2,2)(4,4)13中国地质大学计算机学院3x3 2D Scaling Matrix14中国地质大学计算机学院Shearing(错切)Y c

7、oordinates are unaffected, but x cordinates are translated linearly with yThat is:y = y x = x + y * h h is fraction of y to be added to x15Inverse transformations(逆变换)Inverse translation matrixTwo-Dimensional translation matrixTwo-Dimensional translation matrix中国地质大学计算机学院中国地质大学计算机学院Arbitrary Rotatio

8、n Center(任意旋转中心)To rotate about arbitrary point P = (Px, Py) by :Translate object by T(-Px, -Py) so that P coincides with originRotate the object by R()Translate object back: T(Px, Py)In matrix form: T(Px,Py) R() T(-Px,-Py) * PSimilar for arbitrary scaling anchor, 17中国地质大学计算机学院Composing Transformati

9、onComposing transformation applying several transforms in succession to form one overall transformationExample:M1 X M2 X M3 X Pwhere M1, M2, M3 are transform matrices applied to PBe careful with the orderFor example:Translate by (5,0) then rotate 60 degrees is NOT same asRotate by 60 degrees then tr

10、anslate by (5,0)18Matrix Concatenation PropertiesAssociative propertiesTransformation is not commutative (CopyCD!)Order of transformation may affect transformation position中国地质大学计算机学院19Two-dimensional composite transformation (1)Composite transformationA sequence of transformationsCalculate composit

11、e transformation matrix rather than applying individual transformationsComposite two-dimensional translationsApply two successive translations, T1 and T2Composite transformation matrix in coordinate form中国地质大学计算机学院Two-dimensional composite transformation (2)Composite two-dimensional rotationsTwo suc

12、cessive rotations, R1 and R2 into a point PMultiply two rotation matrices to get composite transformation matrixComposite two-dimensional scaling中国地质大学计算机学院Two-dimensional composite transformation (3)General two-dimensional Pivot-point rotationGraphics package provide only origin rotationPerform a t

13、ranslate-rotate-translate sequenceTranslate the object to move pivot-point position to originRotate the objectTranslate the object back to the original positionComposite matrix in coordinates form中国地质大学计算机学院中国地质大学计算机学院Two-dimensional composite transformation (4)Example of pivot-point rotationTwo-dim

14、ensional composite transformation (5)General two-dimensional Fixed-point scalingPerform a translate-scaling-translate sequenceTranslate the object to move fixed-point position to originRotate the objectUse inverse of translation in step 1 to return the object back to the original positionComposite m

15、atrix in coordinates form中国地质大学计算机学院Two-dimensional composite transformation (6)Example of fixed-point scaling中国地质大学计算机学院中国地质大学计算机学院Two-dimensional composite transformation (7)General two-dimensional scaling directionsPerform a rotate-scaling-rotate sequenceComposite matrix in coordinates form中国地质大学

16、计算机学院Other two-dimensional transformation (1)Reflectionimage generated relative to an axis of reflectionReflection about the x-axisReflection about the y-axisReflection about the z-axis中国地质大学计算机学院Other two-dimensional transformation (2)Reflection with axis y=x (diagonal)Other two-dimensional transfo

17、rmation (3)ShearDistorts the shape of an objectShape appears as if the object were composed of internal layers that had been caused to slide over each otherX-axis shear, where shx is the shear parameterX-axis shear with other reference line中国地质大学计算机学院Other two-dimensional transformation (4)Y-axis sh

18、ear with other reference line中国地质大学计算机学院A unit square (a) is turned into a shifted parallelogram (b) with parameter values shy = 0.5 and xref = 1 in the y -direction shearing transformation Transformation between two-dimensional coordinate systemsCoordinate transfer from one reference frame to anoth

19、er(坐标系之间转换)StepsTranslate so that origin (x0,y0) of the xy system is moved to the origin of (0,0) of the xy systemRotate the x axis onto the x axisExample: Reference a Cartesian xy system specified with coordinate origin (x0,y0) and orientation angle in Cartesian xy systemMatrix transformation of the translation and rotationComposite matrix of the transformation中国地质大学计算机学院Transformation between two-di

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论