 Hello everyone, my name is Mr. Sandesh Pare, I am currently working as an assistant professor in the department of computer science and engineering at Vulture Institute of Technology, Singapore. In this video, I am going to explain the DDA algorithm. DDA algorithm is called short term of the digital differential analyzer. So, first we will see what will be the learning outcome after watching this video. At this end of the session, student will be able to understand and explain and to implement the DDA algorithm. It means the detailed explanation of the DDA algorithm is going to be covered in this session. So, let us start for the line drawing algorithm. First of all, we will discuss about the what is the necessary properties of the target draw line. So, one of the first point in that starting point, how we can specify the point that is the initial point of the target line, that is by the coordinates. X and Y coordinates of the start point will indicate the starting point on the line and same for the end point also. Means we can consider the X1 and Y1 coordinate value of the start point and X2, Y2 indicate the coordinate value of the end point of a desired line. And another one necessary characteristic of a desired line is its straightness. The line should be in proper straight way from the start point to the end point. And next is there should be equal brightness along the length of that targeted line. It should not happen that brightness should be dull or otherwise more darkened and brightened at certain various dots. So, it should be equally bright from the starting point to the end point. And it should not be dependent on the length of the line and orientation of the line. And next is the rapidity. It means the desired line should be drawn very fast and it should be direction less obviously. Isn't it? So, there is one concept it is called as the rasterization. What happens in this? See in the diagram the line is going from various pixels. So, at that time you can observe that on one row it may visit the multiple pixels. It means what happens in various spatial cases it happens that line is going through the perfectly between the pixels. Most of the time what happens line may visit two or three pixels attached to each other and passes through it. So, at that time all that pixels should be marked on the screen. As I told you earlier that very spatial cases are there in which it is not happening. It means when you are drawing the vertical line otherwise horizontal line otherwise diagonal line at that time the line passes through the pixel very perfectly. So, we will see digital differential analysis problem statement means what it is actually. So, in the plane we are given two points. As you see x0, y0 is the starting point of the line and x1, y1 indicate the end point of the line and in that case we are going to join these lines but not directly. We have to go through the intermediate points and we have to calculate that coordinates of the intermediate points in this DDA algorithm. So, as in the introductory part I said you have to mark that pixels and that method to mark the pixel is the put pixel method where we can give the coordinates of that point and it have three parameters that is x, y, coordinates and the color of the pixel. So, for example, we can see that if I given 0, 0 and 5, 5 are the values of the end point of a line then it will be a diagonal. So, that is why at each time you can see that it is going diagonally means at that time it will visit the 1, 1, 2, 3, 3 and 4, 4 and it will pass through these pixels and visit the targeted end point and there is also one more example that is 0, 2, 0, 6. So, it will pass through a pixels that is 0, 3, 0, 4, 0, 5. So, it will be a horizontal line, isn't it? So, there is one more question for you guys that is what are the desired characteristics of the targeted line? List them and explain them in detail. So, the answer of this question is there are mainly four characteristics of the target line. They are as first one is the straightness it means from the starting point to the end point, the line must be very straight and second is the brightness between these starting and end point should be very consistent. It should not be dull at one point and it should not be morbid at second level. So, it should be equally distributed brightness without considering the length and orientation of the line. And third one is the rapidity means the line should be drawn very fast mentally. And one more thing is it should be directionless. So, you can see one snippet on the screen that is the DDA algorithm. So, what is going to be happen in this function? We will see. First you can see that DX and DY values. What is DX? It is the difference between the X coordinates that is from the start point to the end point. What is the difference between the X coordinates? And DY denotes the difference between the Y coordinates of the starting point and end point. So, after that you have to calculate the steps. Whatever is the biggest difference between the X coordinates, otherwise Y coordinates, among them what is the biggest one is assigned as a length of that. And we will try as according to it. And on basis of this we can calculate the X increment value and Y increment value. Means at each step by what amount we should implement the increment in the X coordinate and what amount of the increase should happen in the Y increment. So, it should be calculated before going to the actual loop. So, at the start we will start from the X 0 Y 0 values. From the starting point that is why X values are assigned by X 0 and Y value is assigned by Y 0 1. And in the loop from the first coordinate to the last one the number of steps are there. And in the every step we will mark the XY coordinate and we will move forward by incrementing X and Y values. So, we will jump to the next pixel. So, this is the function of the DD algorithm. In this fashion we can implement this DD algorithm. So, you can see here X 0 Y 0 values are 0 0 it means the line going to be start from the 0 0 location and X 1 Y 1 value are 5 5 are there. It means the end point is having the coordinates 5 5. So, from this we can calculate the steps that is 5 is the biggest difference between the X and Y. That is why it is assigned to the steps and difference between the X coordinates and Y coordinates are again the 5 that is why DX and DY values are the 5 1. And dividing them by the length that is steps it gives the value X increment is equal to 1 and Y increment is equal to 1. That is why at every steps it means steps are 5 that is why there are 5 steps you can see it at the right table. So, 5 steps are there at each step the X and Y values are incremented by 1. By this manner you can find out the intermediate pixels and you can reach to the targeted end point. So, after all this is the DD algorithm. So, when you will execute this DD algorithm on the screen, here the value is given like 0 0 and 500 500. At that time what should be the output of the program is shown on the screen. Left top corner is considered as a 0 0 coordinate on the computer screen. Take it into consideration. It is not like our graph where it is in the first quadrant. We are always working in the second quadrant. But values are positive of X and Y. So, these are some references I use to make this video. Thank you.