.


:




:

































 

 

 

 





. , , . 1, , x. ( +1 -1) (.4.1.). :

, (x1,y1) (x2,y2)

Sign - , -1, 0, 1 ,

x = x1

y = y1

x = abs(x2 - x1)

y = abs(y2 - y1)

s1 = Sign (x2 - x1)

s2 = Sign (y2 - y1)

x y

if y < x then

= x

x = y

y =

= 1

Else

= 0

End if

 = 2*y - x

for i = 1 to x

Plot (x,y)

while ( =>0)

if = 1 then

x = x + s1

Else

y = y + s2

End if

 =  - 2*x

End while

if = 1 then

y = y + s2

Else

x = x + s1

End if

 =  + 2*y

Next i

Finish

.4.1. .

 

4.1. .

(0,0) (-8, -4).

x = 0

y = 0

x = 8

y = 4

s1 = -1

s2 = -1

= 0

= 0

i Plot x y
         
  (0,0)      
    -16   -1
    -8 -1 -1
  (-1,-1)      
      -2 -1
  (-2,-1)      
    -16 -2 -2
    -8 -3 -2
  (-3,2)      
      -4 -2
  (-4,2)      
    -16 -4 -3
    -8 -5 -3
  (-5,-3)      
      -6 -3
  (-6,-3)      
    -16 -6 -4
    -8 -7 -4
  (-7,-4)      
      -8 -4

 

.4.2. .

.4.2 . . 2.2 , .

.





:


: 2015-05-07; !; : 364 |


:

:

: , , , , .
==> ...

1339 - | 1232 -


© 2015-2024 lektsii.org - -

: 0.013 .