PyxisSociety/SANDAL2

Add a scenary graph

Klevh opened this issue · 1 comments

Klevh commented
Add a scenary graph
Klevh commented

Rotation
Rotation of child's rotation around the parent one, moving the child accordingly then adding parent's angle gain to the children

Rotation in one operation:
a, b: coordinate of the parent
t: rotation angle
c = cos(t)
s = sin(t)
1 0 a | c -s 0 | 1 0 -a | x
0 1 b | s c 0 | 0 1 -b | y
0 0 1 | 0 0 1 | 0 0 1 | 1

c -s a | 1 0 -a | x
s c b | 0 1 -b | y
0 0 1 | 0 0 1 | 1

c -s (1-c)a+sb | x
s c (1-c)b-sa | y
0 0 1 | 1

cx-sy+(1-c)a+sb
sx+cy-sa+(1-c)b
1

Resize
pw = nw / w
ph = nh / h
For all children (ew, eh) :
ew *= pw
eh *= ph
To avoid cumulative error, save in the child:

  • child's relative size since last child resize (w, h)

Flip
Use resize data conservation and add relative coordinates
ex=originEx + flip2(originPx - originEx)
same for ey