АвтоАвтоматизацияАрхитектураАстрономияАудитБиологияБухгалтерияВоенное делоГенетикаГеографияГеологияГосударствоДомДругоеЖурналистика и СМИИзобретательствоИностранные языкиИнформатикаИскусствоИсторияКомпьютерыКулинарияКультураЛексикологияЛитератураЛогикаМаркетингМатематикаМашиностроениеМедицинаМенеджментМеталлы и СваркаМеханикаМузыкаНаселениеОбразованиеОхрана безопасности жизниОхрана ТрудаПедагогикаПолитикаПравоПриборостроениеПрограммированиеПроизводствоПромышленностьПсихологияРадиоРегилияСвязьСоциологияСпортСтандартизацияСтроительствоТехнологииТорговляТуризмФизикаФизиологияФилософияФинансыХимияХозяйствоЦеннообразованиеЧерчениеЭкологияЭконометрикаЭкономикаЭлектроникаЮриспунденкция

Liang–Barsky Algorithm

Читайте также:
  1. Boundary-Fill Algorithm
  2. Bresenham's Circle Algorithm
  3. Bresenham's Line Algorithm
  4. Computers and algorithms
  5. Cyrus–Beck Algorithm
  6. Line Drawing Algorithms
  7. Scan-Line Polygon Fill Algorithm
  8. Simplest Line Drawing Algorithm
  9. Sutherland–Hodgman Algorithm
  10. Weiler–Atherton Clipping Algorithm

The Liang–Barsky algorithm [9] (named after You-Dong Liang and Brian A. Barsky) uses the parametric equation of a line and inequalities describing the range of the clipping box to determine the intersections between the line and the clipping box. With these intersections it knows which portion of the line should be drawn. This algorithm is significantly more efficient than Cohen–Sutherland.

The idea of the Liang-Barsky clipping algorithm is to do as much testing as possible before computing line intersections. Consider first the usual parametric form of a straight line:

(5.1)

A point is in the clip window, if

(5.2)

which can be expressed as the 4 inequalities

(5.3)

were

(5.4)

To compute the final line segment we must perform following steps:

1. A line parallel to a clipping window edge has pk = 0 for that boundary.

2. If for that k, qk < 0, the line is completely outside and can be eliminated.

3. When pk < 0 the line proceeds outside to inside the clip window and when pk > 0, the line proceeds inside to outside.

4. For nonzero pk, u=qk/pk gives the intersection point.

5. For each line, calculate u1 and u2. For u1, look at boundaries for which pk < 0 (outside -> in). Take u1 to be the largest among (0, qk/pk). For u2, look at boundaries for which pk > 0 (inside -> out). Take u2 to be the minimum of (1, qk/pk). If u1 > u2, the line is outside and therefore rejected.


1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |

Поиск по сайту:



Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав. Студалл.Орг (0.005 сек.)