COMPUTER GRAPHICS DDA LINE DRAWING ALGORITHM

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
bringing all of you welcome to our session so in this session let us learn the line point algorithm dee dee and [Music] Delia means digital differential analyzer 3 in our computer graphics the screen consists of all the pixels for screen is neighborhood functional pixels so each pixel can be represented by using y x comma 1 every pixel can be represented as X comma Y so here we will have the first point a starting point and ending point and this algorithm is used to find all the intermediate points that means the pixels in so we have this algorithm is used to find all the intermediate pixels in between the starting point and ending point now as you know the line formula is y is equal to MX plus C here M is nothing but a slope which is y2 minus y1 by next 2 minus X 1 the slope is 4 x1 y1 x2 while so let us have a general formula so y2 can be replaced with YK plus 1 X 2 can be replaced with XK plus 1 y 1 is Z plus why kx1 use emplacement XK so if the two points are X K comma Y K and the next point is XK plus one comma YK plus 1 then the slope is YK plus 1 minus YK by XK plus 1 minus X K now let us the other point so M is equal to YK plus 1 minus YK by XK plus 1 minus XK where x xk YK are the present points and xk plus 1 and y k plus 1 on the next coordinate points so we have to find all the intermediate points from starting point to any point so we will start our algorithm from starting point so we will find the next coordinate and then next coordinate and then next coordinate so we will continue the same procedure till we reach the end point so whenever we get the end point x comma y then we will stop the algorithm here in this DDA algorithm we have to remember the three cases case 1 first we have to find out the slope in between starting point and ending point M is equal to slow between starting point and end point now depends on the slope we have the thin cases case 1 M is less than 1 case 2 young greater than 1 case 3 M is equal to 1 see you know temporal graphics as we say the the screen changes of pixels so complete screen consists of pixels collection of pixels if M less than 1 then the x coordinate the x coordinate will change in unit intervals if younger than 1 y coordinate changes in unit intervals if M is equal to 1 y x and y changes in unit in reverse so obviously if the screen is cultural pixels it will be in unit intervals so here this indicates XK plus 1 is equal to XK plus 1 here Y is equal to del Sol y k plus 1 next to point next coordinate is changes in unit and also YK plus 1 is equal to YK plus 1 here XK plus 1 is equal to XK plus 1 YK plus 1 is equal to YK plus 1 so we should be remember that here k plus 1 is a suffix here XK plus 1 XK plus 1 is different from XK plus 1 here yes it is a unit intervals both are equal and what about the point so we had XK plus 1 and we need to find out the YK plus 1 for this we know the slope M is equal to YK plus 1 minus YK by XK plus 1 minus XK as this becomes 1 because the XK plus 1 is equal to XK plus 1 so that XK plus 1 minus XK so it's K XK cancelled 1 so we will get M is equal to YK minus m is equal to y plus 1 minus YK by 1 from this equation you can get y k plus 1 is equal to YK this young so if slope is less than 1 X will be moving in unit intervals Y will be moving in slope difference here similarly YK plus 4 this way your y-coordinate is moving in unit interval so let us calculate the x coordinate so YK plus 1 minus y by the XK plus 1 minus XK so here my losing a this complete equation becomes one so this equation can be written as M is equal to 1 by XK plus 1 minus XK so XK plus 1 minus XK is equal to 1 by M from this XK plus 1 is equal to XK plus 1 by M so YK y coordinate changes in unit intervals and yexif ordinate changes with 1 by M of x coordinate previous coordinate here the x coordinate will be unit interval and y coordinate will be changes in slope here the quadrants are executes less 1 YK minus 1 so based upon these formulas we will find out all the intermediate points so once again let us look so depends upon the slope the slope between starting point and ending point if M is less than 1 the X moves in unit intervals if young is greater than 1 why you see unit intervals and if M is equal to 1 both the x and y coordinates moving unit intervals so here the X moves even a territorial Smith the next quartet will be the previous coordinate plus one unit interval that means x coordinate previous coordinate plus one here we have considered XK and YK as a present coordinate XK plus one comma YK plus 1 as a next coordinate so next coordinate will be XK plus 1 will be previous coordinate plus one unit intervals similarly the next two y-coordinate will be present to y-coordinate plus 1 unit intervals so from this formula we have M is equal to YK plus 1 minus YK by XK plus 1 minus XK here in this case M less than 1 we know that XK plus 1 minus XK that means the next coordinate minus the present coordinate this always will be 1 because here we can substitute XK plus 1 minus XK so this can be written as XK plus 1 minus XK so XK X will get canceled so 1 so from that we will get M is equal to YK plus 1 minus YK by 1 from this equation we can have this next coordinate YK plus 1 is equal to YK plus M so our next y coordinate will move with the difference of slope so next y coordinate will be present y coordinate plus the slope coming to this case Y we'll move on unit intervals that means next y coordinate will be present y coordinate plus one unit interval sub 1 and from this equation M is equal to YK plus 1 minus YK by XK plus 1 minus XK here by using unit critical so here numerator will become 1 so 1 by XK minus XK plus 1 minus XK from this equation we can find out this XK plus 1 next coordinate so XK plus 1 is equal to XK plus 1 by slope in this case both will move in unit intervals so XK plus 1 next coordinate will be 1 added to the previous coordinate y YK plus 1 next coordinate will be 1 added to the present y-coordinate so from this formulas from these three cases we will calculate all the intermediate points in between this given starting point and ending point now let us have a brief look once again after calculating the slope M if M less than one yex changes in unit intervals if M greater than one X moves with deviation Y moves in unity towards XK plus one comma YK plus 1 is equal to XK plus 1 by M comma YK place here if Young is equal to 1 X & Y moves in unit intervals that means XK plus 1 comma y plus 1 is equal to XK plus 1 comma Y k plus 1 so for this we have to calculate first we have to calculate the slope between starting point and ending point if you have mu is less than 1 X changes in unit intervals so there will be some deviation on Y moves so we have to calculate the next part of YK plus 1 that is equal to YK plus m and shown in the derivation and if M is named greater than one that means a slope is greater than one then the X moves with some deviation and why lose your unit intervals so that we have to find the next coordinate of X so XK plus one is equal to XK plus 1 by M comma y k plus 1 because Y moves in unit intervals and if M is equal to 1 the x and y move both will move in unit intervals so XK plus 1 comma Y k plus 1 is equal to XK plus 1 YK plus 1 so let us have an example now let us see one example so we have to find all the intermediate points in between 0 comma 0 and 4 comma 5 so the starting point is 0 0 and the ending point is 4 comma 5 so that we have to find out all the intermediate x and y coordinates so first we have to calculate slope 12 is equal to 5 minus 0 by 4 minus 0 there is equal to 5 by 4 which is greater than 1 so here if M is greater than 1 while losing unit intervals yex losing XK plus 1 by M so the XK plus 1 comma Y k plus 1 is equal to XK plus 1 by M come on why k plus 1 XK plus 1 is equal to XK plus 1 radium why k plus 1 is equal to YK plus 1 so for this we have to calculate 1 by M we have to carry weight 1 by M so here M is equal to 5 by 4 so 1 by M is equal to 4 by 5 it is point 8 now let us see x coordinate y coordinate X plotted on the graph y plotted on the graph and the coordinate axis X comma Y so I have to start from 0 comma 0 so x is 0 Y is 0 so plot the zero point y is 0 point the first point is 0 comma 0 coming to the next point so here M is better than 1 y using unit interval so y becomes 1 and he actually comes the world coordinate plus 1 by M that means 0 plus point 8 so it will be point none pixels so we can say the pixel number 1 or pixel number 2 but we can't say the pixel number 5 gate pixel 0.5 0.6 pixel so decimal path you must be from them so here we have to round this decimal so if the decimal part is greater than or equal to 0.5 then we have to apply seal function C ceiling function ceiling function means we have to round to the upper value if it is less than 5 we have to apply flooring function right function X lower value so just like we can remember to like ceiling and flooring ceiling will be in the top so we have to round up to the upper boundary floor floor means of showing the bottom one so we have to round up to the lower boundary so the actual value is point eight but we're talking in the graph we have to round up so it is greater than point five we have to round to the upper boundary a next point will be 1 comma 1 now the next point will be value moves in the unit interval so Y becomes 2 X moves with 1 by M difference 0.8 plus point 8 so 1 point 6 so Y plotted when we do and export it will be around it so it is also greater than point five so we have to round to the upper value so one point six becomes to the next point will be 2 comma 2 again why you seen unit intervals so thing Y becomes c x x coordinates with naid point 8 so 1 point 6 plus 0.8 2 point 4 so 3 will be dotted in the y and coming to the X dot here the value of baseball value is less than point five so we have to apply the flooring function so it will be rounded to lower boundary so the value the point plotted is 2 comma 3 again the Y value is unit intervals x value adding 1 by M by 2 point 4 plus point a it becomes pin point 2 and we have to round up Y point will be plotted as this 4 will be plotted in the way and 3 point 2 here also the number function will have that way the other function it is less than point five so we have to apply the flooring function that means belong to the lower Bogut that means three the next point will be 3 comma 4 so once again why is moving into the unity dolls well Y becomes 5 and the X is adding 1 by M that means 4 so obviously it is around up so 4 is plotted on the x 5 is plotted on line the point will be 4 comma 5 which is the end point so here if you have to stop this DDA algorithm so the points of your line are zero comma zero one color one to convert to 2 comma 3 3 to 4 4 comma 5 so these are the intermediate points in between 0 0 and 4 5 the things these are all done for pixels in between 0 0 pixel n45 pixel and the main disadvantage of this algorithm is we have to apply the rounding function because we can't plot the decimal part on the screen so we have to round up to a lower boundary or upper boundary that depends upon the decimal value so that is a main draw baking soda shop here and we will see the bresenhem's line drawing algorithm which avoids the drawback of vda algorithm that means a bounding function in the next session thank
Info
Channel: Sundeep Saradhi Kanthety
Views: 320,706
Rating: 4.8333888 out of 5
Keywords: computer graphics, dda, line drawing algorithm, output primitiives, graphics, sundeep, saradhi, kanthety, raster, random, digital differential analyzer, dda algorithm, line algorithm, graphic design college
Id: m5YbqpL7BIY
Channel Id: undefined
Length: 23min 34sec (1414 seconds)
Published: Wed Dec 28 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.