Graphic
Primitives
🠶 The basic geometric objects in C G are usually called primitives or
graphic output primitives
🠶 A primitive is a graphics object that is essential for the
creation or construction of complex images.
🠶 Fortunately, graphics is constructed from a few basic elements, as
opposed to the great variety of graphics applications.
Points
🠶 Points are uniquely defined by their x- and y-coordinates
🠶 Points are usually not drawn themselves
🠶 Their main function is the description of other objects like lines that can
be defined by their two endpoints
Lines, Polylines or
Curves
🠶 These ca n be defined by two or more points
🠶 For lines two points are needed
🠶 Curves need two points and additional control
points
🠶 Polylines are connected sequences of lines
Areas
🠶 Areas are bounded by closed polylines or
polygons
🠶 Areas can be filled with colour or a texture
Pixe
l
🠶 A pixel is a point of light.
🠶 It is just one tiny dot on the raster displays.
🠶 Though it has no structure, it is definitely a building block and hence it
can be considered as the graphics primitive.
🠶 The resolution of CRT is related to the dot size, the diameter of a single
dot.
🠶 A resolution of 100 dots lines/inch implies a dot size of 0.01 inch.
🠶 However, in reality, pixels are more elliptic than circle.
🠶 The shape of a pixel purely depends upon the characteristics of the
visual display unit.
Pixel.
.
🠶
Lin
e
🠶 Line, especially straight lines, constitute an important building block
of computer images.
🠶 For example, line is the basic building block of Line graphs, bar and
pie charts, two and three-dimensional graphs of mathematical
functions, engineering drawings and architectural plans.
🠶 In computer graphics, straight line is so basic in creating images that
we ca ll it a graphics primitive.
🠶 Straight lines ca n be developed in two different ways.
🠶 A structural method determines which pixels should be set before
drawing the line;
🠶 a conditional method tests certain conditions to find which pixel should
be
set next.
Polygo
n
🠶 A polygon, even though generally constructed from straight lines, is
an important graphics primitive.
🠶 So often we want to handle polygon as a single entity, as images of
objects
from the real world consist in large part of polygons.
🠶 A polygon is a closed area of image bounded by straight or curved lines
and filled with one solid colour.
🠶 Since images are two dimensional, a polygon is a closed planar figure.
🠶 Implementing a polygon as a graphics primitive is natural and helpful.
🠶 We can define polygon as an image which consists of a finite ordered set
of straight boundaries called edges.
🠶 Alternately, the polygon can be defined by an ordered sequence of
vertices,
the corners of the polygon.
Polygon.
.
🠶 The edges of the polygon are then obtained by traversing the vertices in the
given order;
🠶 The edge list is sufficient for wireframe drawings. Two consecutive vertices define
one
edge.
🠶 We close the polygon by connecting the last vertex to the first.
🠶 Face list is required in order to fill the polygon.
🠶 We can decompose a scene from real world into a collection of polygons of
simple
shapes.
🠶 For example, a simple house can be constructed with a square and a rectangle.
🠶 However, neither straight lines nor polygons precisely describe a real world
scene;
🠶 It is only an approximation of the scene we can get; such scenes actually seem
to be
of fractal nature.
Polygon.
.
he syntax for graphic constants is '< kk >'G
constants
In computer graphics, a constant is a value that remains the same throughout the
execution of a program and is represented by a meaningful name instead of a number or
string.
a graphic constant is a sequence of DBCS characters enclosed in single or double
quotation marks. The syntax for graphic constant is “<Kk>”
Like C# and Visual Basic, a constant can be explicitly declared as immutable
Actions
In computer graphics, a variety of actions are performed to create, manipulate, and display
images, animations, and 3D models. Here are some of the core actions:
Rendering
The process of generating a 2D image from a 3D model by simulating light interactions.
Types include real-time rendering (used in gaming) and offline rendering (used in
movies).
Transformation
Translation: Moving an object from one position to another.
Rotation: Rotating an object around an axis.
Scaling: Changing the size of an object in the x, y, or z direction.
Shearing: Distorting an object along one axis
Projection
Orthographic Projection: A projection where parallel lines remain parallel, typically used
in CAD.
Perspective Projection: A projection that simulates depth, used to mimic human vision
in 3D rendering.
Shading
Adding color, light, and shadow to give objects a realistic appearance.
Flat Shading: Applies a single color per polygon.
Gouraud Shading: Smoothly interpolates colors across vertices.
Phong Shading: Provides smoother and more realistic shading by interpolating normals
across surfaces.
Culling
Removing objects or faces that are not visible to the camera to save processing power.
Back-face Culling: Hides surfaces that face away from the camera.
Frustum Culling: Removes objects outside the camera's view
Image Processing and Filtering
Applying filters to manipulate image properties, like brightness, contrast, and blur.
Techniques include Gaussian Blur, Sharpening, and Edge Detection.
Alpha Blending
Combining a foreground image with a background image using transparency.
Used for effects like shadows, smoke, or translucent surfaces.
In computer graphics, various transformation techniques are-
Geometric Transformation
2D Transformation
Clipping
Cutting off parts of objects or scenes that are outside the view frustum (visible area),
optimizing rendering.
Clipping helps to reduce the number of calculations needed, improving performance.
Rasterization
Converting vector-based 3D models into a raster image (a grid of pixels) for display on
screens.
Involves filling in pixels within the boundaries of polygons.
10. Anti-Aliasing
Reducing the visual "jaggedness" or "stair-step" appearance on edges by smoothing or
blending pixels.
Techniques include MSAA (Multi-Sample Anti-Aliasing), SSAA (Super-Sample Anti-
Aliasing), and FXAA (Fast Approximate Anti-Aliasing).