You are on page 1of 6

1.

A (3,2) & B (11,6)

Start point 1,1=(3,2)end point 2,2=(11,6)


=21=113=8 and =21=62=4
Due to : || >|| = |8|>|4| = , then step = |dx | = 8
_= /=8/8=1
_= /=4/8=0,5
1st iteration: ,=(3, 2)
+_= 3+1=4
+_= 2+0,5=2,5
next coordinate: (,)=(4, 2,5)
round of (4, 2,5) (4, 3)on screen
2st iteration: ,=(4, 2,5)
+_= 4+1=5
+_= 2,5+0,5=3
next coordinate: (,)=(5,3)
round of (5,3) (5, 3)on screen
3st iteration: ,=(5,3)
+_= 5+1=6
+_= 3+0,5=3,5
next coordinate: (,)=(6, 3,5)
round of (6, 3,5) (6, 4)on screen
4st iteration: ,=(6, 3,5)
+_= 6+1=7
+_= 3,5+0,5=4
next coordinate: (,)=(7, 4)
round of (7, 4) (7, 4)on screen
5st iteration: ,=(7, 4)
+_= 7+1=8
+_= 4+0,5=4,5
next coordinate: (,)=(8, 4,5)
round of (8, 4,5) (8, 5)on screen
6st iteration: ,=(8, 4,5)
+_= 8+1=9
+_= 4,5+0,5=5
next coordinate: (,)=(9, 5)
round of (9, 5) (9, 5)on screen
7st iteration: ,=(9, 5)
+_= 9+1=10
+_= 5+0,5=5,5
next coordinate: (,)=(10, 5,5)
round of (10, 5,5) (10, 6)on screen
8st iteration: ,=(10, 5,5)
+_= 10+1=11
+_= 5,5+0,5=6
next coordinate: (,)=(11, 6)
round of (11, 6) (11, 6)on screen

Because =2, then iteration stopped


Point of line generation as following : (3,2), (4,3), (5,3), (6,4), (7,4),
(8,5), (9,5), (10,6), (11,6),

2. A (3,2) & B (7,7)


Start point 1,1=(3,2)end point 2,2=(7,7)
=21=73=4 and =21=72=5
Due to : || >|| = |4|>|5| = , then step = |dy| = 5
_= /=4/5=0,8
_= /=5/5=1
1st iteration: ,=(3, 2)
+_= 3+0,8=3,8
+_= 2+1=3
next coordinate: (,)=(3,8, 3)
round of (3,8, 3) (4, 3)on screen
2st iteration: ,=(3,8, 3)
+_= 3,8+0,8=4,6
+_= 3+1=4
next coordinate: (,)=(4,6, 4)
round of (4,6, 4) (5, 4)on screen
3st iteration: ,=(4,6, 4)
+_= 4,6+0,8=5,4
+_= 4+1=5
next coordinate: (,)=(5,4, 5)
round of (5,4, 5) (5, 5)on screen
4st iteration: ,=(5,4, 5)
+_= 5,4+0,8=6,2
+_= 5+1=6
next coordinate: (,)=(6,2, 6)
round of (6,2, 6) (6, 6)on screen
5st iteration: ,=(6,2, 6)
+_= 6,2+0,8=7
+_= 6+1=7
next coordinate: (,)=(7, 7)
round of (7, 7) (7, 7)on screen
Because =2, then iteration stopped
Point of line generation as following : (3, 2), (4,3), (5,4), (5,5), (6,6),
(7,7)

3. A (-5, 10) & B (0, 0)


Start point 1,1=(-5, 10)end point 2,2=(0,0)
=21=0(-5)=5 and =21=010=-10
Due to : || >|| = |5|>|-10| = , then step = |dy| = 10
_= /=5/10=0,5
_= /=-10/10=-1
1st iteration: ,=(-5, 10)
+_= -5+0,5=-4,5
+_= 10+(-1)=9
next coordinate: (,)=(-4,5, 9)
round of (-4,5, 9) (-5, 9)on screen
2st iteration: ,=(-4,5, 9)
+_= -4,5+0,5=-4
+_= 9+(-1)=8
next coordinate: (,)=(-4, 8)
round of (-4, 8) (-4, 8)on screen
3st iteration: ,=(-4, 8)
+_= -4+0,5=-3,5
+_= 8+(-1)=7
next coordinate: (,)=(-3,5, 7)
round of (-3,5, 7) (-4, 7)on screen
4st iteration: ,=(-3,5, 7)
+_= -3,5+0,5=-3
+_= 7+(-1)=6
next coordinate: (,)=(-3, 6)
round of (-3, 6) (-3, 6)on screen
5st iteration: ,=(-3, 6)
+_= -3+0,5=-2,5
+_= 6+(-1)=5
next coordinate: (,)=(-2,5, 5)
round of (-2,5, 5) (-3, 5)on screen
6st iteration: ,=(-2,5, 5)
+_= -2,5+0,5=-2
+_= 5+(-1)=4
next coordinate: (,)=( -2, 4)
round of (-2, 4) (-2, 4)on screen
7st iteration: ,=(-2, 4)
+_= -2+0,5=-1,5
+_= 4+(-1)=3
next coordinate: (,)=( -1,5, 3)
round of (-1,5, 3) (-2, 3)on screen
8st iteration: ,=( -1,5, 3)
+_= -1,5+0,5=-1
+_= 3+(-1)=2
next coordinate: (,)=(-1, 2)
round of (-1, 2) (-1, 2)on screen
9st iteration: ,=(-1, 2)
+_= -1+0,5=-0,5
+_= 2+(-1)=1
next coordinate: (,)=(-0,5, 1)
round of (-0,5, 1) (-1, 1)on screen
10st iteration: ,=(-0,5, 1)
+_= -0,5+0,5=0
+_= 11+(-1)=1
next coordinate: (,)=(0,0)
round of (0,0) (0,0)on screen
Because =2, then iteration stopped
Point of line generation as following : (-5, 10), (-5, 9), (-4, 8), (-4, 7),
(-3, 6), (-3, 5), (-2, 4) (-2, 3) (-1, 2) (-1, 1) (0,0)

4. A (-5, 4) & B (0, 0)


Start point 1,1=(-5, 4)end point 2,2=(0,0)
=21=0(-5)=5 and =21=04=-4
Due to : || >|| = |5|>|-4| = , then step = |dx| = 5
_= /=5/5=1
_= /=-4/5=-0,8
1st iteration: ,=(-5, 4)
+_= -5+1=-4
+_= 4+(-0,8)=3,2
next coordinate: (,)=(-4 , 3,2)
round of (-4, 3,2) (-4 , 3)on screen
2st iteration: ,=(-4, 3,2)
+_= -4+1=-3
+_= 3,2+(-0,8)=2,4
next coordinate: (,)=(-3 , 2,4)
round of (-3 , 2,4) (-3 , 2)on screen
3st iteration: ,=(-3 , 2,4)
+_= -3+1=-2
+_= 2,4+(-0,8)=1,6
next coordinate: (,)=(-2 , 1,6)
round of (-2, 1,6) (-2 , 2)on screen
4st iteration: ,=(-2, 1,6)
+_= -2+1=-1
+_= 1,6+(-0,8)=0,8
next coordinate: (,)=(-1 , 0,8)
round of (-1 , 0,8) (-1 , 1)on screen
1st iteration: ,=(-1 , 0,8)
+_= -1+1=0
+_= 0,8+(-0,8)=0
next coordinate: (,)=(0,0)
round of (0,0) (0,0)on screen
Because =2, then iteration stopped
Point of line generation as following : (-5, 4), (-4, 3), (-3, 2), (-2, 2), (-
1, 1), (0, 0)

You might also like