Senin, 04 Juni 2018

Sponsored Links

08240 2D Computer Graphics - Lab 3 Walkthrough - YouTube
src: i.ytimg.com

Computer graphics 2D is a computer-based digital image - mostly from two-dimensional models (such as 2D geometric models, text, and digital images) and with specific techniques for it. The word may represent a branch of computer science consisting of such techniques, or for the model itself.

2D computer graphics are primarily used in applications originally developed in traditional print and image technologies, such as typography, cartography, engineering drawings, advertisements, etc. In the application, two-dimensional images are not just representations of world objects, but independent artifacts with semantic values ​​are added; Therefore, two-dimensional models are preferred, because they provide direct control over images rather than 3D computer graphics (the approach is more like photography than typography).

In many domains, such as desktop publishing, engineering, and business, document descriptions based on 2D computer graphics techniques can be much smaller than corresponding digital images - often with a factor of 1/1000 or more. This representation is also more flexible as it can be given at different resolutions to match different output devices. For this reason, documents and illustrations are often stored or sent as 2D graphics files.

2D computer graphics began in the 1950s, based on vector graphics devices. These are largely replaced by raster-based devices in the next few decades. The PostScript language and the X Window System protocol are important developments in the field.


Video 2D computer graphics



teknik grafik 2D

The 2D graphics model can incorporate geometric models (also called vector graphics), digital images (also called raster graphics), text to be set (determined by content, style and font size, color, position, and orientation), mathematical functions and equations , and much more. These components can be modified and manipulated by two-dimensional geometric transformations such as translation, rotation, scaling. In object-oriented graphics, images are depicted indirectly by objects that are endowed with self-rendering methods - a procedure that gives color to the image pixels by arbitrary algorithms. Complex models can be built by combining simpler objects, in the object-oriented programming paradigm.

In Euclidean geometry, a translation moves each point of a constant distance in a given direction. Translation can be described as rigid movements: other rigid movements including rotation and reflection. Translation can also be interpreted as adding a constant vector to each point, or as a shift in the origin of the coordinate system. Translation operator is operator                        T                                      ?                                            {\ displaystyle T _ {\ mathbf {\ delta}}}   so                        T                                      ?                                       f        (                   v                )         =          f        (                   v                                    ?                )         .           < {\ displaystyle T _ {\ mathbf {\ delta}} f (\ mathbf {v}) = f (\ mathbf {v} \ mathbf {\ delta }).}  Â

If v is a permanent vector, the translation T v sub> v ( p ) = p v .

If T is a translation, the images from a subset of A under the function T /i> by T . The translations of A by T v b>.

In Euclidean space, any translation is isometric. The groups of all translations form a translation group T , which are isomorphic to the space itself, and the normal subgroup of the Euclidean group E ( n ). The intelligence group E ( n ) by T isomorphic for the orthogonal group O ):

E ( n ) /T ? O ( n ).

Maps 2D computer graphics



Translation

Since translation is an affine transformation but not a linear transformation, homogeneous coordinates are usually used to represent translation operators by matrices and thus make them linear. So we write a 3-dimensional vector w = ( w x , w < sub> y z ) uses 4 homogeneous coordinates as w = ( w x , w y , w z , 1).

Untuk menerjemahkan objek oleh vektor v , setiap vektor homogen p (ditulis dalam koordinat homogen) perlu dikalikan dengan matriks terjemahan ini :

                                   T                                        v                                           =                                  [                                                                 1                                                      0                                                      0                                                                           v                                             x                                                                                                                            0                                                      1                                                      0                                                                           v                                             y                                                                                                                            0                                                      0                                                      1                                                                           v                                             z                                                                                                                            0                                                      0                                                      0                                                      1                                                          ]                                      {\ displaystyle T _ {\ mathbf {v}} = {\ begin {bmatrix} 1 & amp; 0 & amp; 0 & amp; v_ {x} \\ 0 & amp; 1 & amp; 0 & amp; v_ { y} \\ 0 & amp; 0 & amp; 1 & amp; v_ {z} \\ 0 & amp; 0 & amp; 0 & amp; 1 \ end {bmatrix}}}   

Kebalikan dari matriks terjemahan dapat diperoleh dengan membalik arah vektor:

                              T                                   v                                             -            1                         =                   T                       -                         v                                     .                     {\ displaystyle T _ {\ mathbf {v}} ^ {- 1} = T _ {\ mathbf {v}}. \!}  Â

Demikian pula, produk matriks terjemahan diberikan dengan menambahkan vektor:

                              T                                   u                                                T                                   v                                     =                   T                                   u                                              v                                     .                     {\ displaystyle T _ {\ mathbf {u}} T {{mathbf {v}} = T _ {\ mathbf {u} \ mathbf {v }}. \!}  Â

Since the addition of a vector is commutative, the matrix translation multiplication is also commutative (unlike arbitrary matrix multiplication).

What is
src: www.rotoscopers.com


Rotation

Dalam aljabar linier, matriks rotasi adalah matriks yang digunakan untuk melakukan rotasi dalam ruang Euclidean.

                      R        =                              [                                                               cos                                  ?                                                  -                  without                                  ?                                                                              without                                  ?                                                     cos                                  ?                                                     ]                               {\ displaystyle R = {\ begin {bmatrix} \ cos \ theta & amp; - \ sin \ theta \\\ sin \ theta & amp; \ cos \ theta \\\ end {bmatrix}}}  Â

rotate the point in xy -Cartesian plane counterclockwise through angle ? about the origin of Cartesian coordinate system. To rotate using the rotation matrix R , the position of each point must be represented by the column vector v , which contains the point coordinates. A rotated vector is obtained by multiplying the R v matrix. Since matrix multiplication has no effect on the zero vector (ie, in the original coordinates), the rotational matrix can only be used to describe the rotation of the origin of the coordinate system.

The rotation matrix provides a simple algebraic description of the rotation, and is used extensively for calculations in geometry, physics, and computer graphics. In a 2-dimensional space, the rotation can be easily explained by the angle ? of the rotation, but can also be represented by 4 entries of the rotation matrix with 2 rows and 2 columns. In 3-dimensional space, each rotation can be interpreted as a rotation by a certain angle about a single fixed rotation axis (see Euler's rotation theorem), and hence can be easily explained by angles and vectors with 3 entries. However, it can also be represented by 9 entries of a rotation matrix with 3 rows and 3 columns. Rotation notion is not commonly used in dimensions higher than 3; there is an idea of ​​ rotational displacement , which can be represented by a matrix, but no corresponding single axis or angle.

Matriks rotasi adalah matriks kuadrat, dengan entri nyata. Lebih khusus mereka dapat dicirikan sebagai matriks ortogonal denies determining 1:

                              R                      T                        =                   R                       -            1                        ,        det           R        =        1                     {\ displaystyle R ^ {T} = R ^ {- 1}, \ det R = 1 \,}   .

The set of all of these size matrices n forms a group, known as a special orthogonal group SO ( n ) .

Computer Graphics- 2D Transformations- I - YouTube
src: i.ytimg.com


In two dimensions

Dalam second dimension, setiap matriks rotasi memiliki bentuk berikut:

                      R        (        ?        )        =                              [                                                               cos                                  ?                                                  -                  without                                  ?                                                                              without                                  ?                                                     cos                                  ?                                                     ]                               {\ displaystyle R (\ theta) = {\ begin {bmatrix} \ cos \ theta & amp; - \ sin \ theta \\\ sin \ theta & amp; \ cos \ theta \\\ end {bmatrix}}}   .

Ini memutar vektor kolom dengan menggunakan perkalian matriks berikut:

                                         [                                                                                x                     ?                                                                                                                    and                     ?                                                                      ]                          =                              [                                                               cos                                  ?                                                  -                  without                                  ?                                                                              without                                  ?                                                     cos                                  ?                                                     ]                                                [                                                             x                                                                                and                                                     ]                               {\ displaystyle {\ begin {bmatrix} x '\\ y' \\\ end {bmatrix}} = {\ begin {bmatrix} \ cos \ theta & amp; - \ sin \ theta \\\ sin \ theta & amp; \ cos \ theta \\\ end {bmatrix}} {\ begin {bmatrix} x \\ y \\\ end {bmatrix}}}   .

Jadi koordinat (x ', y') dari titik (x, y) setelah rotasi adalah:

                              x           ?              =        x         cos             ?        -        and        without             ?                     {\ displaystyle x '= x \ cos \ theta -y \ sin \ theta \,}   ,
                           and           ?              =        x        without             ?             and         cos             ?                     {\ displaystyle y '= x \ sin \ theta y \ cos \ theta \,}   .

Arah rotasi vektor berlawanan jika? Positive (misalnya 90 °), give searah jarum jam jika? negatif (misalnya -90 °).

                      R        (        -        ?        )        =                              [                                                               cos                                  ?                                                  without                                  ?                                                                              -                  without                                  ?                                                     cos                                  ?                                                     ]                                       {\ displaystyle R (- \ theta) = {\ begin {bmatrix} \ cos \ theta & amp; \ without \ theta \\ - \ sin \ theta & amp; \ cos \ theta \\\ end {bmatrix}} \,}   .

Orientasi non-standar dari sistem koordinat

If the standard right-hand Cartesian coordinate system is used, with the axis x on the right and the axis y rising, the rotation R (? ) counterclockwise. If a left-handed Cartesian coordinate system is used, with x directed to the right but y is directed, R (? ) clockwise. This non-standard orientation is rarely used in mathematics but is common in 2D computer graphics, which often have origin in the upper-left corner and y -axis below the screen or page.

See below for other alternative conventions that can change the sense of rotation generated by the rotation matrix.

General rotation

Sangat berguna adalah matriks untuk 90 ° dan 180 ° rotate:

                      R        (                90                       ?                        )        =                              [                                                            0                                                  -                  1                                                                              1                                                  0                                                     ]                               {\ displaystyle R (90 ^ {\ circ}) = {\ begin {bmatrix} 0 & amp; -1 \\ [3pt] 1 & amp; 0 \\\ end {bmatrix}}}   (rotasi putaran berlawanan 90 °)
                      R        (                 180                       ?                        )        =                              [                                                            -                  1                                                  0                                                                              0                                                  -                  1                                                     ]                               {\ displaystyle R (180 ^ {\ circ}) = {\ begin {bmatrix} -1 & amp; 0 \\ [3pt] 0 & amp; -1 \\\ end {bmatrix}}}   (rotasi 180  ° di kedua arah - setengah putaran)
                      R        (                270                       ?                        )        =                              [                                                            0                                                  1                                                                              -                  1                                                  0                                                     ]                               {\ displaystyle R (270 ^ {\ circ}) = {\ begin {bmatrix} 0 & amp; 1 \\ [3pt] -1 & amp; 0 \\\ end {bmatrix}}}  (rotasi puts berlawanan 270 °, same dengan rotasi searah 90 °)

In Euclidean geometry, uniform scaling ( isotropic scaling , homogeneous widening , homothety) is an enlarged (increased) linear transformation or shrinking (decreasing) object with the same scale factor in all directions. The result of similar uniform scaling (in geometric sense) to the original. The scale factor 1 is usually permitted, so the congruent form is also classified as similar. (Some school textbooks specifically exclude this possibility, just as some exclude boxes from rectangles or circles from ellipses.)

More common is scaling with a separate scale factor for each direction of the axis. Non-uniform scale ( anisotropic scaling , inhomogeneous dilation ) is obtained when at least one of the scaling factors is different from the others; special cases are directional scaling or stretch (in one direction). Uniform scale changes the shape of an object; for example a square may turn into a rectangle, or be a parallelogram if the sides of the square are not parallel to the scale axis (the angle between the parallel to the axis is maintained, but not all angles).

2D Transformation Translation - Computer Graphics - C++ - YouTube
src: i.ytimg.com


Scaling

Penskalaan dapat direpresentasikan dengan matriks skala. Untuk skala objek oleh vektor v = ( v x , v y , v z ), setiap titik p = ( p x , p y , p z ) perlu dikalikan dengan matriks skala ini:

                                   S                         v                              =                                  [                                                                                      v                                             x                                                                                              0                                                      0                                                                                    0                                                                           v                                             y                                                                                              0                                                                                    0                                                      0                                                                           v                                             z                                                                                                  ]                             .                  {\ displaystyle S_ {v} = {\ begin {bmatrix} v_ {x} & amp; 0 & amp; 0 \\ 0 & amp; v_ {y} & amp; 0 \\ 0 & amp; 0 & amp; v_ {z} \\\ end {bmatrix}}.}   

Such scaling alters the diameter of an object by a factor between the scale factor, the area with the factor between the smallest and largest product of the two scale factors, and the volume by the product of all three.

Uniform scaling if and only if factor of same scale ( v <> x = v y = v z ). If all but one of the scale factors are equal to 1, we have a guidance scale.

In the case where v x = v y = v z = k , the scaling is also called magnification or widening by the k factor, increasing the area with k 2 and volume by k 3 factor.

A scale in the most general sense is an affine transform with a diagonalizable matrix. This includes the case that the three-way scaling is not perpendicular. It also includes the case that one or more scale factors are equal to zero (projection), and the case of one or more negative-scale factors. The latter corresponds to an appropriate combination of scales and a kind of reflection: along the line in a particular direction we take reflection at the point of intersection with unnecessary plane perpendicular; therefore it is more common than ordinary reflections in aircraft.

2 DIMENSIONAL VIEWING Ceng 477 Introduction to Computer Graphics ...
src: images.slideplayer.com


Using homogeneous coordinates

Dalam geometri projektif, sering digunakan dalam grafik komputer, titik direpresentasikan menggunakan koordinat homogen. Untuk skala objek oleh vektor v = ( v x , v y , v z ), setiap vektor koordinat homogen p = ( p x , p y , p z , 1) perlu dikalikan dengan matriks transformasi proyektif ini:

                                   S                         v                              =                                  [                                                                                      v                                             x                                                                                              0                                                      0                                                      0                                                                                    0                                                                           v                                             y                                                                                              0                                                      0                                                                                    0                                                      0                                                                           v                                             z                                                                                              0                                                                                    0                                                      0                                                      0                                                      1                                                          ]                             .                  {\ displaystyle S_ {v} = {\ begin {bmatrix} v_ {x} & amp; 0 & amp; 0 & amp; 0 \\ 0 & amp; v_ {y} & amp; 0 & amp; 0 \\ 0 & amp; 0 & amp; v_ {z} & amp; 0 \\ 0 & amp; 0 & amp; 0 & amp; 1 \ end {bmatrix}}.}   

Karena komponen terakhir dari koordinat yang homogen dapat dilihat sebagai penyebut dari tiga komponen lainnya, skala yang seragam oleh faktor umum s (skala seragam) dapat dicapai dengan menggunakan matriks skala ini:

                                   S                         v                              =                                  [                                                                 1                                                      0                                                      0                                                      0                                                                                    0                                                      1                                                      0                                                      0                                                                                    0                                                      0                                                      1                                                   ÂÂ

Source of the article : Wikipedia

Comments
0 Comments