انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة
الكلية كلية تكنولوجيا المعلومات
القسم قسم البرامجيات
المرحلة 3
أستاذ المادة توفيق عبد الخالق عباس الاسدي
13/12/2016 06:04:28
1 Digital Differential Analyzer (DDA) algorithm The Cartesian slope-intercept equation for a straight line is with m representing the slope of the line and b as they intercept. Given that the two endpoints of the segment at positions (x, y,) and (x, y), we can determine values for the slope m and y intercept b with the following calculations Algorithms for displaying straight lines are based on the line equation 3-1 and the calculations given in Eqs. 3-2 and 3-3. For any given x interval along a line, we can compute the corresponding y interval from Eq. 3-2 as 2 Similarly, we can obtain the x interval Line DDA algorithm is the simple line generation algorithm which is explained step by step here. LineDDA algorithm Step 1 ? Get the input of two end points (X0,Y0) and (X1,Y1) Step 2 ? Calculate the difference between two end points. dx = X1 - X0 dy = Y1 - Y0 Step 3 ? Based on the calculated difference in step-2, you need to identify the number of steps to put pixel. If dx > dy, then you need more steps in x coordinate; otherwise in y coordinate. if (dx > dy) then Steps = absolute(dx); else Steps = absolute(dy); Step 4 ? Calculate the increment in x coordinate and y coordinate. Xincrement = dx / (float) steps; Yincrement = dy / (float) steps; Step 5 ? Put the pixel by successfully incrementing x and y coordinates accordingly and complete the drawing of the line. X=X0, Y=Y0 For I=1 to step do Plot(X,Y,color) X=X+Xincrement Y=Y+Yincremen Square1 algorithm 3 2)X2,y( ,)X1,Y1(in square Get the input of two points Step 1 ? Call LinDDA(X1,Y1,X2,y1,color)Step 2 ? Call LinDDA(X2,Y1,X2,y2,color)Step 3 ? Call LinDDA(X2,Y2,X1,y2,color)Step 4 ? Step 5 ? Call LinDDA(X1,Y2,X1,y1,color) lgorithma 2
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
|