0% found this document useful (0 votes)
17 views

CG Exp 1

The document contains the details of a student named Vaibhav Arun Kokate including their roll number, division, and batch. It discusses various concepts related to computer graphics like concave and convex polygons, different polygon filling algorithms including seed fill, scan line algorithm, edge fill algorithm, and raster scan. Key algorithms covered are scan line algorithm, flood fill algorithm, boundary fill algorithm. Advantages of scan line algorithm and definitions of simple convex polygon and polygon are also provided.

Uploaded by

1229- TCS
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)
17 views

CG Exp 1

The document contains the details of a student named Vaibhav Arun Kokate including their roll number, division, and batch. It discusses various concepts related to computer graphics like concave and convex polygons, different polygon filling algorithms including seed fill, scan line algorithm, edge fill algorithm, and raster scan. Key algorithms covered are scan line algorithm, flood fill algorithm, boundary fill algorithm. Advantages of scan line algorithm and definitions of simple convex polygon and polygon are also provided.

Uploaded by

1229- TCS
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/ 3

Name : Vaibhav Arun Kokate

Roll No. : C23350


Div : 3(C)
Batch : S11

Subject : CGL
Experiment No.1
Questions:
1.Explain concave and convex polygons?
Ans: A polygon is called convex if line joining any two interior points of the polygon lies inside
the polygon. A non-convex polygon is said to be concave. A concave polygon has one interior
angle greater than 180°. So that it can be clipped into similar polygons.

2. What is Polygon?
Ans: Polygon is a representation of the surface. It is primitive which is closed in nature. It is
formed using a collection of lines.

3. What are the different algorithms for polygon filling?


Ans: Filling the polygon means highlighting all the pixels which lie inside the polygon
with any colour other than background colour. Polygons are easier to fill since
they have linear boundaries.There are two basic approaches used to fill the polygon.
- One way to fill a polygon is to start from a given "seed", point known to be inside
the polygon and highlight outward from this point i.e. neighbouring pixels until
we encounter the boundary pixels. This approach is called seed fill because colour
flows from the seed pixel until reaching the polygon boundary, like water flooding
on the surface of the container.
- Another approach to fill the polygon is to apply the inside test i.e. to check
whether the pixel is inside the polygon or outside the polygon and then highlight
pixels which lie inside the polygon. This approach is known as scan-line
algorithm.

4. Explain the concept of polygon filling?


Ans: Polygon is an ordered list of vertices as shown in the following figure. For filling polygons
with particular colors, you need to determine the pixels falling on the border of the polygon and
those which fall inside the polygon. 
We can fill polygons using different techniques like :
1) Scan Line Algorithm
This algorithm works by intersecting scanline with polygon edges and fills the polygon
between pairs of intersections.
2) Flood Fill Algorithm
Instead of relying on the boundary of the object, it relies on the fill color. In other words,
it replaces the interior color of the object with the fill color. When no more pixels of the original
interior color exist, the algorithm is completed.
3) Boundary Fill Algorithm
The boundary fill algorithm works as its name. This algorithm picks a point inside an
object and starts to fill until it hits the boundary of the object. The color of the boundary and
the color that we fill should be different for this algorithm to work.The boundary fill algorithm
can be implemented by 4-connected pixels or 8-connected pixels.
i) 4-Connected Polygon
In this technique 4-connected pixels are used. We are putting the pixels above,
below, to the right, and to the left side of the current pixels and this process will
continue until we find a boundary with different color.
ii) 8-Connected Polygon
In this technique 8-connected pixels are used. We are putting pixels above, below,
right and left side of the current pixels as we were doing in 4-connected technique.In addition
to this, we are also putting pixels in diagonals so that entire area of the current pixel is covered.
This process will continue until we find a boundary with different color.

5. What is seed fill?


Ans: In this method, a point or seed which is inside region is selected. This point is called a seed
point. The seed fill algorithm is further classified as flood fill algorithm and boundary fill
algorithm.
- Algorithms that fill interior-defined regions are called flood-fill algorithms; those
that fill boundary-defined regions are called boundary-fill algorithms or edge-fill
algorithms.

6. What is scan line algorithm?


Ans: This algorithm works by intersecting scanline with polygon edges and fills the polygon
between pairs of intersections. The following steps depict how this algorithm works.
Step 1 − Find out the Ymin and Ymax from the given polygon.
Step 2 − ScanLine intersects with each edge of the polygon from Ymin to Ymax. Name each
intersection point of the polygon. As per the figure shown above, they are named as p0, p1, p2,
p3.
Step 3 − Sort the intersection point in the increasing order of X coordinate
i.e. p0,p1p0,p1, p1,p2p1,p2, and p2,p3p2,p3.
Step 4 − Fill all those pair of coordinates that are inside polygons and ignore the alternate pairs.

7. What are the advantages of scan line algorithm?


Ans: The advantages of Scan line algorithm are as follows:
1) It takes advantage of coherence resulting in fast algorithm.
2) It does require as much storage as depth buffer.
3) It only draws visible pixels.
4) This algorithm is common in software.
8. What is raster scan?
Ans: Raster scan is the most common method of displaying images on the CRT screen. In this
method, the horizontal and vertical deflection signals are generated to move the beam all over
the screen in a pattern. The architecture of a raster display consists of display controller, central
processing unit (CPU), video controller, refresh buffer, keyboard, mouse and the CRT.
The beam is swept back and forth from the left to the right across the screen. When the beam
is
moved from the left to the right, it is ON. The beam is OFF, when it is moved from the right to
the left. When the beam reaches the bottom of the screen, it is made OFF and rapidly retraced
back to the top left to start again. A display produced in this way is called raster scan display.
Raster scanning process is similar to reading different lines on the page of a book.

9. What Edge fill algorithm?


Ans: In this method, edges of the polygons are drawn. Then starting with some seed,
any point inside the polygon we examine the neighbouring pixels to check whether the
boundary pixel is reached. If boundary pixels are not reached, pixels are highlighted and the
process is continued until boundary pixels are reached. Boundary defined regions may be either
4-connected or 8-connected regions.
If a region is 4-connected, then every pixel in the region may be reached by a
combination of moves in only four directions : left, right, up and down.
For an 8-connected region every pixel in the region may be reached by a combination of moves
in the two horizontal, two vertical and four diagonal directions.

10. What is simple convex polygon?


Ans: A convex polygon is a polygon in which the line segment joining any two points
within the polygon lies completely inside the polygon.

You might also like