
MODULE 2 TRANSFORMATIO N OF POINTS & KTUNOTES.INLINES Presented by, VINEETH.V Asst. Professor CCET Downloaded from Ktunotes.in CAD- SYLABUS MODULE-2 KTUNOTES.IN Downloaded from Ktunotes.in CO-ORDINATE TRANSFORMATION KTUNOTES.IN Downloaded from Ktunotes.in CO-ORDINATE TRANSFORMATION • It means changing of an image from current position (state) to a new position (state) by applying certain rules. Current position (state) New position (state) KTUNOTES.IN • Geometric transformation are the transformations or changes in size, shape, location etc are accomplished by altering the coordinate descriptions of an object. Downloaded from Ktunotes.in CO-ORDINATE TRANSFORMATION Types of transformations are: 1. 2D Transformations 2. 3D transformations Basic Geometric transformations are: 3. Translation/KTUNOTES.IN Move 4. Scaling 5. Rotation 6. Mirroring/ Reflection/ Flip 7. Shearing Downloaded from Ktunotes.in 2D TRANSFORMATIONKTUNOTES.IN Downloaded from Ktunotes.in 2D TRANSFORMATION • When transformation of coordinates takesplace on 2D plane or XY plane, it is called as 2D transformation. KTUNOTES.IN (x2,y2 ) line (x1,y1 ) Downloaded from Ktunotes.in 2D TRANSFORMATION Basic 2D Geometric transformations are: 1. 2D Translation/ Move 2. 2D ScalingKTUNOTES.IN 3. 2D Rotation 4. 2D Mirroring/ Reflection/ Flip 5. 2D Shearing Downloaded from Ktunotes.in 1. 2D Translation/ Move/Shift • It is the repositioning or shifting an object along a straight-line path (translation distances- tx, ty ) from one coordinate location to another without deformation.KTUNOTES.IN (x’,y’) • Also called as shift/move/transaltion. (tx,ty) (x,y) Downloaded from Ktunotes.in 2D Translation/ Move • We translate a 2D point by adding a translation distance tx and ty , to the orginal coordiante position (x,y) to move the point to a new position (x’,y’) New position ofKTUNOTES.IN x, x’ = x + tx New position of y, y’ = y + ty Where, tx and ty are translation vector or shift vector Downloaded from Ktunotes.in 2D Translation/ Move KTUNOTES.IN Downloaded from Ktunotes.in 2D Translations in Homogenised coordinates • Transformation matrices for 2D translation in 3x3 column matrix: KTUNOTES.IN x 1 0 tx x x x tx y 0 1 t . y y y t y y 1 0 0 1 1 1 1 [P’] =[T] + [P] Downloaded from Ktunotes.in 2. 2D Scaling • It alters the size of an object (either reduced or enlarged size) Sx KTUNOTES.IN y S y xf, y f x Downloaded from Ktunotes.in 2D Scaling • It is transformed by multiplying the current coordinate values (x,y) of each vertex by Scaling factors sx & sy to produce the new transformed coordinates (x’,y’) KTUNOTES.IN New position of x, x’ = x . Sx New position of y, y’ = y . Sy Where, sx & sy are scaling factors Downloaded from Ktunotes.in 2D Scaling- Scale factor [S] Scale factor [S] value has only positive values : • Value less than 1 (<1) Reduce the size of object • Value greaterKTUNOTES.IN than 1 (>1) Enlarge the size of object • Same value (=1) Uniform scaling • Unequal value (≠1) Differential scalingDownloaded from Ktunotes.in 2D Scaling • In matrix form, x sx 0 0 x x x.sx y 0 s 0 . y y y y.s KTUNOTES.IN y 1 0 0 1 1 [P’] =[S] . [P] Downloaded from Ktunotes.in 3. 2D Rotation • It is the repositioning of an object along a circular path in the xy plane. y y KTUNOTES.IN x, y x, y y r x xr, y r x xr Downloaded from Ktunotes.in 2D Rotation • To generate a rotation, we specify a rotation angle θ and the position of the rotation point (pivot point) about which the object is to be rotated. • Positive valueKTUNOTES.IN for θ counter clockwise rotation • Negative value for θ clockwise rotation Downloaded from Ktunotes.in 2D Rotation From the figure , ---we have to find the new position (x’ , y’) KTUNOTES.IN Downloaded from Ktunotes.in 2D Rotation Considering a triangle OAP’ Cos (θ + Φ ) = x’ / OP’ x’ = OP’ . Cos (θ + Φ) = OP’ (Cosθ. CosΦ – Sinθ. SinΦ)KTUNOTES.IN Similarly Sin(θ + Φ ) = y’ / OP’ y’ = OP’ . Sin (θ + Φ) = OP’ (Sinθ. CosΦ + Cosθ.Downloaded SinΦ) from Ktunotes.in 2D Rotation Considering a triangle OAP CosΦ = x / OP x = OP . CosΦ Similarly KTUNOTES.IN SinΦ = y / OP y = OP .SinΦ we know OP = OP’ So, x’ = xCosθ – ySinθ y’ = xSinθ + yCosθ Downloaded from Ktunotes.in 2D Rotation • In matrix form, [P’] = [R(θ)]KTUNOTES.IN . [P] ie… x’ = xCosθ – ySinθ y’ = xSinθ + yCosθ Where, R(θ) = Rotation transformation operator Downloaded from Ktunotes.in 4. 2D REFLECTION/ FLIP/MIRRORING KTUNOTES.IN Downloaded from Ktunotes.in KTUNOTES.IN Downloaded from Ktunotes.in KTUNOTES.IN Downloaded from Ktunotes.in 5. 2D SHEARING • Shearing transformation is the transformation which alters the shape of an object. • Deformation of shape of object takesplaceKTUNOTES.IN in x and y direction Downloaded from Ktunotes.in KTUNOTES.IN Downloaded from Ktunotes.in KTUNOTES.IN Downloaded from Ktunotes.in KTUNOTES.IN Downloaded from Ktunotes.in Various 2D TRANSFORMATIONs KTUNOTES.IN Downloaded from Ktunotes.in x 1 0 t x x 2D y0 1 ty y , PTP t x, t y Translation 1 0 0 1 1 x cos sin 0 x 2D y sin cos 0 y , PRP Rotation 1 0 0 1 1 KTUNOTES.IN x Sx 0 0 x 2D y0 Sy 0 y , PSP S x, S y Scaling 1 0 0 1 1 April 2010 31 Downloaded from Ktunotes.in KTUNOTES.IN Downloaded from Ktunotes.in 3D TRANSFORMATIONKTUNOTES.IN Downloaded from Ktunotes.in 3D TRANSFORMATION • When transformation of coordinates takesplace on 3D plane or XYZ plane, it is called as 3D transformation. KTUNOTES.IN (x2,y2,Z2 ) line (x1,y1,Z1 ) Downloaded from Ktunotes.in 3D TRANSFORMATION Basic 3D Geometric transformations are: 1. 3D Translation/ Move 2. 3D ScalingKTUNOTES.IN 3. 3D Rotation 4. 3D Mirroring/ Reflection/ Flip 5. 3D Shearing Downloaded from Ktunotes.in 1. 3D Translation . •Moving of object in x,y,z direction as translation vector tx,ty,tz respectively x x t y x y y ty z z tz KTUNOTES.INx,, y z x 1 0 0 t x x x,, y z y 0 1 0 t y y z 0 0 1 t z z z x 1 0 0 0 1 1 April 2010 36 Downloaded from Ktunotes.in KTUNOTES.IN Downloaded from Ktunotes.in 2. 3D Scaling y y x x Sx y y S y z x Sz z x z x Enlarging object alsoKTUNOTES.IN moves it from origin x Sx 0 0 0 x y 0 S 0 0 y PSP y z 0 0 Sz 0 z 1 0 0 0 1 1 April 2010 38 Downloaded from Ktunotes.in Scaling •Changing size of object in x,y,z direction as scaling vector sx,sy,sz respectively x’=sxx y’=syy z’=szz p’=Sp KTUNOTES.IN sx 0 0 0 0 sy 0 0 S = S(sx, sy, sz) = 0 0 sz 0 0 0 0 1 Angel: Interactive Computer 39 Graphics 3E © Addison-Wesley Downloaded from Ktunotes.in2002 3. 3D Rotation • ROTATION at x,y,z direction at rotating angle about a fixed pivot point. • Need to specify which axis the rotation is about. Rotation about z-axis KTUNOTES.IN cos sin 0 0 sin cos 0 0 R ( ) z 0 0 1 0 0 0 0 1 02/10/09 Lecture 4 40 Downloaded from Ktunotes.in Rotating About the x- axis Rx() x 1 0 0 0 x KTUNOTES.IN y 0 cosθ sin θ 0 y z 0 sin θ cosθ 0 z 1 0 0 0 1 1 02/10/09 Lecture 4 41 Downloaded from Ktunotes.in KTUNOTES.IN Downloaded from Ktunotes.in Rotating About the y- axis Ry() x cosθ 0 sin θ 0 x KTUNOTES.IN y 0 1 0 0 y z sin θ 0 cosθ 0 z 1 0 0 0 1 1 02/10/09 Lecture 4 43 Downloaded from Ktunotes.in KTUNOTES.IN Downloaded from Ktunotes.in Rotation About the z- axis Rz() x cosθ sin θ 0 0 x KTUNOTES.IN y sin θ cosθ 0 0 y z 0 0 1 0 z 1 0 0 0 1 1 02/10/09 Lecture 4 45 Downloaded from Ktunotes.in Rotation in 3D • For rotation about the x and y axes: 1 0 0 0 cos 0 sin 0 0 cos KTUNOTES.INsin 0 0 1 0 0 R ( ) , R ( ) x 0 sin cos 0 y sin 0 cos 0 0 0 0 1 0 0 0 1 02/10/09 Lecture 4 46 Downloaded from Ktunotes.in Rotating About An Arbitrary Point • What happens when you apply a rotation transformation to an object that is not at the origin? • Solution: – TranslateKTUNOTES.IN the center of rotation to the origin – Rotate the object – Translate back to the original location Downloaded from Ktunotes.in Rotating About An Arbitrary y Point y x x y y KTUNOTES.IN x x Downloaded from Ktunotes.in Rotation about x and y axes • Same argument as for rotation about z axis – For rotation about x axis, x is unchanged – For rotation about y axis, y is unchanged 1 0 0 0 0 cos - sin 0 R = R ( ) = 0 sin cos 0 x KTUNOTES.IN 0 0 0 1 cos 0 sin 0 0 1 0 0 R = R () = y - sin 0 cos 0 0 0 0 1 Angel: Interactive Computer 49 Graphics 3E © Addison-Wesley Downloaded from Ktunotes.in2002 4. 3D Reflection • Mirroring of object along x, y or z axis sx = -1 sy = 1 original KTUNOTES.IN sx = -1 sy = -1 sx = 1 sy = -1 Angel: Interactive Computer 50 Graphics 3E © Addison-Wesley Downloaded from Ktunotes.in2002 3D Reflection KTUNOTES.IN Downloaded from Ktunotes.in KTUNOTES.IN Downloaded from Ktunotes.in KTUNOTES.IN Downloaded from Ktunotes.in 5.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages104 Page
-
File Size-