2015春計(jì)算機(jī)圖形學(xué)空間信息04.2d geometric_第1頁
2015春計(jì)算機(jī)圖形學(xué)空間信息04.2d geometric_第2頁
2015春計(jì)算機(jī)圖形學(xué)空間信息04.2d geometric_第3頁
2015春計(jì)算機(jī)圖形學(xué)空間信息04.2d geometric_第4頁
2015春計(jì)算機(jī)圖形學(xué)空間信息04.2d geometric_第5頁
已閱讀5頁,還剩32頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院2D Geometric Transformations1中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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(齊次坐標(biāo))3中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院3x3 2D Translation Matrixuse 3x1 vectorNote: it es a matrix-vector multiplication6中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院Translation of ObjectsHow to translate an object with multiple vertices?Translate individualvertices 7中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院3x3 2D Rotation Matrix(x,y) (x,

6、y) qfr11中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院RotationHow to rotate an object with multiple vertices? Rotate individualVertices q12中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院3x3 2D Scaling Matrix14中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院Shearing(錯(cuò)切)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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院Arbitrary Rotatio

8、n Center(任意旋轉(zhuǎn)中心)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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院Two-dimensional composite transformation (6)Example of fixed-point scaling中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院Two-dimensional composite transformation (7)General two-dimensional scaling directionsPerform a rotate-scaling-rotate sequenceComposite matrix in coordinates form中國地質(zhì)大學(xué)

16、計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院Other two-dimensional transformation (4)Y-axis sh

18、ear with other reference line中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院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(坐標(biāo)系之間轉(zhuǎn)換)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中國地質(zhì)大學(xué)計(jì)算機(jī)學(xué)院Transformation between two-di

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論