انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة
الكلية كلية العلوم للبنات
القسم قسم الحاسبات
المرحلة 3
أستاذ المادة ايلاف علي عبود
04/01/2017 10:16:59
Bresenham s Line Algorithm An accurate and efficient raster line-generating algorithm, developed by Bresenham, scan converts lines using only incremental integer calculations that can be adapted to display circles and other curves. Sampling at unit x intervals, we need to decide which of two possible pixel positions is closer to the line path at each sample step. For example, starting from the left endpoint (10,11) , we need to determine at the next sample position whether to plot the pixel at position (11, 11) or the one at (11, 12). Similarly, a negative slope-line path starting from the left endpoint at pixel position (50, 50). In this one, do we select the next pixel position as (51,50) or as (51,49)? These questions are answered with Bresenham s line algorithm by testing the sign of an integer parameter, whose value is proportional (تناسبي) to the difference between the separations of the two pixel positions from the actual line path. Example 1: Bresenham s algorithm is generalized to lines with arbitrary slope by considering the symmetry between the various octants and quadrants of the xy plane. For a line with positive slope greater than 1, we interchange the roles of the x and y directions. That is, we step along they direction in unit steps and calculate successive x values nearest the line path. Also, we could revise the program to plot pixels starting from either endpoint. If the initial position for a line with positive slope is the right endpoint, both x and y decrease as we step from right to left. For negative slopes, the procedures are similar, except that now one coordinate decreases as the other increases. Table 3.7 can be used to determine the octant of the slope. Given a line segment from (x1, y1) to (x2, y2), first reorder the points, if necessary, such that x1 ? x2, then use the table. The top row of the table reads: If ?y ? 0 and ?x ? ?y, then the slope is positive and is less than or equal 1. The octant is either 1 or, if the points had to be swapped, it is 5.
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم
|