Report
This commit is contained in:
34
Report/uml/liang-barsky-clip.puml
Normal file
34
Report/uml/liang-barsky-clip.puml
Normal file
@@ -0,0 +1,34 @@
|
||||
@startuml
|
||||
title Liang-Barsky: отсечение отрезка прямоугольником
|
||||
|
||||
start
|
||||
:Input segment P0,P1 and clip rect;
|
||||
:dx = x1-x0, dy = y1-y0;
|
||||
:t0 = 0, t1 = 1;
|
||||
|
||||
:Process boundary x >= left\np=-dx, q=x0-left;
|
||||
if (clip test fails?) then (yes)
|
||||
stop
|
||||
endif
|
||||
|
||||
:Process boundary x <= right\np=dx, q=right-x0;
|
||||
if (clip test fails?) then (yes)
|
||||
stop
|
||||
endif
|
||||
|
||||
:Process boundary y >= top\np=-dy, q=y0-top;
|
||||
if (clip test fails?) then (yes)
|
||||
stop
|
||||
endif
|
||||
|
||||
:Process boundary y <= bottom\np=dy, q=bottom-y0;
|
||||
if (clip test fails?) then (yes)
|
||||
stop
|
||||
endif
|
||||
|
||||
:Compute clipped points:\nP0' = P0 + t0*(P1-P0)\nP1' = P0 + t1*(P1-P0);
|
||||
:Round to integer pixels;
|
||||
:Return accepted clipped segment;
|
||||
stop
|
||||
|
||||
@enduml
|
||||
Reference in New Issue
Block a user