Report
This commit is contained in:
43
Report/uml/ellipse-arc-rasterization.puml
Normal file
43
Report/uml/ellipse-arc-rasterization.puml
Normal file
@@ -0,0 +1,43 @@
|
||||
@startuml
|
||||
title Эллипс/дуга: алгоритм растризации
|
||||
|
||||
start
|
||||
:Read rx, ry, thickness,\narc_percent, closed, filled;
|
||||
if (rx<=0 or ry<=0?) then (yes)
|
||||
stop
|
||||
endif
|
||||
|
||||
:Build local bbox corners with margin;
|
||||
:Transform corners to buffer\nand compute pixel scan bounds;
|
||||
:Create temporary transparent buffer;
|
||||
if (do_fill?) then (yes)
|
||||
:startFill() collect border pixels;
|
||||
endif
|
||||
|
||||
while (for each pixel in bbox)
|
||||
:Map pixel center Buffer -> World -> Local;
|
||||
:nx = x/rx, ny = y/ry,\nd = nx^2 + ny^2;
|
||||
if (d in stroke ring?) then (yes)
|
||||
if (arc_percent < 100?) then (yes)
|
||||
:Compute angular position\nvia atan2 and normalized diff;
|
||||
if (inside arc sector?) then (yes)
|
||||
:plot stroke pixel;
|
||||
endif
|
||||
else (full ellipse)
|
||||
:plot stroke pixel;
|
||||
endif
|
||||
endif
|
||||
endwhile
|
||||
|
||||
if (closed and arc_percent<100?) then (yes)
|
||||
:Draw two radial segments\n(center->start and center->end);
|
||||
endif
|
||||
|
||||
if (do_fill?) then (yes)
|
||||
:stopFill(fill_color);
|
||||
endif
|
||||
|
||||
:Composite temp buffer to target\nonce with object opacity;
|
||||
stop
|
||||
|
||||
@enduml
|
||||
Reference in New Issue
Block a user