0% found this document useful (0 votes)
15 views10 pages

Computer Graphics Assignment

The document discusses computer graphics topics including the Cohen-Sutherland line clipping algorithm, 2D transformations of triangles, commutative nature of geometric functions, and the computer graphics pipeline. It also describes parallel and perspective projections, providing examples of orthographic, isometric, and oblique parallel projections as well as one-point and two-point perspective projections.

Uploaded by

ashytendai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views10 pages

Computer Graphics Assignment

The document discusses computer graphics topics including the Cohen-Sutherland line clipping algorithm, 2D transformations of triangles, commutative nature of geometric functions, and the computer graphics pipeline. It also describes parallel and perspective projections, providing examples of orthographic, isometric, and oblique parallel projections as well as one-point and two-point perspective projections.

Uploaded by

ashytendai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

COMPUTER GRAPHICS

BLESSMORE KASAKURA M203512


MOREBLESSING N SUKUTA M206290
NOZIPHO B TSHUMA M200126
Question 1

a.) The Cohen Sutherland line clipping algorithm is one of the most popular algorithms used. Give a
detailed description on this algorithm paying attention to the following:
i.) Boundary creation for the viewport
 We are given 9 regions on the screen. Out of which one region is of the window
and the rest 8 regions are around it given by 4 digit binary.
 The division of the regions is based on (x-max; y-max; x-min; y-min)
 The central part is the viewing region or window, all the lines which lie within
this region are completely visible.

ii.) 4 bit code generation


 Turn on the first bit if Y> Y max.
 Turn on the second bit if Y < Y min.
 Turn on the third bit if X> X max.
 Turn on the fourth bit if X < X min.
iii.) Trivial acceptance.
 Define the line as l start and l end.
 Assign the 4 bit code.
Such that C0 to l start
C1 to l end
 If C0 OR C1 = 0000 Trivially accept and draw the line
iv.) Trivial rejection
 If C0 AND C1 ≠ 0000 reject the line else clip and retest
 If C0 AND C1 = 0000, the line is partially inside the window and considered for
clipping.
v.) Clipping decision.
 Is mainly based on the equation of the straight line that is
 y = mx + c
 Where m is the gradient

Question 2
a.) Find a transformation of triangle A(1.0) B(0.1) C(1.1)
i.) Rotating 45 about origin and then translating one unit in x and y
directions
1. Rotate the triangle 45° about the origin:

A' = (1.0, 0.7071)


B' = (0.1, 0.7071)
C' = (1.1, 0.7071)

2. Translate the triangle one unit in the x and y directions:

A'' = (1.0 + 1.0, 0.7071 + 1.0) = (2.0, 1.7071)


B'' = (0.1 + 1.0, 0.7071 + 1.0) = (1.1, 1.7071)
C'' = (1.1 + 1.0, 0.7071 + 1.0) = (2.1, 1.7071)

So, the transformed triangle A''B''C'' has vertices at (2.0, 1.7071),


(1.1, 1.7071), and (2.1, 1.7071).
ii.) Translating one unit in x and y direction and then rotating 45 about
the origin.

1. Translate the triangle one unit in the x and y directions:

A' = (1.0 + 1.0, 0.1 + 1.0) = (2.0, 1.1)


B' = (0.1 + 1.0, 0.1 + 1.0) = (1.1, 1.1)
C' = (1.1 + 1.0, 0.1 + 1.0) = (2.1, 1.1)

2. Rotate the triangle 45° about the origin:

A'' = (2.0, 1.1) * cos(45°) - (1.1, 1.1) * sin(45°) = (1.7071, 1.7071)


B'' = (1.1, 1.1) * cos(45°) - (1.1, 1.1) * sin(45°) = (1.7071, 1.7071)
C'' = (2.1, 1.1) * cos(45°) - (1.1, 1.1) * sin(45°) = (2.7071, 1.7071)

So, the transformed triangle A''B''C'' has vertices at (1.7071,


1.7071), (1.7071, 1.7071), and (2.7071, 1.7071)
b.) Two geometric function calls A and B are said to be commutative if and only
if AB = BA.
 We reject commutative nature because AB IS NOT BA
iii.) Scale Translate
Question 3

a.) Give a detailed explanation of the steps alongside the rotation matrix used at each stage.
Step 1 : Translation ( T )
 Move the object to origin (0.0) in the world coordinate system
 Rotation matrix which is identified by matrix (I)

Step 2: Rotation

 Rotate the object to align with the viewing direction.


 Rotate about X axis

Step 3 : Perspective projection

 Project the 3D object units into 2D plane (screen)


 Perspective projection matrix ( P )
b.) What is the difference between perspective and parallel

Perspective Parallel
Refers to the different viewpoints or Refers to the simultaneous development
lenses through which the architecture and integration of different architectural
is analyzed and understood. components or modules.
Involves considering the architecture Involves breaking down the overall solution
from various stakeholder perspectives, into smaller, manageable parts that can be
such as business owners, end-users, IT worked on independently but still contribute
teams, and others. to the overall architecture.
Each perspective provides unique Working in parallel accelerates the
insights and requirements that must development process, increases efficiency,
be considered during the design and enables effective collaboration among
process. teams.
Helps ensure that the solution meets Allows for better coordination and
the needs and expectations of all integration of the different components,
stakeholders. leading to a more cohesive and holistic
solution.

c.) Give a detailed explanation of computer graphics pipeline

*The computer graphics pipeline is a series of stages or steps that graphics data goes
through to be rendered on a screen or display.
1. Application Stage: In this stage, the application or software program generates the
geometric data and defines the properties of objects to be rendered. This includes
specifying the vertices, their positions in 3D space, and attributes such as color and
texture coordinates.
2. Geometry Stage: The geometry stage processes the geometric data generated in the
application stage. It performs operations such as vertex transformations, where the
vertices are translated, rotated, and scaled to their correct positions in the 3D world.
This stage also handles operations like clipping, where objects or parts of objects
outside the view frustum are removed.
3. Rasterization Stage: After the geometry stage, the geometric primitives (such as points,
lines, or triangles) are divided into fragments or pixels that will be rendered on the
screen. Rasterization calculates the attributes of each fragment, such as the depth value
and the texture coordinates.
4. Fragment Stage: The fragment stage determines the final color and other attributes of
each fragment. This includes operations such as texture mapping, where textures are
applied to the fragments based on their texture coordinates. Lighting calculations can
also be performed in this stage to determine the shading and reflection properties of
the fragments.
5. Output Stage: In the final stage of the pipeline, the fragments are combined to form the
final image. This includes tasks such as blending, where fragments are combined with
existing pixels on the screen based on their transparency values. The resulting image is
then displayed on the screen or sent to the output device.

Question 4
a.) Describe in detail the two basic projection methods parallel and perspective
projection clearly outling any three type of each projection. Use diagrams

1. Parallel Projection:
Parallel projection is a type of projection where the projection lines are parallel to each
other and do not converge. This projection method is commonly used in technical and
engineering drawings, architectural blueprints, and computer-aided design (CAD)
applications.
a) Orthographic Projection: Orthographic projection is a parallel projection
technique where the projection lines are perpendicular to the viewing plane.
This results in a representation where all lines appear parallel and objects do not
appear foreshortened. It is commonly used in technical drawings to accurately
represent objects from different views, such as top, front, and side views.
b) Isometric Projection: Isometric projection is a type of parallel projection
where the object is projected onto a 2D plane with equal foreshortening along
all axes. This projection method creates a 3D representation that maintains the
proportions and angles of the original object. Isometric projection is often used
in technical illustrations and architectural drawings to provide a clear
understanding of the object's dimensions and spatial relationships.
c) Oblique Projection: Oblique projection is a type of parallel projection where
the object is projected onto the viewing plane at an angle other than 90 degrees.
This projection method creates a distorted representation of the object, with
one set of parallel lines appearing in true scale while the other set appears
foreshortened. Oblique projection is commonly used in architectural and
furniture design to provide a visually appealing representation of objects.
2. Perspective Projection:
Perspective projection is a type of projection where the projection lines converge
towards a vanishing point, simulating the way humans perceive depth in the real world.
This projection method aims to create a more realistic and immersive representation of
objects.
a) One-Point Perspective: One-point perspective is a perspective projection
technique where all parallel lines converge to a single vanishing point. This
technique is often used in architectural drawings to create the illusion of depth
and distance. It provides a sense of depth along a single direction, making
objects appear as if they are receding into the distance.
b) Two-Point Perspective: Two-point perspective is a perspective projection
technique where two sets of parallel lines converge to two different vanishing
points. This technique creates a more realistic representation of objects by
simulating depth along two different directions. Two-point perspective is
commonly used in architectural and interior design to create visually appealing
and accurate representations of objects and spaces.
c) Three-Point Perspective: Three-point perspective is a perspective projection
technique where three sets of parallel lines converge to three different vanishing
points. This technique creates an even more dynamic and immersive
representation by simulating depth along three different directions. Three-point
perspective is often used in artistic drawings and illustrations to create dramatic
and visually striking images

Differentiate ambient, diffuse and specular light.

Aspect Ambient Light Diffuse Light Specular Light


Direction Non-directional Non-directional Directional
Source No specific No specific Reflective source
source source (e.g., light source,
reflection)
Interaction with Interacts with all Interacts with Interacts with
Surfaces surfaces rough/matte smooth/shiny
surfaces surfaces
Reflection No specific Scattered Mirror-like
reflection reflection reflection
Shadows Fills in shadows Does not Does not affect
significantly shadows
affect shadows
Visual Effects Provides overall Determines color Creates highlights
illumination and texture and reflections
Surface Does not depend Depends on Depends on surface
Appearance on surface surface smoothness
properties roughness
Commonalities Contribute to Affect Combined to create
overall lighting appearance of realistic lighting
objects

You might also like