Computer Graphics is an art/presentation on visual/relevant display unit of images,pictures , animations with the help of computer program.
(a) Computer Graphics refers to the creation, storage and manipulation.
(b) Such as images, education, entertainment, videos, etc. Every image or picture is in fact a graph with different mathematical tricks are used to manipulate some changes in its properties like shape, size, etc.
(c) Computer Graphics is an art of drawing, pictures, lines, charts, etc.
(d) In computer graphics can be created as 2 or 3 dimensional images.
Pixel: Pixel is a small unit of a picture displayed on a computer screen
Multimedia means that computer information can be represented as the videos, animation, drawing, images.
gd : graphic driver
pixel : Picture Element ( It is the smallest unit of display )
PPI : Pixel per inch
Vector : Mathematical Formula
Raster : Pixel
There are two types of Computer Graphics
Interactive CG: Interactive Computer Graphics that user can control the output with the help of input devices. ( 2 Ways )
Non-Interactive CG: Non Interactive CG that user cannot control the output with the help of input devices ( 1 Way Communication )
Most applications that run or present computer and work station and even those that run on terminals attached to time shared computers and network computer server have users interface they rely on desktop windows system to manage multiple simultaneous activities and on point and click facilities to allow users to select menu items, icons at objects on the screen typing is necessary only to input text to be stored and manipulated.
Example: Word processing, spreadsheet ( Excel ) and desktop publishing ( DTP )
Used in business science technology!
The next most common use of graphics is to create 2D and 3D graphics or mathematical, physical, economic functions, bar and pie chart, inventory and production chart, all these are used to present meaningful and concised data. The trends and patterns from the data so as to clarify complex phenomena and to facilitate and inform decision making.
Most computer graphics can also be drawn but the computer can accomplish much more in a much short time. One of of the major benefits of computer graphics is that images can be manipulated relatively easy and that a multitude of visual effects are possible because the images can be played over and over again until the desired effect is achieved.
It is a foundational structure of a set of principle that guides you to design, a creation and utilization of interactive graphics.Framework is a layered structure what kind of program should be build.
Software: There are two components-
(a) Adobe Photoshop (Roster Graphics): In this, Adobe Photoshop images, we click on cameras and real images which can made up of pixels.
(b) Adobe Illustrator (Vector Graphics): In this vector graphics, we have to use in geometrical figures like lines, drawing, circle, rectangle, etc.
A cathode ray tube is a specialized vacuum tube in which images are reduced when an electron beam strikes phosphorescent screen.
All CRT's have 3 main elements:
Classification
Clipping: Completely visible figure (like line, rectangle, etc) in a particular screen is called completed clipping.
Clipping refers to the removal part of seeing. Clipping in Computer Graphics is a process of determining which part of graphical object should be display on the screen and which part should be discarded. It helps in rendering only visible portion of an object.
There are two types-
(a) Point Clipping
(b) Line Clipping
(a) Point Clipping: In point clipping decide whether a single point is inside or outside the viewing area.
If a point inside the window, it is displayed on the screen otherwise it is clipped.
(b) Line Clipping: In this line clipping deals with determining the visibility of line segment. Some of various algorithms like these are used to clip lines.
(i) Cohen Sutherland Algorithm
(ii) Liang-Bansky Algorithm
In this scan converting lines, involves the process of representing a straight line on a pixel, determining which pixel to turn on approximate. It enables the efficient and accurate(the line) representation of straight lines on the screen.
(i) End point coordinate: In this end point coordinate can be identified start and end points of a line.
(ii) Slope Calculation:
(iii) Determination of pixel position: In this, we determine the pixel position which pixel should be represent accurately.
It is process of representing circle on a pixel determining which pixel to turn on to approximate in circular shape.
(i) Circle and Radius: Define the center with coordinates of (h,k). h(horizontal (x-axis),vertical(y0axis)) and specify the radius 'r','h' represents 'x-axis' or coordinates of center of a circle and 'k' represents 'y-axis' or coordinates of center of a circle.
(ii) Plotting: In this plotting, we have to turn on pixels at calculated position to draw a circle.
(iii) Updating pixel position: In this we have to update decision parameter and move to the next pixel position based on algorithm.
(iv) Decision Parameter: Decision parameter is used for evaluate which pixel should be turn on next common method including mid point circle algorithm.
It is process of determining which pixel to activate in order to approximate shape of ellipse on a pixel.
(i) Centre of Ellipse: Define the centre of ellipse with point (h,k) and specify the length of semi-measure axis (a) and semi-measure axis (b).
(ii) Updating the pixel position: In this we have to update decision parameter and move to the next pixel position based on algorithm.
(iii) Plotting
(iv) Decision Parameter
A straight line may be defined by two end points.
(i) Clipping Point Clipping: In this process, involves determining whether single point lies within or outside a specified reason and usually a view port or clipping window. The purpose is to decide whether keep or discard point based on its coordinates.
(ii) Point Coordinates: Identify the coordinates (x,y) of a point.
(iii) Clipping Window: In this clipping window defines boundaries of clipping window, rectangular shape with specify x,y range.
(iv) Comparison: Compare the point coordinates with boundaries of a clipping window.
(v) Decision: If the pint is inside the clipping window, it is considered a visible and can be kept for further processing, otherwise if it is outside the window, it is clipped or discarded.
(vi) Clipping Window: Determining what position of the object will be visible and what part will be clipped or discarded.
(vii) View Port: In this process, objects are outside the clipping window considered as invisible.
Vertex | Rule | Output |
AB | in-in | B |
BC | in-in | C |
CD | in-in | D |
DE | in-out | P |
EA | out-in | Q A |
Vertex | Rule | Output |
AB | in-out | Q' |
BC | out-in | Q2 C |
CD | in-in | D |
DD' | in-in | D' |
E'D' | in-in | E' |
E'A | in-in | A |
Vertex | Rule | Output |
AA' | in-in | A' |
A'B' | in-in | B' |
B'C | in-in | C |
CD | in-out | P |
DD' | out-in | Q D' |
D'E' | in-in | E' |
E'A | in-in | A |
Vertex | Rule | Output |
AB' | out-in | R A' |
A'B' | in-in | B' |
B'C | in-in | C |
CP | in-in | P |
PQ | in-in | Q |
QD' | in-in | D' |
D'E' | in-in | E' |
E'A | in-out | S |
In this, transformation process are the operations like position, size, shape of an object within graphical scene.
There are two types of transformation-
(a) 2D Transformation
(b) 3D Transformation
Transformation is used to modifying the shapes, object and images in computer graphics.
It is an object along straight line path from one coordinate location to another.
To find original coordinates / new coordinates:
x' = x + tx
x' = y + ty
Matrix Representation:
or
A(2,2), B(8,2), C(5,5). Translate triangle with distance of tx=5, ty=6
Solution
A' = A + T
A'
A'
A' = (7,8) [ New coordinates ]
B'
A'
B' = (13,8) [ New coordinates ]
C'
C'
C' = (10,11) [ New coordinates ]
It is a transformation which evaluates the mirror image of an object.
There are only two types-
(a) Reflection which respect to x-axis
(b) Reflection with respect to y-axis
x' & y' are the new point coordinates of x and y axis.
Re(x) [Reflection with respect to x-axis. If coordinates are (x,y) then new coordinates will be:
x' = x
y' = -y
P' : New Coordinates
P : Original Coordinates
Formula:
P' = Re(x) . P
Matrix Representation:
P' = Re(x) . P
Re(y) [Reflection with respect to y-axis. If coordinates are (x,y) then new coordinates will be:
x' = -x
y' = y
P' : New Coordinates
P : Original Coordinates
Formula:
P' = Re(y) . P
P' = Re(y) . P
Reflection of the coordinates of an triangle ABC [A(3,4), B(6,4), C(4,8)] in respect to x-axis and y-axis.
Solution
For x-axis
A'
x'=3
y'=-4
A(3,-4)
B'
x'=6
y'=-4
B(6,-4)
C'
x'=4
y'=-8
C(4,-8)
For y-axis
A'
x'=-3
y'=4
A(-3,4)
B'
x'=6
y'=4
B(-6,4)
C'
x'=4
y'=8
C(-4,8)
Scaling is used for changing the size of an object. There are two scaling factors.
Sx = Scaling in x direction
Sy = Scaling in y direction.
Matrix Representation:
P' = S.P
There are three conditions:
(s.f = Scaling Factor)
Condition 1: If (s.f) = 1 , object size will not be increased or decreased.
Condition 2: If (s.f) > 1 , object size will be enlarged.
Condition 3: If (s.f) < 1 , object size will be reduced.
In a triangle there are three coordinates [A(2,1), B(5,1), C(4,4)]
Three units in x direction and 2 units in y direction
Solution
A'
A(6,2)
B'
B(15,2)
C'
C(12,8)
In Rotation we have to rotate an object as in 90° or 45°, etc.
It is a process of changing an angle of an object. Rotation can be performed, clockwise and anti-clockwise.
Φ = phi
Θ = theta
We are taking two coordinates, x and y. x= r cosΦ , y= r sinΦ are at a distance from origin to point p. Φ is an angle between x-axis and point p. Let coordinates of p(x,y) [p(x=r cosΦ, y=r sinΦ)].
For x-axis
x' = r cos ( Φ +Θ)
x' = r [cosΦ . cosΘ - sinΦ . sinΘ]
x' = rcosΦ . cosΘ - rsinΦ . sinΘ
Put x = rcosΦ & y = rsinΦ
x' = xcosΘ - ysinΘ
For y-axis
y' = r sin ( Φ +Θ)
y' = r [sinΦ . cosΘ + cosΦ . sinΘ]
y' = rsinΦ . cosΘ - rcosΦ . sinΘ
y' = ycosΘ - xsinΘ
Formula
P' = R . P
A triangle is given and their coordinates are [A(2,2), B(8,2), C(5,5)] and it is located at an angle 90° , here Θ = 90. Find new coordinates.
A'
Given Θ = 90
A(-2,2)
B'
B(-2,8)
C'
C(-5,5)
In this, shape and zie along x-axis and y-axis. It is similar to sliding the layers in the direction to change the object.
If p(x,y) are original coordinates and new coordinates are p'(x',y')
X-Shearing: Here, y coordinates remains same.
x' = x + shx . y
y = y
Matrix Representation:
Y-Shearing: Here, x coordinates remains same.
x' = x
y = y + shy . x
Matrix Representation:
Here, we have three coordinates [A(2,2), B(1,1), C(3,1)], 1 unit in x shearing and 1 unit in y shearing.
For X-Shearing
x' = x + shx . y
y' = y
A'
x' = 2 + 1 x 2 = 4
y' = 2
A(4,2)
B'
x' = 1 + 1 x 1 = 2
y' = 1
B(2,1)
C'
x' = 3 + 1 x 1 = 4
y' = 1
C(4,1)
For Y-Shearing
x' = x
y' = y + shy . x
A'
x' = 2
y' = 2 + 1 x 2
A(2,4)
B'
x' = 1
y' = 1 + 1 x 1
B(1,2)
C'
x' = 3
y' = 1 + 1 x 1
A(3,2)