Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Algorithms While (i ≤ L)
Plot (int(xnew,ynew))
Step 1:Input co-ordinates of end points
i = i+1
Point 1: (x1, y1)
}End while
Point 2: (x2, y2)
Step 7:Finish.
Step 2:Calculate Δx and Δy
Δx = x2-x1
2.1.2. Breseham’s Line Drawing
Δy = y2-y1 Algorithm (1stOctant)
(x2−x1) Δy = y2-y1
dx = 𝐿
Step 3:Initialize points and error term
(y2−y1)
dy = 𝐿
x = x1
Step 5: Initializing xnewand ynew
y = y1
xnew= x1+ 0.5 Δ𝑦 1
e = Δ𝑥 − 2
ynew = y1+ 0.5
Plot (int(xnew,ynew))
Step 4: Plotting the points
Step 6: Plotting the points
For i=0 to Δx
Initial ‘i’ to 1
Plot (int(x,y)) Plot (int(x,y))
While (e ≥ 0) While (e ≥ 0)
{ y = y+1 {
e = e -1 y = y+1
S2=Sign(y2-y1) y=y+S2
Temp= Δx End if
Δx=Δy e =e+2 Δy
Plot (x,y)
Step 7: Plotting the points Step 1:Input radius of the circle ‘r’
If (interchange = 1) 5
M=4 – r
then
Step 4: Plotting the function
x =x+S1
While (x ≤ y)
Else
{
y =y+S2
Plot (x,y)
End if
If M<0 then
e =e-2 Δx
M=M+2x+3
}End while
Else
M= M+2(x-y)+5
x = x+1 1 0 0
(x* y*) = 0 −1 0
}End while 0 0 1
−1 0 0
(x* y*) = 0 1 0
2.3. Transformations 0 0 1
2.3.1. Translation
x* = x + T1 2.3.4. Scaling
y* = y + T2 Sx 0 0
(x* y*) = 0 Sy 0
(x* y*) = (x y) + (T1 T2) 0 0 1
1 0 0
(x* y*) = 0 1 0
T1 T2 1
2.3.2. Rotation
cos θ sin θ 0
(x* y*) = − sin θ cos θ 0
0 0 1
For clockwise direction
cos θ −sin θ 0
(x* y*) = sin θ cos θ 0
0 0 1
Where θ is angle of rotation