@startuml
title Линия: полная схема растризации

start
:Input local endpoints (x0,y0),(x1,y1)\n+ color + thickness;
:Map endpoints Local -> World -> Buffer;
:Compute pixel thickness from transform scale;
if (thickness_px <= 0?) then (yes)
  stop
endif

if (draw_when_outside == false?) then (yes)
  :Clip segment to expanded buffer bounds\n(Liang-Barsky);
  if (segment rejected?) then (yes)
    stop
  endif
endif

:Compute angle-based thickness correction\n(using |dx|/len and |dy|/len);
:Initialize Bresenham state\ndx,dy,sx,sy,err;

while (not reached end point?)
  :Choose effective half-thickness:\nfull in viewport, 0 outside if draw_when_outside;
  :Draw stripe around center pixel\n(along normal axis);
  :Advance Bresenham step by error update;
endwhile

stop

@enduml
