Describe Sutherland-Hodgeman algorithm for polygon clipping.

1 Answer

Answer :

In Sutherland-Hodgeman, a polygon is clipped by processing the polygon boundary as a whole against each window edge. Clipping window must be convex. This could be accomplished by processing all polygon vertices against each clip rectangle boundary in turn beginning with the original set of polygon vertices, first clip the polygon against the left rectangle boundary to produce a new sequence of vertices. The new set of vertices could then be successively passed to a right boundary clipper, a top boundary clipper and a bottom boundary clipper. At each step a new set of polygon vertices us generated and passed to the next window boundary clipper. This is the logic used in Sutherland-Hodgeman algorithm.

image

Fig. Clipping polygon against successive window boundaries


The output of algorithm is a list of polygon vertices all of which are on the visible side of clipping plane. Such each edge of the polygon is individually compared with the clipping plane. This is achieved by processing two vertices of each edge of the polygonaround the clipping boundary or plane. This results in four possible relationships between the edge and clipping plane.


1. If first vertex of polygon edge is outside and second is inside window boundary, then intersection point of polygon edge with window boundary and second vertex are added to output vertices set as shown in Fig. 6.13.

image

2. If both vertices of edge are inside window boundary, then add only second vertex to output set as shown in Fig. 6.14.

image

3. If first vertex of edge is inside and second is outside of window boundary then point of intersection of edge with window boundary is stored in output set as shown in Fig. 6.15.

image

4. If both vertices of edges are outside of window boundary then those vertices are rejected as shown in Fig. 6.16.

Going through above four cases we can realize that there are two key processes in this algorithm: 1. Determine the visibility of point or vertex (Inside – Outside Test) 2. Determine the intersection of the polygon edge and clipping plane. The second key process in Sutherland-Hodgeman polygon clipping algorithm is to determine the intersection of the polygon edge and clipping plane.

Assume that we're clipping a polygon’s edge with vertices at (x1, y1) and (x2,

y2) against a clip window with vertices at (xmin, ymin) and (xmax, ymax).

1. The location (IX, IY) of the intersection of the edge with the left side of the

window is:

(i) IX = xmin

(ii) IY = slope*(xmin – x1) + y1, where the slope = (y2 – y1)/(x2 – x1).

2. The location of the intersection of the edge with the right side of the

window is:

(i) IX = xmax

(ii) IY = slope*(xmax – x1) + y1, where the slope = (y2 – y1)/(x2 – x1)

3. The intersection of the polygon's edge with the top side of the window is:

(i) IX = x1 + (ymax – y1) / slope

(ii) IY = ymax

4. Finally, the intersection of the edge with the bottom side of the window is:

(i) IX = x1 + (ymin – y1) / slope

(ii) IY = ymin

Algorithm for Sutherland-Hodgeman Polygon Clipping:

Step 1: Read co-ordinates of all vertices of the polygon.

Step 2: Read co-ordinates of the clipping window.

Step 3: Consider the left edge of window.

Step 4: Compare vertices of each of polygon, individually with the clipping plane.

Step 5: Save the resulting intersections and vertices in the new list of vertices

according to four possible relationships between the edge and the

clipping boundary.

Step 6: Repeat the steps 4 and 5 for remaining edges of clipping window. Each

time resultant list of vertices is successively passed to process next

edge of clipping window.

Step 7: Stop. 

Related questions

Description : Write down Cohen-Sutherland Line clipping algorithm.

Last Answer : Step 1: Scan end points for the line P1(x1, y1) and P2(x2, y2) Step 2: Scan corners for the window as (Wx1, Wy1) and (Wx2, Wy2) Step 3: Assign the region codes for endpoints P1 and P2 by ... if any of the end point of it appear outside the window. Step 8: Draw the remaining line. Step 9: Exit

Description : Explain scan line algorithm of polygon clipping.

Last Answer : For each scan line crossing a polygon, the area-fill algorithm locates the intersection points of the scan line with the polygon edges. These intersection points are then sorted from left to right ... 4 : Fill all those pair of coordinates that are inside polygons and ignore the alternate pairs.

Description : Define polygon clipping. 

Last Answer : A set of connected lines are considered as polygon; polygons are clipped based on the window and the portion which is inside the window is kept as it is and the outside portions are clipped. OR Polygon clipping is removal of part of an object outside a polygon.

Description : Write down Cyrus-Beck line clipping algorithm.

Last Answer : Step 1: Read end points of line P1 and P2. Step 2: Read vertex coordinates of clipping window. Step 3: Calculate D = P2 - P1. Step 4: Assign boundary point b with particular edge. Step 5: Find ... parametric equation of line P1P2. Step 12: Draw line segment P(tL) to P(tU). Step 13: Stop.

Description : Write the midpoint subdivision algorithm for line clipping.

Last Answer : Step 1: Scan two end points for the line P1(x1, y1) and P2(x2, y2). Step 2: Scan corners for the window as (x1, y1) and (x2, y2). Step 3:Assign the region codes for ... 5 for both subdivided line segments until you get completely visible and completely invisible line segments. Step 6: Exit.

Description : Explain Cyrusblek line clipping algorithm.

Last Answer : Cyrus Beck Line Clipping algorithm: Cyrus Beck Line Clipping algorithm is used to clip 2D/3D lines against convex polygon/polyhedron. Cyrus Beck Line clipping algorithm is actually, a parametric line-clipping algorithm. ... Step 12 : Draw line segment P(tL) to P(tU). Step 13 : Stop. 

Description : Explain midpoint subdivision line clipping algorithm.

Last Answer : Step 1: Scan two end points for the line P1(x1, y1) and P2(x2, y2). Step 2: Scan corners for the window as (Wx1, Wy1) and (Wx2, Wy2). Step 3: Assign the region ... through 5 for both subdivided line segments until you get completely visible and completely invisible line segments. Step 6: Exit.

Description : Let R be the rectangular window against which the lines are to be clipped using 2D Sutherland-Cohen line clipping algorithm. The rectangular window has lower left-hand corner at (-5,1) and upper righthand corner at (3,7). ... s) is/are candidate for clipping? (A) AB (B) CD (C) EF (D) AB and CD

Last Answer : (D) AB and CD

Description : Explain differ types of Text clipping in brief.

Last Answer : Many techniques are used to provide text clipping in a computer graphics. It depends on the methods used to generate characters and the requirements of a particular application. There are three methods ... then we discard only that portion of character that is outside of the clipping window.

Description : Explain Text Clipping.

Last Answer : Many techniques are used to provide text clipping in a computer graphics. It depends on the methods used to generate characters and the requirements of a particular application. There are three methods ... then we discard only that portion of character that is outside of the clipping window.  

Description : List various polygon filling algorithms

Last Answer : Various polygon filling algorithms are: Flood Fill Algorithm Boundary Fill Algorithm Scan Line Algorithm

Description : List types of Polygon

Last Answer : Polygon can be of two types:- Convex polygon Concave polygon

Description : Translate the polygon with co-ordinates A (3, 6), B (8, 11), & C (11, 3) by 2 units in X direction and 3 units in Y direction.

Last Answer : X’=x+tx Y’=y+ty tx=2 ty=3 for point A(3,6) x’=3+2=5 y’=6+3=9 for point B(8,11) x’=8+2=10 y’=11+3=14 for point C(11,3) x’=11+2=13 y’=3+3=6 A’=(x’,y’)=(5,9) B’=(x’,y’)=(10,14) C’=(x’,y’)=(13,6)

Description : Explain inside and outside test for polygon.

Last Answer : This method is also known as counting number method. While filling an object, we often need to identify whether particular point is inside the object or outside it. There are two methods by which we can identify ... + 1 = 1; which is non-zero. So the point is said to be an interior point.

Description : Write procedure to fill polygon with flood fill.

Last Answer : flood_fill(x,y,old_color,new_color) {  if(getpixel(x,y) = old_color) { putpixel(x,y,new_color); flood_fill(x+1,y,old_color, new_color); flood_fill(x-1,y,old_color, new_color); flood_fill(x,y+1, ... flood_fill(x+1,y-1,old_color, new_color); flood_fill(x-1,y+1,old_color, new_color); } }

Description : Explain and write steps for DDA line drawing algorithm. 

Last Answer : This algorithm generates a line from differential equations of line and hence the name DDA. DDA algorithm is an incremental scan conversion method. A DDA is hardware or software used for linear interpolation of variables over ... : Steps 1: Read the end points of line (x1,y1) and (x2,y2).

Description : Write a Program in ‘C’ for DDA Circle drawing algorithm

Last Answer : #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> void main() { int gdriver=DETECT,gmode,errorcode,tmp,i=1,rds; float st_x,st_y,x1,x2,y1,y2,ep; initgraph(& ... =y2; }while((y1-st_y)<ep || (st_x-x1)>ep); getch(); }

Description : Rephrase the Bresenham’s algorithm to plot 1/8th of the circle and write the algorithm required to plot the same.

Last Answer : The key feature of circle that it is highly symmetric. So, for whole 360 degree of circle we will divide it in 8-parts each octant of 45 degree. In order to that we will use Bresenham's Circle Algorithm for calculation of the ... Call Putpixel (Y + h, -X - k). Call Putpixel (-Y + h,-X + k).

Description : List any two line drawing algorithms. Also, list two merits of any line drawing algorithm.

Last Answer : Line drawing algorithms: Digital Differential Analyzer (DDA) algorithm Bresenham's algorithm Merits of DDA algorithms: It is the simplest algorithm and it does not require special skills ... , and multiplication by 2, which can be accomplished by a simple arithmetic shift operation.

Description : Write DDA Arc generation algorithm.

Last Answer : 1. Read the centre of curvature, say(x0,y0) 2. Read the arc angle, say Ɵ 3. Read the starting point of the arc, say(x,y) 4. Calculate dƟ dƟ=min(0.01,1/3.2*(|x-x0|+|y-y0|))) 5. Initialize angle = 0 6. ... Plot(x,y) x=x-(y-y0) *dƟ y=y-(x-x0) *dƟ Angle =Angle + dƟ } 7. stop

Description : What is interpolation? Describe the Lagrangian Interpolation method.

Last Answer : Specify a spline curve by giving a set of coordinate positions, called control points, which indicates the general shape of the curve These, control points are then fitted with piecewise continuous parametric ... -point positions above the surface Lagrangian Interpolation Method :

Description : Describe the vector scan display techniques with neat diagram.

Last Answer : A pen plotter operates in a similar way and is an example of a randomscan, hard-copy device. When operated as a random-scan display unit, a CRT has the electron beam directed only to the parts ... drawn one line at a time by positioning the beam to fill in the line between specified end points.

Description : State the different character generation methods. Describe any one with diagram.

Last Answer : Character Generator Methods: 1) Stroke Method 2) Bitmap Method 3) Starburst Method 1) STROKE METHOD Stroke method is based on natural method of text written by human being. In this method ... Character A : 0011 0000 0011 1100 1110 0001 Character M:0000 0011 0000 1100 1111 0011

Description : Compare Bitmap Graphics and Vector based graphics.

Last Answer : Compare Bitmap Graphics and Vector based graphics.  

Description : Explain types of Parallel Projection with example.

Last Answer : Orthographic projection - the projection direction is a normal one to the plane and it is categorized as o Top projection o Front projection o Side projection Oblique projection - the ... gives a better view and it is categorized as o Cavalier projection o Cabinet projection

Description : Explain stroke method and Bitmap method with example.

Last Answer : 1)STROKE METHOD Stroke method is based on natural method of text written by human being. In this method graph is drawing in the form of line by line. Line drawing algorithm DDA follows ... resolution devices such as inkjet printer or laser printer may use character arrays that are over 100x100.

Description : List out basic transformation techniques. Explain scaling transformation with respect to 2D.

Last Answer : Basic transformations techniques are: Translation Scaling Rotation Scaling Transformation Scaling means to change the size of object. This change can either be positive or negative. To change ... . If we provide values greater than 1, then we can increase the size of the object. 

Description : Differentiate between Random Scan and Raster Scan.

Last Answer : Random Scan Display Raster Scan Display In vector scan display the beam is moved between the end points of the graphics primitives. In raster scan display the beam is moved all over the screen ... e.g. monitors, TV It uses beam-penetration method. It uses shadow-mask method

Description : Give matrix representation for 2D scaling

Last Answer : Let us assume that the original co-ordinates are (X, Y), the scaling factors are (SX, SY), and the produced co-ordinates are (X', Y'). This can be mathematically represented as shown below: ... X and Y direction respectively. The above equations can also be represented in matrix form as below:

Description : Explain Raster Scan

Last Answer : In Raster scan, the electron beam from electron gun is swept horizontally across the phosphor one row at time from top to bottom. The electron beam sweeps back and forth from left to right across ... by repeating scanning of the same image. This process is known as refreshing of screen.

Description : Give the characteristics of display adaptor.

Last Answer : The characteristics of common display adapters are given in Table. The present-day display adapter supports all the modes of the preceding display adapters

Description : Define: (i)Pixel (ii)Frame Buffer

Last Answer : Pixel Pixel or Pel is defined as "the smallest addressable screen element". OR A pixel may be defined as the smallest size object or color spot that can be displayed and addressed on a ... buffer, or sometimes framestore) is a portion of RAM containing a bitmap that drives a video display. 

Description : Write a program in ‘C’ to generate Hilbert’s curve.

Last Answer : Here's an example of a program in C that generates Hilbert's curve: #include <stdio.h> void hilbert(int n, int x, int y, int dx, int dy) {     if (n ... that this is a simple implementation of the algorithm and it can be further optimized or modified as per the requirement.

Description : Obtain a transformation matrix for rotating an object about a specified pivot point.

Last Answer : To do rotation of an object about any selected arbitrary point P1(x1 ,y1), following sequence of operations shall be performed. 1. Translate: Translate an object so that arbitrary point P1 is moved to ... to P1and hence it is translation factor. It is demonstrated in following figure:

Description : Compare vector scan display and raster scan display 

Last Answer : Compare vector scan display and raster scan display    

Description : Write the transformation matrix for y-shear.

Last Answer : The Y-Shear can be represented in matrix from as:

Description : What is homogeneous co-ordinate? Why is it required?

Last Answer : Homogeneous coordinates are another way to represent points to simplify the way in which we express affine transformations. Normally, book-keeping would become tedious when affine transformations of ... 3D graphics hardware can be specialized to perform matrix multiplications on 4x4 matrices. 

Description : Define convex and concave polygons.

Last Answer : Convex Polygon: It is a polygon in which if you take any two positions of polygon then all the points on the line segment joining these two points fall within the polygon itself. Concave ... points on the line segment joining these two points does not fall entirely within the polygon.

Description : Define virtual reality. List any two advantages of virtual reality.

Last Answer : Virtual reality (VR) means experiencing things through our computers that don't really exist. OR Virtual Reality (VR) is the use of computer technology to create a simulated environment. ... in video games, engineering, entertainment, education, design, films, media, medicine and many more.

Description : List any four applications of computer graphics.

Last Answer : DTP (Desktop Publishing) Graphical User Interface (GUI) Computer-Aided Design Computer-Aided Learning (Cal) Animations Computer Art Entertainment ... Image processing Medical Applications Presentation and Business Graphics Simulation and Virtual Reality

Description : Define aspect ratio. Give one example of an aspect ratio

Last Answer : Aspect ratio: It is the ratio of the number of vertical points to the number of horizontal points necessary to produce equal length lines in both directions on the screen. or In computer ... Resolution 1280x1024 has an aspect ratio 5:4 Resolution 2160x1440, 2560x1700 has an aspect ratio 3:2

Description : Explain character generation methods: i. Stroke ii. Starburst iii. Bitmap

Last Answer : 1) STROKE METHOD Stroke method is based on natural method of text written by human being. In this method graph is drawing in the form of line by line. Line drawing algorithm DDA follows this ... Character A : 0011 0000 0011 1100 11100001 Character M:0000 0011 0000 1100 11110011

Description : Write C program for Hilbert’s Curve.

Last Answer : #include <stdio.h> #define N 32 #define K 3 #define MAX N * K typedefstruct{int x; int y; } point; void rot(int n, point *p, int rx, int ry){ int t; if(!ry){ if(rx == 1){ ... y < MAX; ++y)printf("%c", pts[y][x]); printf("\n"); } return0; }

Description : Explain composite transformation over arbitrary point.

Last Answer : To do rotation of an object about any selected arbitrary point P1(x1 ,y1), following sequence of operations shall be performed. 1. Translate:  Translate an object so that arbitrary point P1 is moved ... to P1and hence it is translation factor. It is demonstrated in following figure:

Description : Explain Koch curve with diagram.

Last Answer : Koch Curve: - In Koch curve, begin at a line segment. Divide it into third and replace the center by the two adjacent sides of an equilateral triangle as shown below. This will give the curve which starts and ... 4/3, the length of the curve will be infinite but it is folded in lots of tiny

Description : Explain 2D transformations with its types.

Last Answer : A transformation is a function that maps every position (x, y) into a new position (x', y'). Instead of applying the transformation function to every point in every line that makes up the object, we ... the object. If we provide values greater than 1, then we can increase the size of the object.

Description : Explain with diagram the techniques of Raster Scan Display.

Last Answer : The most common type of graphics monitor employing a CRT is the Raster-scan displays, based on television technology JPG images are raster based. Light occurs when an electron beam stimulates a phosphor. ... on the screen. If the intensity is zero (0) then no dot is displayed. monitor.

Description : Explain interpolation techniques in curve generation.

Last Answer : Specify a spline curve by giving a set of coordinate positions, called control points, which indicates the general shape of the curve These, control points are then fitted with piecewise continuous ... a design application. Straight lines connect the control -point positions above the surface.

Description : Write 2D and 3D scaling matrix.

Last Answer : 2D Scaling Scaling means to change the size of object. This change can either be positive or negative. To change the size of an object, scaling transformation is used. In the scaling process, you ... . Therefore, point after scaling with respect to origin can be calculated as, P=P . S 

Description : Write short note on Augmented Reality.

Last Answer : Augmented reality (AR) is made up of the word augment which means to make something great by adding something to it. Augmented Reality is a type of virtual reality that ... Reality is used in entertainment, military training, engineering design, robotics, manufacturing and other industries.