1 / 24

Line and Character Attributes 2-D Transformation

Line and Character Attributes 2-D Transformation. Attributes: In general, any parameter that affects the way a primitive is to be displayed is referred to as an attribute parameter. Line Attributes: Basic attributes of a straight line segment are its type, its width, its color.

mmcginley
Download Presentation

Line and Character Attributes 2-D Transformation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Line and Character Attributes 2-D Transformation

  2. Attributes: • In general, any parameter that affects the way a primitive is to be displayed is referred to as an attribute parameter. Line Attributes: Basic attributes of a straight line segment are its type, its width, its color. • Line type: Possible selection of a line-type attribute include solid lines, Dashed Lines and Dotted Lines. • Line Width: The value of line width is used by line drawing algorithms to control the thickness of lines generated with subsequent output primitive commands. • Line Color: The value of line color basically gives the color of the line.

  3. Character Attributes: • The appearance of displayed characters is controlled by attributes such as font, Size, Color and Orientation. • Font: Character font will give the font using which the character will be displayed(Times New Roman, Arial and other etc) • Size: Size will give the size of the character in which the text or a character will be displayed. • Color: Gives the color of the text. • Orientation: will arrange character strings vertically or horizontally

  4. Anti aliasing: There are techniques that can greatly reduce aliasing artifacts and improve the appearance of images without increasing their resolution. These techniques are collectively referred to as anti-aliasing techniques. Pre-Filtering and Post filtering: These are the two types of general purpose anti aliasing techniques. The concept of filtering originates from the field of signal processing, where true intensity values are continuous signals that consist of elements of various frequencies. Constant intensity values that correspond to a uniform region are at the low end of the frequency range.\ Frequency values that change abruptly and correspond to sharp edge are at a high end of spectrum.

  5. Transformation: Fundamental to all the computer graphics system is the ability to simulate the manipulation of objects in space. This simulated spatial manipulation is referred to as transformation. There are two complementary points of view for describing object transformation. 1) The object itself is transformed relative to a stationary co-ordinate syatem or back ground.(Geometric transformation) 2) the object is held stationary while the co-ordinate system is transformed relative to the object.(Co-ordinate transformation)

  6. Various Geometric transformation • Translation • Scaling • Rotation • Shearing • Reflection

  7. Geometric Transformation: Translate Shear Rotate Scale

  8. P’(x’,y’) ty P(x,y) tx Translate Points Recall.. We can translate points in the (x, y) plane to new positions by adding translation amounts to the coordinates of the points. For each point P(x, y) to be moved by tx units parallel to the x axis and by ty units parallel to the y axis, to the new point P’(x’, y’ ). The translation has the following form: In matrix format: If we define the translation matrix , then we have P’ =P + T.

  9. P(x,y) y sy y P’(x’,y’) sx x x Scale Points Points can be scaled (stretched) by sx along the x axis and by sy along the y axis into the new points by the multiplications: We can specify how much bigger or smaller by means of a “scale factor” To double the size of an object we use a scale factor of 2, to half the size of an object we use a scale factor of 0.5 If we define , then we have P’ =SP

  10. Rotation: • A two dimensional Rotation is applied to an object by repositioning it along a circular path in the xy plan. • To generate a rotation we specify a rotation angle סּ and the position (xr,yr) of the rotation point about which the object is to be rotated. • Positive values to the rotation angle define counterclockwise rotation about the pivot point and negative values rotate object in clockwise direction.

  11. P’(x’,y’) P(x,y) y y’   O x’ x • We can express the transformed coordinates in terms of angles סּ and  as • X’=rcos( + סּ)=r coscosסּ - r sin sin סּ • Y’=rsin( + סּ)=r cos sinסּ + r sin cosסּ • The original coordinate of the point in polar coordinate are: • x=r cos  and y=r sin  • x’= x cosסּ -ysinסּ • y’= x sin סּ +y cosסּ

  12. P’=R.P Rotation of a point about any specified rotation position(xr,yr) • x’= xr+(x-xr) cosסּ - (y-yr)sin סּ • y’= yr+(x-xr) sin סּ + (y-yr)cosסּ Translate: P’ = P+T Scale: P’ = SP Rotate: P’ = RP P’ =R.P

  13. Matrix Representation and Homogeneous Co-ordinates • Many graphics application involve sequence of geometric transformations. An animation, for example might require an object to be translated and rotated at each increment of the motion. • P’=M1*P+M2 • Two express any two-dimensional transformation as a matrix multiplication we represent cartesian co-ordinate (x,y) with the homogeneous co-ordinate triple(xh,yh,h) • Expressing positions in homogeneous co-ordinates allows us to represent all the geometric transformation equations as matrix multiplications.

  14. Homogeneous Transformations Now, redefine the translation by using homogeneous coordinates: Similarly, we have: Scaling Rotation P’ = S  P P’ = R  P

  15. Composite Transformation: • We form composite transformations by multiplying matrices in order from right to left. • Translations: if two successive translation vectors(tx1,tx1) and (tx2,tx2) are applies to a co-ordinate position P, the final Transformed location p’ is calculated as • P’=T(tx2,ty2).T(tx1,ty1).p • T(tx2,tx2).T(tx1,ty1)=T(tx1+tx2,ty1+ty2) Which Proves two successive translation are additive. Rotation: Two successive rotation are additive Scaling two successive scaling are multiuplicative.

  16. General Fixed –Point Scaling • Above is the illustration of a transformation sequence to produce Scaling with respect to a selected fixed position (x,y) using Scaling function that can only Scale relative to the co-ordinate origin. • Translate object so that the fixed point Co-incides with the co-ordinate origin. • Scale the object with respect to the co-ordinate origin • Use the inverse Translation of step 1 to return the object to its original position.

  17. Inverse of transformation: Translation= -tx,-ty Scaling=1/sx,1/sy Rotation=- סּ

  18. Magnify a triangle with vertices A(0,0) B(1,1) and C(5,2) to twice its size while keeping C(5,2) as fixed. • Perform a 45 degree rotation of the same triangle About origin and about point(-1,-1). Cos 45 and sin 45(root(2)/2)

  19. Reflection: • A reflection is a transformation that produces a mirror image of an object. • The mirror image for a two-dimensional reflection is generated relative to an axis of reflection by rotating the object about the reflection axis. 1) Reflection about the y=0 , the x-axis is accomplished with the transformation matrix

  20. A Reflection about y-axis flips x-co-ordinates while keeping y-co-ordinate the same the matrix for this transformation is: • We flip both the x and y co-ordinates of a point by reflecting relative to an axis that is perpendicular to the xy plane and that passes through the co-ordinate origin. Transformation relative to the co-ordinate origin

  21. Reflection Axis as the diagonal line y=x

More Related