This commit is contained in:
2026-03-19 14:54:09 +03:00
parent 7145b66e0e
commit 37036f8f75
26 changed files with 5466 additions and 0 deletions

View 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