SlideShare uma empresa Scribd logo
1 de 108
Objectives
At the end of this chapter the reader will be able to:
• Describe scan conversion
• Describe how to scan convert basic graphic
primitives like point, line, circle, ellipse
Introduction
Scan-converting a Point
Scan-converting a Straight Line
Scan-converting a Circle
Scan-converting an Ellipse
Output Primitives
● Graphic SW and HW provide subroutines to describe a
scene in terms of basic geometric structures called
output primitives.
● Output primitives are combined to form
complex structures
● Simplest primitives
– Point (pixel)
– Line segment
● Converting output primitives into frame buffer updates.
Choose which pixels contain which intensity value.
● Constraints
– Straight lines should appear as a straight line
– Primitives should start and end accurately
– Primitives should have a consistent brightness
along their length
– They should be drawn rapidly
Point plotting is accomplished by converting a single
coordinate position furnished by an application program
into appropriate operations for the output device.
Line drawing is accomplished by calculating intermediate
positions along the line path between two specified end
points positions. An output device is then directed to fill in
these positions between the end points
A point is shown by
illuminating a pixel on the
screen
A line segment is completely defined in terms of its two
endpoints.
A line segment is thus defined as:
Line_Seg = { (x1, y1), (x2, y2) }
y

A line is produced by
means of illuminating a set
of
intermediary
pixels
between the two endpoints.

y2

y1

x1

x2

x
Lines is digitized into a set of discrete integer positions
that approximate the actual line path.
Example: A computed line position of (10.48, 20.51) is
converted to pixel position (10, 21).
The rounding of coordinate values to integer causes
all but horizontal and vertical lines to be displayed
with a stair step appearance “the jaggies”.
To load an intensity value into the frame buffer at a position
corresponding to column x along scan line y,
setpixel (x, y)
To retrieve the current frame buffer intensity setting for a specified
location we use a low level function ,
getpixel (x, y)
Digital Differential Analyzer (DDA) Algorithm
Bresenham’s Line Algorithm
Parallel Line Algorithm
The Cartesian slope-intercept equation for a straight line is
y = m . x + b (1)
Where m as slope of the line and b as the y intercept
Given that the two endpoints of a line segment are
specified at positions (x1,y1) and (x2,y2) as in figure we can
determine the values for the slope m and y intercept b with
the following calculations
m = ∆y / ∆x = y2-y1 / x2 - x1

b= y1 - m . x1

(3)

(2)
Y2

y1
X1

x2

For any given x interval ∆x along a line, we can compute the
corresponding y interval ∆ y
∆y= m ∆x
(4)
We can obtain the x interval ∆x corresponding to a specified ∆y
as
∆ x = ∆ y/m (5)
For lines with slope magnitudes |m| < 1, ∆x can be set proportional to a small
horizontal deflection voltage and the corresponding vertical deflection is then set
proportional to ∆y as calculated from Eq (4).

For lines whose slopes have magnitudes |m | >1 , ∆y can be set proportional to a
small vertical deflection voltage with the corresponding horizontal deflection
voltage set proportional to ∆x, calculated from Eq (5)
For lines with m = 1, ∆x = ∆y and the horizontal and vertical deflections voltage
are equal.
Sampling along x axis
Y2

y1

X1

x2

Figure : Straight line Segment with five sampling positions along the x axis between
x1 and x2
All line drawing algorithms make use of the fundamental
equations:
Line Eqn. y = m.x + b
Slope m = y2 − y1 / x2 − x1 = Δy / Δx
y-intercept b = y1 − m.x1
x-interval→Δx = Δy / m
y-interval→ Δy = m Δx
A line algorithm Based on calculating either Δy or Δx using the
above equations.
There are two cases:
Positive slop
Negative slop
If m ≤ 1 then take Δx = 1
Compute successive y by

yk+1 = yk + m

(1)

Subscript k takes integer values starting from 1, for the
first point, and increases by 1 until the final end point is
reached.
Since 0.0 < m ≤ 1.0, the calculated y values must be
rounded to the nearest integer pixel position.
If m > 1, reverse the role of x and y and take Δy = 1,
calculate successive x from
xk+1 = xk + 1/m
(2)

In this case, each computed x value is rounded to the
nearest integer pixel position.
The above equations are based on the assumption
that lines are to be processed from left endpoint to
right endpoint.
In case the line is processed from Right endpoint to Left
endpoint, then
Δx = −1, yk+1 = yk − m
or
Δy = −1, xk+1 = xk −1/m

for m ≤ 1
for m > 1

(3)
(4)
If m < 1,
use(1) [provided line is calculated from left to right] and
use(3) [provided line is calculated from right to left].

If m ≥ 1
use (2) or (4).
Faster than the direct use of line Eqn.
It eliminates the multiplication in line Eqn.
For long line segments, the true line Path may be

mislead due to round off.
Rounding operations and floating-point arithmetic are
still time consuming.
The algorithm can still be improved.
Other algorithms, with better performance also exist.
Start with starting and ending coordinates of the line:
(x0, y0) and (x1, y1)

Color first pixel (round to nearest integer)
Suppose x1-x0 > y1-y0 (gentle slope)
There will be x1-x0 steps (# pixels to be colored)

Set x=x0, y=y0
At each step,
increment x by (x1-x0)/numsteps, and
increment y by (y1-y0)/numsteps

For each step, round off x and y to nearest integer, and color
pixel
// assume that slope is gentle
DDA(float x0, float x1, float y0, float y1) {
float x, y;
float xinc, yinc;
int numsteps;
numsteps = Round(x1) – Round(x0);
xinc = (x1 – x0) / numsteps;
yinc = (y1 – y0) / numsteps;
x = x0;
y = y0;
ColorPixel(Round(x),Round(y));
for (int i=0; i<numsteps; i++) {
x += xinc;
y += yinc;
ColorPixel(Round(x),Round(y));
}
}

Q: For each step, how many floating
point operations are there?
A: 4
Q: For each step, how many integer
operations are there?
A: 2
Suppose we want to draw
a line starting at pixel
(2,3) and ending at pixel
(12,8).
What are the values of
the variables x and y at
each timestep?
What are the pixels
colored, according to the
DDA algorithm?

numsteps = 12 – 2 = 10
xinc = 10/10 = 1.0
yinc = 5/10 = 0.5
t

x

y

R(x)

R(y)

0

2

3

2

3

1

3

3.5

3

4

2

4

4

4

4

3

5

4.5

5

5

4

6

5

6

5

5

7

5.5

7

6

6

8

6

8

6

7

9

6.5

9

7

8

10

7

10

7

9

11

7.5

11

8

10

12

8

12

8
It is an efficient raster line generation algorithm.
It can be adapted to display circles and other curves.
The algorithm
After plotting a pixel position (xk, yk) , what is the next
pixel to plot?

Consider lines with positive slope.
For a positive slope, 0 < m < 1 and line is starting from left to
right.
After plotting a pixel position (xk, yk) we have two choices for
next pixel:
(xk +1, yk)
(xk +1, yk+1)
For a positive slope, 0 < m < 1 and line is starting from left to
right.
After plotting a pixel position (xk, yk) we have two choices for
next pixel:
(xk +1, yk)
(xk +1, yk+1)
At position xk +1, we pay
attention to the intersection of
the vertical pixel and the
mathematical line path.
At position xk +1, we label
vertical pixel separations
from the mathematical line
path as

dlower , dupper.
The y coordinate on the mathematical line at xk+1 is calculated
as

y = m(xk +1)+ b
then

dlower = y − yk
= m (xk +1) + b − yk

and

dupper =(yk +1) − y
= yk +1− m(xk +1)− b
To determine which of the two pixels is closest to the line path, we set an
efficient test based on the difference between the two pixel separations
dlower - dupper = 2m (xk +1) − 2yk + 2b - 1
= 2 (Δy / Δx) (xk +1) − 2yk + 2b - 1
Consider a decision parameter pk such that
pk = Δx (dlower - dupper )
= 2Δy.xk − 2Δx.yk + c
where
c = 2Δy + Δx(2b −1)
Since Δx > 0, Comparing (dlower and dupper ), would tell
which pixel is closer to the line path; is it yk or yk + 1
If (dlower < dupper )
Then pk is negative

Hence plot lower pixel.
Otherwise

Plot the upper pixel.
We can obtain the values of successive decision parameter as
follows:

pk = 2Δy.xk − 2Δx.yk + c
pk+1=2Δy.xk+1−2Δx.yk+1+c
Subtracting these two equations

pk+1− pk = 2Δy (xk+1 − xk) − 2Δx ( yk+1 − yk)
But xk+1 − xk = 1, Therefore

pk+1 = pk +2Δy − 2Δx (yk+1 − yk)
( yk+1 − yk) is either 0 or 1, depending on the sign of pk
(plotting lower or upper pixel).
The recursive calculation of pk is performed at integer x
position, starting at the left endpoint.
p0 can be evaluated as:

p0 = 2Δy − Δx
Input the two line end points and store the left end point in (x0 ,
y0 ).
2. Load (x0 , y0 ) into the frame buffer; that is, plot the first point.
3. Calculate the constants Δx, Δy, 2Δy, and 2Δy − 2Δx, and obtain
the starting value for the decision parameter as
1.

p0 = 2Δy − Δx

4. At each xk along the line, starting at k = 0 , perform the following

test: If pk < 0,the next point to plot is (xk +1, yk and
pk+1=pk+2Δy

Otherwise, the next point to plot is (xk +1, yk +1) and
pk+1=pk+2Δy−2Δx

5. Repeat step 4, Δx−1 times.
The constants 2Δy and 2Δy − 2Δx are calculated once for
each line to be scan converted.
Hence the arithmetic involves only integer addition and
subtraction of these two constants.
To illustrate the algorithm, we digitize the line with endpoints
(20,10) and (30,18). This line has slope of 0.8, with
Δx = 10
Δy =8
The initial decision parameter has the value
p0 = 2Δy − Δx = 6
and the increments for calculating successive decision
parameters are
2 Δy = 16
2 Δy - 2 Δx = -4
We plot the initial point (x0 , y0)=(20,10) and determine
successive pixel positions along the line path from the
decision parameter as
K

pk

(xk +1, yk +1)

K

pk

(xk +1, yk +1)

0

6

(21,11)

5

6

(26,15)

1

2

(22,12)

6

2

(27,16)

2

-2

(23,12)

7

-2

(28,16)

3

14

(24,13)

8

14

(29,17)

4

10

(25,14)

9

10

(30,18)
A circle is defined as the set of points that are all at a given distance r
from a center point (xc, yc).

For any circle point (x, y), this distance is expressed by the Equation
(x − xc)2 + (y − yc)2 = r 2
We calculate the points by stepping along the x-axis in unit steps
from xc-r to xc+r and calculate y values as
There are some problems with this approach:
1.
Considerable computation at each step.
2. Non-uniform spacing between plotted pixels as in this Figure.
Problem 2 can be removed using the polar form:

x = xc + r cos θ
y = yc + r sin θ
Using a fixed angular step size, a circle is plotted with equally
spaced points along the circumference.
Problem 1 can be overcome by considering the symmetry of circles as
in Figure.
But it still requires a good deal of computation time.

Efficient Solutions
Midpoint Circle Algorithm
To apply the midpoint method, we define a circle function:

Any point (x,y) on the boundary of the circle with radius r
satisfies the equation fcircle(x, y)= 0.
If the points is in the interior of the circle, the circle function is
negative.
If the point is outside the circle, the circle function is positive.
To summarize, the relative position of any point (x,y) can be
determined by checking the sign of the circle function:
The circle function tests in (3) are performed for the mid
positions between pixels near the circle path at each sampling
step. Thus, the circle function is the decision parameter in the
midpoint algorithm, and we can set up incremental
calculations for this function as we did in the line algorithm.
This Figure shows the midpoint between the two candidate pixels at
sampling position xk +1. Assuming we have just plotted the pixel at
(xk , yk), we next need to determine whether the pixel at position (xk
+1, yk) or the one at position (xk +1, yk −1) is closer to the circle.
Our decision parameter is the circle function (2)
evaluated at the midpoint between these two pixels:
If pk < 0, this midpoint is inside the circle and the pixel on scan
line yk is closer to the circle boundary.
Otherwise, the midpoint is outside or on the circle boundary,
and we select the pixel on scan line yk −1.
Successive decision parameters are obtained using incremental
calculations.
We obtain a recursive expression for the next decision parameter by evaluating the
circle function at sampling position xk+1 +1 = xk + 2

where yk+1 is either yk or yk-1,depending on the sign of pk.
Increments for obtaining pk+1 are either :
2xk+1 +1 (if pk is negative) or
2xk+1 +1− 2yk+1 (if pk is positive)

Evaluation of the terms 2xk+1 and 2yk+1 can also be done
incrementally as:
At the start position (0, r), these two terms (2x, 2y) have the
values 0 and 2r, respectively.

Each successive value is obtained by adding 2 to the previous
value of 2x and subtracting 2 from the previous value of 2y.
The initial decision parameter is obtained by evaluating the
circle function at the start position (x0 , y0)=(0, r):
If the radius r is specified as an integer, we can simply round p0
to

since all increments are integers.
As in Bresenham’s line algorithm, the midpoint method
calculates pixel positions along the circumference of a
circle using integer additions and subtractions, assuming
that the circle parameters are specified in screen
coordinates.
Given a circle radius r = 10, we demonstrate the midpoint circle
algorithm by determining positions along the circle octant in
the first quadrant from x = 0 to x = y . The initial value of the
decision parameter is
For the circle centered on the coordinate origin, the initial
point is (x0 , y0) =(0,10), and initial increment terms for
calculating the decision parameters are

Successive decision parameter values and positions along
the circle path are calculated using the midpoint method as
shown in the table.
Ellipse equations are greatly simplified if the
major and minor axes are oriented to align
with the coordinate axes.
In Fig. 3-22, we show an ellipse in “standard
position” with major and minor axes oriented
parallel to the x and y axes.
Parameter rx for this example labels the
semimajor axis, and parameter ry labels the
semiminor axis.
The equation for the ellipse shown in Fig. 3-22 can be written in
terms of the ellipse center coordinates and parameters rx and ry
as
Using polar coordinates r and θ, we can also describe the ellipse
in standard position with the parametric equations :
The midpoint ellipse method is applied
throughout the first quadrant in two parts.

Figure 3-25 shows the division of the first
quadrant according to the slope of an
ellipse with rx < ry.
Regions 1 and 2 (Fig. 3-25) can be processed in various
ways.
We can start at position (0, ry) and step clockwise along the
elliptical path in the first quadrant, shifting from unit steps
in x to unit steps in y when the slope becomes less than
−1.0.

Alternatively, we could start at (rx, 0) and select points in a
counterclockwise order, shifting from unit steps in y to unit
steps in x when the slope becomes greater than −1.0.
We define an ellipse function from Eq. 3-37 with (xc , yc) =
(0, 0) as:

which has the following properties:
Starting at (0, ry), we take unit steps in the x direction until we
reach the boundary between region 1 and region 2 (Fig. 3-25).
Then we switch to unit steps in the y direction over the
remainder of the curve in the first quadrant.
At each step we need to test the value of the slope of the curve.
The ellipse slope is calculated from Eq. 3-39 as

At the boundary between region 1 and region 2, dy/dx =
−1.0 and

Therefore, we move out of region 1 whenever
Figure 3-26 shows the midpoint between the two candidate
pixels at sampling position xk +1 in the first region.
Assuming position (xk , yk) has been selected in the
previous step, we determine the next position along the
ellipse path by evaluating the decision parameter (that is,
the ellipse function 3-39) at this midpoint:
If p1k < 0, the midpoint is inside the ellipse and the pixel on scan
line yk is closer to the ellipse boundary.

Otherwise, the mid position is outside or on the ellipse
boundary, and we select the pixel on scan line yk − 1.
At the next sampling position (xk+1 + 1 = xk + 2), the decision
parameter for region 1 is evaluated as
Decision parameters are incremented by the following
amounts:
At the initial position (0, ry), these two terms evaluate to :

As x and y are incremented, updated values are obtained by adding
2r 2y to the current value of the increment term in Eq. 3-45 and
subtracting 2r 2x from the current value of the increment term in Eq.
3-46.
The updated increment values are compared at each step, and we
move from region 1 to region 2 when condition 3-42 is satisfied.
In region 1, the initial value of the decision parameter is
obtained by evaluating the ellipse function at the start position
(x0, y0) = (0, ry):
Over region 2, we sample at unit intervals in the negative y
direction, and the midpoint is now taken between horizontal
pixels at each step (Fig. 3-27).

For this region, the decision parameter is evaluated as
If p2k > 0, the midposition is outside the ellipse boundary, and
we select the pixel at xk.
If p2k <= 0, the midpoint is inside or on the ellipse boundary,
and we select pixel position xk+1.
To determine the relationship between successive decision
parameters in region 2,we evaluate the ellipse function at the
next sampling step yk+1 −1 = yk −2:
When we enter region 2, the initial position (x0, y0) is
taken as the last position selected in region 1 and the
initial decision parameter in region 2 is then
Given input ellipse parameters rx =8 and ry = 6, we illustrate the
steps in the midpoint ellipse algorithm by determining raster
positions along the ellipse path in the first quadrant.

Initial values and increments for the decision parameter
calculations are
For region 1, the initial point for the ellipse centered on the
origin is (x0, y0) = (0, 6), and the initial decision parameter value
is

Successive midpoint decision parameter values and the pixel
positions along the ellipse are listed in the following table.
For region 1, the initial point for the ellipse centered on the
origin is (x0, y0) = (0, 6), and the initial decision parameter value
is

Successive midpoint decision parameter values and the pixel
positions along the ellipse are listed in the following table.
We now move out of region 1, since

2r 2 y x > 2r 2 x y.
For region 2, the initial point is

(x0, y0) = (7, 3)
and the initial decision parameter is
The remaining positions along the ellipse path in the first
quadrant are then calculated as
A plot of the calculated positions for the ellipse within
the first quadrant is shown bellow:
A standard output primitive in general graphics packages is a solidcolor or patterned polygon area.
There are two basic approaches to area filling on raster systems:
1. The scan-line approach

Determine the overlap intervals for scan lines that cross the area.
is typically used in general graphics packages to fill polygons,
circles, ellipses
2. Filling approaches

start from a given interior position and paint outward from this
point until we encounter the specified boundary conditions.
useful with more complex boundaries and in interactive painting
systems.
Scan-Line Fill Algorithm:
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, and the
corresponding frame-buffer positions between each intersection pair
are set to the specified fill color.
Calculations performed in scan-conversion and other graphics
algorithms typically take advantage of various coherence properties
of a scene that is to be displayed.
Coherence is simply that the properties of one part of a scene are
related in some way to other parts of the scene so that the
relationship can be used to reduce processing.
Coherence methods often involve incremental calculations applied
along a single scan line or between successive scan lines.
Area-filling algorithms and other graphics processes often need to
identify interior regions of objects.
To identify interior regions of an object graphics packages normally
use either:
1.
2.

Odd-Even rule
Nonzero winding number rule
Odd-Even rule (Odd Parity Rule, Even-Odd Rule):
Draw a line from any position P to a distant point outside the
co ordinate extents of the object and counting the number of edge
crossings along the line.
If the number of polygon edges crossed by this line is odd then
P is an interior point.

Else

P is an exterior point
Nonzero Winding Number Rule :
Counts the number of times the polygon edges wind around a
particular point in the counterclockwise direction. This count is
called the winding number, and the interior points of a twodimensional object are defined to be those that have a nonzero value
for the winding number.
1. Initializing the winding number to Zero.
2. Imagine a line drawn from any position P to a distant point

beyond the coordinate extents of the object.
Nonzero Winding Number Rule :
3. Count the number of edges that cross the line in each

direction. We add 1 to the winding number every time we
intersect a polygon edge that crosses the line from right to
left, and we subtract 1 every time we intersect an edge that
crosses from left to right.

4. If the winding number is nonzero, then

P is defined to be an interior point

Else
P is taken to be an exterior point.
Start at a point inside a region and paint the interior outward
toward the boundary. If the boundary is specified in a single color,
the fill algorithm proceeds outward pixel by pixel until the boundary
color is encountered.

It is useful in interactive painting packages, where interior points
are easily selected.

The inputs of the this algorithm are:
• Coordinates of the interior point (x, y)
• Fill Color
• Boundary Color
Starting from (x, y), the algorithm tests neighboring
pixels to determine whether they are of the boundary color.

 If not, they are painted with the fill color, and their
neighbors are tested. This process continues until all pixels
up to the boundary have been tested.

 There are two methods for proceeding to neighboring
pixels from the current test position:
1.

The 4-connected
method.

2. The 8-connected
method.
void boundaryFill4 (int x, int y, int fillColor, int borderColor)
{
int interiorColor;

/* set current color to fillColor, then perform following operations. */

}

interiorColor =getPixel (x, y);
if ( (interiorColor != borderColor) && (interiorColor != fillColor) )
{
setPixel (x, y); // set color of pixel to fillColor
boundaryFill4 (x + 1, y, fillColor, borderColor);
boundaryFill4 (x - 1, y, fillColor, borderColor);
boundaryFill4 (x, y + 1, fillColor, borderColor);
boundaryFill4 (x, y - 1, fillColor, borderColor);
}
4-connected and 8-connected methods involve heavy recursion
which may consume memory and time. More efficient methods are
used. These methods fill horizontal pixel spans across scan line. This
called a Pixel Span method.

We need only stack a beginning position for each horizontal pixel
span, instead of stacking all unprocessed neighboring positions
around the current position, where spans are defined as the
contiguous horizontal string of positions.
Start from the initial interior point, then fill in the contiguous span
of pixels on this starting scan line. Then we locate and stack starting
positions for spans on the adjacent scan lines, where spans are
defined as the contiguous horizontal string of positions bounded by
pixels displayed in the area border color.
At each subsequent step, we unstack the next start position and
repeat the process. An example of how pixel spans could be filled
using this approach is illustrated for the 4-connected fill region in
the following figure.
Sometimes we want to fill in (or recolor)

an area that is not defined within a single
color boundary. We can paint such areas by
replacing a specified interior color instead
of searching for a boundary color value.
This approach is called a flood-fill
algorithm.
 We start from a specified interior point (x, y) and reassign all pixel

values that are currently set to a given interior color with the
desired fill color.
 If the area we want to paint has more than one interior color, we

can first reassign pixel values so that all interior points have the
same color. Using either a 4-connected or 8-connected approach,
we then step through pixel positions until all interior points have
been repainted.
void floodFill4 (int x, int y, int fillColor, int interiorColor)
{
int color;
/* set current color to fillColor, then perform following operations. */
getPixel (x, y, color);
if (color = interiorColor)
{
setPixel (x, y); // set color of pixel to fillColor
floodFill4 (x + 1, y, fillColor, interiorColor);
floodFill4 (x - 1, y, fillColor, interiorColor);
floodFill4 (x, y + 1, fillColor, interiorColor);
floodFill4 (x, y - 1, fillColor, interiorColor);
}
}
Flood-Fill Algorithm (cont.)
void floodFill4 (int x, int y, int fillColor, int interiorColor)
{ int color;
/* set current color to fillColor, then perform following operations. */
getPixel (x, y, color);
if (color = interiorColor)
{
setPixel (x, y); // set color of pixel to fillColor
floodFill4 (x + 1, y, fillColor, interiorColor);
floodFill4 (x - 1, y, fillColor, interiorColor);
floodFill4 (x, y + 1, fillColor, interiorColor);
floodFill4 (x, y - 1, fillColor, interiorColor);
}
}
CS 380

Mais conteúdo relacionado

Mais procurados

Computer animation Computer Graphics
Computer animation Computer Graphics Computer animation Computer Graphics
Computer animation Computer Graphics University of Potsdam
 
COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"Ankit Surti
 
Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmComputer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmRuchi Maurya
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformationSelvakumar Gna
 
Unit 3
Unit 3Unit 3
Unit 3ypnrao
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.Mohd Arif
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversionMohd Arif
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphicanku2266
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesOmprakash Chauhan
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithmMani Kanth
 
3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics FundamentalsMuhammed Afsal Villan
 
Composite transformation
Composite transformationComposite transformation
Composite transformationPooja Dixit
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clippingMdAlAmin187
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformationsMohammad Sadiq
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)shalinikarunakaran1
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformationsMohd Arif
 

Mais procurados (20)

Three dimensional concepts - Computer Graphics
Three dimensional concepts - Computer GraphicsThree dimensional concepts - Computer Graphics
Three dimensional concepts - Computer Graphics
 
Computer animation Computer Graphics
Computer animation Computer Graphics Computer animation Computer Graphics
Computer animation Computer Graphics
 
COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"
 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithm
 
Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmComputer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithm
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
 
Unit 3
Unit 3Unit 3
Unit 3
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversion
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithm
 
3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals
 
Composite transformation
Composite transformationComposite transformation
Composite transformation
 
ANIMATION SEQUENCE
ANIMATION SEQUENCEANIMATION SEQUENCE
ANIMATION SEQUENCE
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformations
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
 
2 d geometric transformations
2 d geometric transformations2 d geometric transformations
2 d geometric transformations
 

Destaque

Output primitives computer graphics c version
Output primitives   computer graphics c versionOutput primitives   computer graphics c version
Output primitives computer graphics c versionMarwa Al-Rikaby
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4PrathimaBaliga
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output PrimitivesRenita Santhmayora
 
CG - Output Primitives
CG - Output PrimitivesCG - Output Primitives
CG - Output Primitivesvinay arora
 
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Saikrishna Tanguturu
 
Input devices in computer graphics
Input devices in computer graphicsInput devices in computer graphics
Input devices in computer graphicsAnu Garg
 
raster and random scan
raster and random scanraster and random scan
raster and random scanSonia Pahuja
 
Introduction to Computer Graphics(1)
Introduction to Computer Graphics(1)Introduction to Computer Graphics(1)
Introduction to Computer Graphics(1)HiteshJain007
 
Introduction to Computer Graphics
Introduction to Computer GraphicsIntroduction to Computer Graphics
Introduction to Computer GraphicsYatin Singh
 
Graphics Standards and Algorithm
Graphics Standards and AlgorithmGraphics Standards and Algorithm
Graphics Standards and AlgorithmYatin Singh
 
Overview of graphics systems
Overview of  graphics systemsOverview of  graphics systems
Overview of graphics systemsJay Nagar
 
Bressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmBressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmMrinmoy Dalal
 
Confessions from Social Media Event Organizers: Taking your brand offline
Confessions from Social Media Event Organizers: Taking your brand offlineConfessions from Social Media Event Organizers: Taking your brand offline
Confessions from Social Media Event Organizers: Taking your brand offlineCheryl Lawson
 
Line drawing algorithms
Line drawing algorithmsLine drawing algorithms
Line drawing algorithmsSusheel Thakur
 

Destaque (20)

Output primitives computer graphics c version
Output primitives   computer graphics c versionOutput primitives   computer graphics c version
Output primitives computer graphics c version
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 
CG - Output Primitives
CG - Output PrimitivesCG - Output Primitives
CG - Output Primitives
 
Unit 3
Unit 3Unit 3
Unit 3
 
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
 
Input devices in computer graphics
Input devices in computer graphicsInput devices in computer graphics
Input devices in computer graphics
 
raster and random scan
raster and random scanraster and random scan
raster and random scan
 
Introduction to Computer Graphics(1)
Introduction to Computer Graphics(1)Introduction to Computer Graphics(1)
Introduction to Computer Graphics(1)
 
Introduction to Computer Graphics
Introduction to Computer GraphicsIntroduction to Computer Graphics
Introduction to Computer Graphics
 
grahics
grahicsgrahics
grahics
 
Input Devices
Input Devices Input Devices
Input Devices
 
Graphics Standards and Algorithm
Graphics Standards and AlgorithmGraphics Standards and Algorithm
Graphics Standards and Algorithm
 
Overview of graphics systems
Overview of  graphics systemsOverview of  graphics systems
Overview of graphics systems
 
2D viewing
2D viewing2D viewing
2D viewing
 
Trading StocksSemanal20/05/2011
Trading StocksSemanal20/05/2011Trading StocksSemanal20/05/2011
Trading StocksSemanal20/05/2011
 
Bressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing AlgorithmBressenham’s Midpoint Circle Drawing Algorithm
Bressenham’s Midpoint Circle Drawing Algorithm
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Confessions from Social Media Event Organizers: Taking your brand offline
Confessions from Social Media Event Organizers: Taking your brand offlineConfessions from Social Media Event Organizers: Taking your brand offline
Confessions from Social Media Event Organizers: Taking your brand offline
 
Line drawing algorithms
Line drawing algorithmsLine drawing algorithms
Line drawing algorithms
 

Semelhante a Chapter 3 Output Primitives

Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2SanthiNivas
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithmsMohammad Sadiq
 
Unit 2
Unit 2Unit 2
Unit 2ypnrao
 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxKokebe2
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solvedKuntal Bhowmick
 
Computer graphics notes 2 tutorials duniya
Computer graphics notes 2   tutorials duniyaComputer graphics notes 2   tutorials duniya
Computer graphics notes 2 tutorials duniyaTutorialsDuniya.com
 
Unit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsUnit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsAmol Gaikwad
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxIndhuMcamphil
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxAlamelu
 
Output Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptxOutput Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptxNaveenaKarthik3
 
Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cppAlamgir Hossain
 
Lab lecture 2 bresenham
Lab lecture 2 bresenhamLab lecture 2 bresenham
Lab lecture 2 bresenhamsimpleok
 
Computer graphics LINE DRAWING algorithm.pptx
Computer graphics LINE DRAWING algorithm.pptxComputer graphics LINE DRAWING algorithm.pptx
Computer graphics LINE DRAWING algorithm.pptxR S Anu Prabha
 
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi54MahakBansal
 

Semelhante a Chapter 3 Output Primitives (20)

Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
 
Dda algo notes
Dda algo notesDda algo notes
Dda algo notes
 
Unit 2
Unit 2Unit 2
Unit 2
 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptx
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solved
 
Computer graphics notes 2 tutorials duniya
Computer graphics notes 2   tutorials duniyaComputer graphics notes 2   tutorials duniya
Computer graphics notes 2 tutorials duniya
 
Unit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsUnit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithms
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notes
 
Output Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptxOutput Primitive and Brenshamas Line.pptx
Output Primitive and Brenshamas Line.pptx
 
Computer graphics lab report with code in cpp
Computer graphics lab report with code in cppComputer graphics lab report with code in cpp
Computer graphics lab report with code in cpp
 
Lab lecture 2 bresenham
Lab lecture 2 bresenhamLab lecture 2 bresenham
Lab lecture 2 bresenham
 
Computer graphics notes watermark
Computer graphics notes watermarkComputer graphics notes watermark
Computer graphics notes watermark
 
Computer graphics LINE DRAWING algorithm.pptx
Computer graphics LINE DRAWING algorithm.pptxComputer graphics LINE DRAWING algorithm.pptx
Computer graphics LINE DRAWING algorithm.pptx
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
 
module 1.pdf
module 1.pdfmodule 1.pdf
module 1.pdf
 

Mais de PrathimaBaliga

Overview of Graphics System
Overview of Graphics SystemOverview of Graphics System
Overview of Graphics SystemPrathimaBaliga
 
Introduction to Computer graphics
Introduction to Computer graphics Introduction to Computer graphics
Introduction to Computer graphics PrathimaBaliga
 

Mais de PrathimaBaliga (6)

Multimedia chapter 4
Multimedia chapter 4Multimedia chapter 4
Multimedia chapter 4
 
Multimedia chapter 2
Multimedia chapter 2Multimedia chapter 2
Multimedia chapter 2
 
Multimedia chapter 2
Multimedia chapter 2Multimedia chapter 2
Multimedia chapter 2
 
Multimedia chapter 5
Multimedia chapter 5Multimedia chapter 5
Multimedia chapter 5
 
Overview of Graphics System
Overview of Graphics SystemOverview of Graphics System
Overview of Graphics System
 
Introduction to Computer graphics
Introduction to Computer graphics Introduction to Computer graphics
Introduction to Computer graphics
 

Último

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

Chapter 3 Output Primitives

  • 1. Objectives At the end of this chapter the reader will be able to: • Describe scan conversion • Describe how to scan convert basic graphic primitives like point, line, circle, ellipse
  • 2. Introduction Scan-converting a Point Scan-converting a Straight Line Scan-converting a Circle Scan-converting an Ellipse
  • 3. Output Primitives ● Graphic SW and HW provide subroutines to describe a scene in terms of basic geometric structures called output primitives. ● Output primitives are combined to form complex structures ● Simplest primitives – Point (pixel) – Line segment
  • 4. ● Converting output primitives into frame buffer updates. Choose which pixels contain which intensity value. ● Constraints – Straight lines should appear as a straight line – Primitives should start and end accurately – Primitives should have a consistent brightness along their length – They should be drawn rapidly
  • 5. Point plotting is accomplished by converting a single coordinate position furnished by an application program into appropriate operations for the output device. Line drawing is accomplished by calculating intermediate positions along the line path between two specified end points positions. An output device is then directed to fill in these positions between the end points
  • 6. A point is shown by illuminating a pixel on the screen
  • 7. A line segment is completely defined in terms of its two endpoints. A line segment is thus defined as: Line_Seg = { (x1, y1), (x2, y2) }
  • 8. y A line is produced by means of illuminating a set of intermediary pixels between the two endpoints. y2 y1 x1 x2 x
  • 9. Lines is digitized into a set of discrete integer positions that approximate the actual line path. Example: A computed line position of (10.48, 20.51) is converted to pixel position (10, 21).
  • 10. The rounding of coordinate values to integer causes all but horizontal and vertical lines to be displayed with a stair step appearance “the jaggies”.
  • 11. To load an intensity value into the frame buffer at a position corresponding to column x along scan line y, setpixel (x, y) To retrieve the current frame buffer intensity setting for a specified location we use a low level function , getpixel (x, y)
  • 12. Digital Differential Analyzer (DDA) Algorithm Bresenham’s Line Algorithm Parallel Line Algorithm
  • 13. The Cartesian slope-intercept equation for a straight line is y = m . x + b (1) Where m as slope of the line and b as the y intercept Given that the two endpoints of a line segment are specified at positions (x1,y1) and (x2,y2) as in figure we can determine the values for the slope m and y intercept b with the following calculations
  • 14. m = ∆y / ∆x = y2-y1 / x2 - x1 b= y1 - m . x1 (3) (2) Y2 y1 X1 x2 For any given x interval ∆x along a line, we can compute the corresponding y interval ∆ y ∆y= m ∆x (4) We can obtain the x interval ∆x corresponding to a specified ∆y as ∆ x = ∆ y/m (5)
  • 15. For lines with slope magnitudes |m| < 1, ∆x can be set proportional to a small horizontal deflection voltage and the corresponding vertical deflection is then set proportional to ∆y as calculated from Eq (4). For lines whose slopes have magnitudes |m | >1 , ∆y can be set proportional to a small vertical deflection voltage with the corresponding horizontal deflection voltage set proportional to ∆x, calculated from Eq (5) For lines with m = 1, ∆x = ∆y and the horizontal and vertical deflections voltage are equal. Sampling along x axis Y2 y1 X1 x2 Figure : Straight line Segment with five sampling positions along the x axis between x1 and x2
  • 16. All line drawing algorithms make use of the fundamental equations: Line Eqn. y = m.x + b Slope m = y2 − y1 / x2 − x1 = Δy / Δx y-intercept b = y1 − m.x1 x-interval→Δx = Δy / m y-interval→ Δy = m Δx
  • 17. A line algorithm Based on calculating either Δy or Δx using the above equations. There are two cases: Positive slop Negative slop
  • 18. If m ≤ 1 then take Δx = 1 Compute successive y by yk+1 = yk + m (1) Subscript k takes integer values starting from 1, for the first point, and increases by 1 until the final end point is reached. Since 0.0 < m ≤ 1.0, the calculated y values must be rounded to the nearest integer pixel position.
  • 19. If m > 1, reverse the role of x and y and take Δy = 1, calculate successive x from xk+1 = xk + 1/m (2) In this case, each computed x value is rounded to the nearest integer pixel position. The above equations are based on the assumption that lines are to be processed from left endpoint to right endpoint.
  • 20. In case the line is processed from Right endpoint to Left endpoint, then Δx = −1, yk+1 = yk − m or Δy = −1, xk+1 = xk −1/m for m ≤ 1 for m > 1 (3) (4)
  • 21. If m < 1, use(1) [provided line is calculated from left to right] and use(3) [provided line is calculated from right to left]. If m ≥ 1 use (2) or (4).
  • 22. Faster than the direct use of line Eqn. It eliminates the multiplication in line Eqn. For long line segments, the true line Path may be mislead due to round off. Rounding operations and floating-point arithmetic are still time consuming. The algorithm can still be improved. Other algorithms, with better performance also exist.
  • 23. Start with starting and ending coordinates of the line: (x0, y0) and (x1, y1) Color first pixel (round to nearest integer) Suppose x1-x0 > y1-y0 (gentle slope) There will be x1-x0 steps (# pixels to be colored) Set x=x0, y=y0 At each step, increment x by (x1-x0)/numsteps, and increment y by (y1-y0)/numsteps For each step, round off x and y to nearest integer, and color pixel
  • 24. // assume that slope is gentle DDA(float x0, float x1, float y0, float y1) { float x, y; float xinc, yinc; int numsteps; numsteps = Round(x1) – Round(x0); xinc = (x1 – x0) / numsteps; yinc = (y1 – y0) / numsteps; x = x0; y = y0; ColorPixel(Round(x),Round(y)); for (int i=0; i<numsteps; i++) { x += xinc; y += yinc; ColorPixel(Round(x),Round(y)); } } Q: For each step, how many floating point operations are there? A: 4 Q: For each step, how many integer operations are there? A: 2
  • 25. Suppose we want to draw a line starting at pixel (2,3) and ending at pixel (12,8). What are the values of the variables x and y at each timestep? What are the pixels colored, according to the DDA algorithm? numsteps = 12 – 2 = 10 xinc = 10/10 = 1.0 yinc = 5/10 = 0.5 t x y R(x) R(y) 0 2 3 2 3 1 3 3.5 3 4 2 4 4 4 4 3 5 4.5 5 5 4 6 5 6 5 5 7 5.5 7 6 6 8 6 8 6 7 9 6.5 9 7 8 10 7 10 7 9 11 7.5 11 8 10 12 8 12 8
  • 26. It is an efficient raster line generation algorithm. It can be adapted to display circles and other curves. The algorithm After plotting a pixel position (xk, yk) , what is the next pixel to plot? Consider lines with positive slope.
  • 27. For a positive slope, 0 < m < 1 and line is starting from left to right. After plotting a pixel position (xk, yk) we have two choices for next pixel: (xk +1, yk) (xk +1, yk+1)
  • 28. For a positive slope, 0 < m < 1 and line is starting from left to right. After plotting a pixel position (xk, yk) we have two choices for next pixel: (xk +1, yk) (xk +1, yk+1)
  • 29. At position xk +1, we pay attention to the intersection of the vertical pixel and the mathematical line path.
  • 30. At position xk +1, we label vertical pixel separations from the mathematical line path as dlower , dupper.
  • 31. The y coordinate on the mathematical line at xk+1 is calculated as y = m(xk +1)+ b then dlower = y − yk = m (xk +1) + b − yk and dupper =(yk +1) − y = yk +1− m(xk +1)− b
  • 32. To determine which of the two pixels is closest to the line path, we set an efficient test based on the difference between the two pixel separations dlower - dupper = 2m (xk +1) − 2yk + 2b - 1 = 2 (Δy / Δx) (xk +1) − 2yk + 2b - 1 Consider a decision parameter pk such that pk = Δx (dlower - dupper ) = 2Δy.xk − 2Δx.yk + c where c = 2Δy + Δx(2b −1)
  • 33. Since Δx > 0, Comparing (dlower and dupper ), would tell which pixel is closer to the line path; is it yk or yk + 1 If (dlower < dupper ) Then pk is negative Hence plot lower pixel. Otherwise Plot the upper pixel.
  • 34. We can obtain the values of successive decision parameter as follows: pk = 2Δy.xk − 2Δx.yk + c pk+1=2Δy.xk+1−2Δx.yk+1+c Subtracting these two equations pk+1− pk = 2Δy (xk+1 − xk) − 2Δx ( yk+1 − yk) But xk+1 − xk = 1, Therefore pk+1 = pk +2Δy − 2Δx (yk+1 − yk)
  • 35. ( yk+1 − yk) is either 0 or 1, depending on the sign of pk (plotting lower or upper pixel). The recursive calculation of pk is performed at integer x position, starting at the left endpoint. p0 can be evaluated as: p0 = 2Δy − Δx
  • 36. Input the two line end points and store the left end point in (x0 , y0 ). 2. Load (x0 , y0 ) into the frame buffer; that is, plot the first point. 3. Calculate the constants Δx, Δy, 2Δy, and 2Δy − 2Δx, and obtain the starting value for the decision parameter as 1. p0 = 2Δy − Δx 4. At each xk along the line, starting at k = 0 , perform the following test: If pk < 0,the next point to plot is (xk +1, yk and pk+1=pk+2Δy Otherwise, the next point to plot is (xk +1, yk +1) and pk+1=pk+2Δy−2Δx 5. Repeat step 4, Δx−1 times.
  • 37. The constants 2Δy and 2Δy − 2Δx are calculated once for each line to be scan converted. Hence the arithmetic involves only integer addition and subtraction of these two constants.
  • 38. To illustrate the algorithm, we digitize the line with endpoints (20,10) and (30,18). This line has slope of 0.8, with Δx = 10 Δy =8 The initial decision parameter has the value p0 = 2Δy − Δx = 6 and the increments for calculating successive decision parameters are 2 Δy = 16 2 Δy - 2 Δx = -4
  • 39. We plot the initial point (x0 , y0)=(20,10) and determine successive pixel positions along the line path from the decision parameter as K pk (xk +1, yk +1) K pk (xk +1, yk +1) 0 6 (21,11) 5 6 (26,15) 1 2 (22,12) 6 2 (27,16) 2 -2 (23,12) 7 -2 (28,16) 3 14 (24,13) 8 14 (29,17) 4 10 (25,14) 9 10 (30,18)
  • 40. A circle is defined as the set of points that are all at a given distance r from a center point (xc, yc). For any circle point (x, y), this distance is expressed by the Equation (x − xc)2 + (y − yc)2 = r 2 We calculate the points by stepping along the x-axis in unit steps from xc-r to xc+r and calculate y values as
  • 41. There are some problems with this approach: 1. Considerable computation at each step. 2. Non-uniform spacing between plotted pixels as in this Figure.
  • 42. Problem 2 can be removed using the polar form: x = xc + r cos θ y = yc + r sin θ Using a fixed angular step size, a circle is plotted with equally spaced points along the circumference.
  • 43. Problem 1 can be overcome by considering the symmetry of circles as in Figure. But it still requires a good deal of computation time. Efficient Solutions Midpoint Circle Algorithm
  • 44. To apply the midpoint method, we define a circle function: Any point (x,y) on the boundary of the circle with radius r satisfies the equation fcircle(x, y)= 0.
  • 45. If the points is in the interior of the circle, the circle function is negative. If the point is outside the circle, the circle function is positive. To summarize, the relative position of any point (x,y) can be determined by checking the sign of the circle function:
  • 46. The circle function tests in (3) are performed for the mid positions between pixels near the circle path at each sampling step. Thus, the circle function is the decision parameter in the midpoint algorithm, and we can set up incremental calculations for this function as we did in the line algorithm.
  • 47. This Figure shows the midpoint between the two candidate pixels at sampling position xk +1. Assuming we have just plotted the pixel at (xk , yk), we next need to determine whether the pixel at position (xk +1, yk) or the one at position (xk +1, yk −1) is closer to the circle.
  • 48. Our decision parameter is the circle function (2) evaluated at the midpoint between these two pixels:
  • 49. If pk < 0, this midpoint is inside the circle and the pixel on scan line yk is closer to the circle boundary. Otherwise, the midpoint is outside or on the circle boundary, and we select the pixel on scan line yk −1. Successive decision parameters are obtained using incremental calculations.
  • 50. We obtain a recursive expression for the next decision parameter by evaluating the circle function at sampling position xk+1 +1 = xk + 2 where yk+1 is either yk or yk-1,depending on the sign of pk.
  • 51. Increments for obtaining pk+1 are either : 2xk+1 +1 (if pk is negative) or 2xk+1 +1− 2yk+1 (if pk is positive) Evaluation of the terms 2xk+1 and 2yk+1 can also be done incrementally as:
  • 52. At the start position (0, r), these two terms (2x, 2y) have the values 0 and 2r, respectively. Each successive value is obtained by adding 2 to the previous value of 2x and subtracting 2 from the previous value of 2y.
  • 53. The initial decision parameter is obtained by evaluating the circle function at the start position (x0 , y0)=(0, r):
  • 54. If the radius r is specified as an integer, we can simply round p0 to since all increments are integers.
  • 55. As in Bresenham’s line algorithm, the midpoint method calculates pixel positions along the circumference of a circle using integer additions and subtractions, assuming that the circle parameters are specified in screen coordinates.
  • 56.
  • 57. Given a circle radius r = 10, we demonstrate the midpoint circle algorithm by determining positions along the circle octant in the first quadrant from x = 0 to x = y . The initial value of the decision parameter is
  • 58. For the circle centered on the coordinate origin, the initial point is (x0 , y0) =(0,10), and initial increment terms for calculating the decision parameters are Successive decision parameter values and positions along the circle path are calculated using the midpoint method as shown in the table.
  • 59.
  • 60. Ellipse equations are greatly simplified if the major and minor axes are oriented to align with the coordinate axes. In Fig. 3-22, we show an ellipse in “standard position” with major and minor axes oriented parallel to the x and y axes. Parameter rx for this example labels the semimajor axis, and parameter ry labels the semiminor axis.
  • 61. The equation for the ellipse shown in Fig. 3-22 can be written in terms of the ellipse center coordinates and parameters rx and ry as
  • 62. Using polar coordinates r and θ, we can also describe the ellipse in standard position with the parametric equations :
  • 63. The midpoint ellipse method is applied throughout the first quadrant in two parts. Figure 3-25 shows the division of the first quadrant according to the slope of an ellipse with rx < ry.
  • 64. Regions 1 and 2 (Fig. 3-25) can be processed in various ways. We can start at position (0, ry) and step clockwise along the elliptical path in the first quadrant, shifting from unit steps in x to unit steps in y when the slope becomes less than −1.0. Alternatively, we could start at (rx, 0) and select points in a counterclockwise order, shifting from unit steps in y to unit steps in x when the slope becomes greater than −1.0.
  • 65. We define an ellipse function from Eq. 3-37 with (xc , yc) = (0, 0) as: which has the following properties:
  • 66. Starting at (0, ry), we take unit steps in the x direction until we reach the boundary between region 1 and region 2 (Fig. 3-25). Then we switch to unit steps in the y direction over the remainder of the curve in the first quadrant. At each step we need to test the value of the slope of the curve.
  • 67. The ellipse slope is calculated from Eq. 3-39 as At the boundary between region 1 and region 2, dy/dx = −1.0 and Therefore, we move out of region 1 whenever
  • 68. Figure 3-26 shows the midpoint between the two candidate pixels at sampling position xk +1 in the first region. Assuming position (xk , yk) has been selected in the previous step, we determine the next position along the ellipse path by evaluating the decision parameter (that is, the ellipse function 3-39) at this midpoint:
  • 69. If p1k < 0, the midpoint is inside the ellipse and the pixel on scan line yk is closer to the ellipse boundary. Otherwise, the mid position is outside or on the ellipse boundary, and we select the pixel on scan line yk − 1.
  • 70. At the next sampling position (xk+1 + 1 = xk + 2), the decision parameter for region 1 is evaluated as
  • 71. Decision parameters are incremented by the following amounts:
  • 72. At the initial position (0, ry), these two terms evaluate to : As x and y are incremented, updated values are obtained by adding 2r 2y to the current value of the increment term in Eq. 3-45 and subtracting 2r 2x from the current value of the increment term in Eq. 3-46. The updated increment values are compared at each step, and we move from region 1 to region 2 when condition 3-42 is satisfied.
  • 73. In region 1, the initial value of the decision parameter is obtained by evaluating the ellipse function at the start position (x0, y0) = (0, ry):
  • 74. Over region 2, we sample at unit intervals in the negative y direction, and the midpoint is now taken between horizontal pixels at each step (Fig. 3-27). For this region, the decision parameter is evaluated as
  • 75. If p2k > 0, the midposition is outside the ellipse boundary, and we select the pixel at xk. If p2k <= 0, the midpoint is inside or on the ellipse boundary, and we select pixel position xk+1.
  • 76. To determine the relationship between successive decision parameters in region 2,we evaluate the ellipse function at the next sampling step yk+1 −1 = yk −2:
  • 77. When we enter region 2, the initial position (x0, y0) is taken as the last position selected in region 1 and the initial decision parameter in region 2 is then
  • 78.
  • 79.
  • 80. Given input ellipse parameters rx =8 and ry = 6, we illustrate the steps in the midpoint ellipse algorithm by determining raster positions along the ellipse path in the first quadrant. Initial values and increments for the decision parameter calculations are
  • 81. For region 1, the initial point for the ellipse centered on the origin is (x0, y0) = (0, 6), and the initial decision parameter value is Successive midpoint decision parameter values and the pixel positions along the ellipse are listed in the following table.
  • 82. For region 1, the initial point for the ellipse centered on the origin is (x0, y0) = (0, 6), and the initial decision parameter value is Successive midpoint decision parameter values and the pixel positions along the ellipse are listed in the following table.
  • 83.
  • 84. We now move out of region 1, since 2r 2 y x > 2r 2 x y. For region 2, the initial point is (x0, y0) = (7, 3) and the initial decision parameter is
  • 85. The remaining positions along the ellipse path in the first quadrant are then calculated as
  • 86. A plot of the calculated positions for the ellipse within the first quadrant is shown bellow:
  • 87. A standard output primitive in general graphics packages is a solidcolor or patterned polygon area. There are two basic approaches to area filling on raster systems: 1. The scan-line approach Determine the overlap intervals for scan lines that cross the area. is typically used in general graphics packages to fill polygons, circles, ellipses 2. Filling approaches start from a given interior position and paint outward from this point until we encounter the specified boundary conditions. useful with more complex boundaries and in interactive painting systems.
  • 88. Scan-Line Fill Algorithm: 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, and the corresponding frame-buffer positions between each intersection pair are set to the specified fill color.
  • 89.
  • 90. Calculations performed in scan-conversion and other graphics algorithms typically take advantage of various coherence properties of a scene that is to be displayed. Coherence is simply that the properties of one part of a scene are related in some way to other parts of the scene so that the relationship can be used to reduce processing. Coherence methods often involve incremental calculations applied along a single scan line or between successive scan lines.
  • 91. Area-filling algorithms and other graphics processes often need to identify interior regions of objects. To identify interior regions of an object graphics packages normally use either: 1. 2. Odd-Even rule Nonzero winding number rule
  • 92. Odd-Even rule (Odd Parity Rule, Even-Odd Rule): Draw a line from any position P to a distant point outside the co ordinate extents of the object and counting the number of edge crossings along the line. If the number of polygon edges crossed by this line is odd then P is an interior point. Else P is an exterior point
  • 93. Nonzero Winding Number Rule : Counts the number of times the polygon edges wind around a particular point in the counterclockwise direction. This count is called the winding number, and the interior points of a twodimensional object are defined to be those that have a nonzero value for the winding number. 1. Initializing the winding number to Zero. 2. Imagine a line drawn from any position P to a distant point beyond the coordinate extents of the object.
  • 94. Nonzero Winding Number Rule : 3. Count the number of edges that cross the line in each direction. We add 1 to the winding number every time we intersect a polygon edge that crosses the line from right to left, and we subtract 1 every time we intersect an edge that crosses from left to right. 4. If the winding number is nonzero, then P is defined to be an interior point Else P is taken to be an exterior point.
  • 95.
  • 96. Start at a point inside a region and paint the interior outward toward the boundary. If the boundary is specified in a single color, the fill algorithm proceeds outward pixel by pixel until the boundary color is encountered. It is useful in interactive painting packages, where interior points are easily selected. The inputs of the this algorithm are: • Coordinates of the interior point (x, y) • Fill Color • Boundary Color
  • 97. Starting from (x, y), the algorithm tests neighboring pixels to determine whether they are of the boundary color.  If not, they are painted with the fill color, and their neighbors are tested. This process continues until all pixels up to the boundary have been tested.  There are two methods for proceeding to neighboring pixels from the current test position:
  • 98. 1. The 4-connected method. 2. The 8-connected method.
  • 99. void boundaryFill4 (int x, int y, int fillColor, int borderColor) { int interiorColor; /* set current color to fillColor, then perform following operations. */ } interiorColor =getPixel (x, y); if ( (interiorColor != borderColor) && (interiorColor != fillColor) ) { setPixel (x, y); // set color of pixel to fillColor boundaryFill4 (x + 1, y, fillColor, borderColor); boundaryFill4 (x - 1, y, fillColor, borderColor); boundaryFill4 (x, y + 1, fillColor, borderColor); boundaryFill4 (x, y - 1, fillColor, borderColor); }
  • 100.
  • 101. 4-connected and 8-connected methods involve heavy recursion which may consume memory and time. More efficient methods are used. These methods fill horizontal pixel spans across scan line. This called a Pixel Span method. We need only stack a beginning position for each horizontal pixel span, instead of stacking all unprocessed neighboring positions around the current position, where spans are defined as the contiguous horizontal string of positions.
  • 102. Start from the initial interior point, then fill in the contiguous span of pixels on this starting scan line. Then we locate and stack starting positions for spans on the adjacent scan lines, where spans are defined as the contiguous horizontal string of positions bounded by pixels displayed in the area border color. At each subsequent step, we unstack the next start position and repeat the process. An example of how pixel spans could be filled using this approach is illustrated for the 4-connected fill region in the following figure.
  • 103.
  • 104.
  • 105. Sometimes we want to fill in (or recolor) an area that is not defined within a single color boundary. We can paint such areas by replacing a specified interior color instead of searching for a boundary color value. This approach is called a flood-fill algorithm.
  • 106.  We start from a specified interior point (x, y) and reassign all pixel values that are currently set to a given interior color with the desired fill color.  If the area we want to paint has more than one interior color, we can first reassign pixel values so that all interior points have the same color. Using either a 4-connected or 8-connected approach, we then step through pixel positions until all interior points have been repainted.
  • 107. void floodFill4 (int x, int y, int fillColor, int interiorColor) { int color; /* set current color to fillColor, then perform following operations. */ getPixel (x, y, color); if (color = interiorColor) { setPixel (x, y); // set color of pixel to fillColor floodFill4 (x + 1, y, fillColor, interiorColor); floodFill4 (x - 1, y, fillColor, interiorColor); floodFill4 (x, y + 1, fillColor, interiorColor); floodFill4 (x, y - 1, fillColor, interiorColor); } }
  • 108. Flood-Fill Algorithm (cont.) void floodFill4 (int x, int y, int fillColor, int interiorColor) { int color; /* set current color to fillColor, then perform following operations. */ getPixel (x, y, color); if (color = interiorColor) { setPixel (x, y); // set color of pixel to fillColor floodFill4 (x + 1, y, fillColor, interiorColor); floodFill4 (x - 1, y, fillColor, interiorColor); floodFill4 (x, y + 1, fillColor, interiorColor); floodFill4 (x, y - 1, fillColor, interiorColor); } } CS 380