@startuml
title Алгоритм композиции трансформаций (parent * local)

start
:Input parent transform:\nP(tx,ty,angle,sx,sy,opacity);
:Input local transform:\nL(tx,ty,angle,sx,sy,opacity);

:Scale local position by parent scale:\nlx' = L.tx * P.sx\nly' = L.ty * P.sy;
:Rotate by parent angle:\nrx = cos(P.a)*lx' - sin(P.a)*ly'\nry = sin(P.a)*lx' + cos(P.a)*ly';
:Translate by parent position:\nW.tx = P.tx + rx\nW.ty = P.ty + ry;

:Compose angle:\nW.angle = P.angle + L.angle;
:Compose scale:\nW.sx = P.sx * L.sx\nW.sy = P.sy * L.sy;
:Compose opacity:\nW.opacity = P.opacity * L.opacity;

:Return world transform W;
stop

@enduml
