Name : Bhargavi Pradhan                                        Roll No.
: 22032
Class : SYBSC IT                     Subject : Computer Graphics and Animation
Sem : IV                                      Date of Performance : 00.00.0000
Practical 4. Solve the following :
a. Develop a program for DDA line drawing algorithm.
Code :
import turtle
def draw_dda_line(x1, y1, x2, y2):
  dx = abs(x2 - x1)
  dy = abs(y2 - y1)
  steps = max(dx, dy)
  dx /= steps
  dy /= steps
  x, y = x1, y1
  for _ in range(int(steps) + 1):
    turtle.setpos(round(x), round(y))
    turtle.dot()
    x += dx
    y += dy
# Example usage
x1, y1 = map(float, input("Enter the value of x1 and y1 (comma-separated):
").split(','))
x2, y2 = map(float, input("Enter the value of x2 and y2 (comma-separated):
").split(','))
turtle.speed(1)
turtle.hideturtle()
draw_dda_line(x1, y1, x2, y2)
turtle.done()
Output :