Code: Select all
function Scale(x,y,a,b)
local t={a,0,0,b,(1-a)*x,(1-b)*y}
return t
end
Code: Select all
function Rotate(x,y,r)
local t={math.cos(r),math.sin(r),-math.sin(r),math.cos(r),x*(1-math.cos(r))+y*math.sin(r),y*(1-math.cos(r))-x*math.sin(r)}
return t
end
Code: Select all
function Multiply(a,b)
local t={}
t[1]=a[1]*b[1]+a[2]*b[3]
t[2]=a[1]*b[2]+a[2]*b[4]
t[3]=a[3]*b[1]+a[4]*b[3]
t[4]=a[3]*b[2]+a[4]*b[4]
t[5]=a[5]*b[1]+a[6]*b[3]+b[5]
t[6]=a[5]*b[2]+a[6]*b[4]+b[6]
return t
end
Code: Select all
function Ouput(t)
local s=t[1]..';'..t[2]..';'..t[3]..';'..t[4]..';'..t[5]..';'..t[6]
return s
end
Scale both x&y by 2 and rotate 90 degree around (100,100)
Code: Select all
TM0={1,0,0,1,0,0}
TM1=Scale(100,100,2,2)
TM2=Rotate(100,100,math.pi/4)
TM=Multiply(Multiply(iTM0,iTM1),iTM2)
SKIN:Bang('!SetOption','Meter','TransformationMatrix',Output(TM))