I'm working with transformation matrix, but I do not understand how to make a skew of a polygon (the green square in the following images).

I use a couple of images to explain:

I have this image:

where the blue point is the origin i.e. the

*top-left*corner of the entire skin.

Now, the first question: how I calculate the new

*origin*point for the square (you can see that the blue point, after the transformation, is at a new value of X) ?

the second question: if I wanted to change the origin point of the transformation, what should I insert in the matrix ?

An example code:

Code: Select all

`[Rainmeter]`

Update=-1

AccurateText=1

DynamicWindowSize=1

[Variables]

Angle=-60

X_prime=150

Y_prime=150

[MeasureScaleX]

Measure=Calc

Formula=1

[MeasureSkewY]

Measure=Calc

Formula=0

DynamicVariables=1

[MeasureSkewX]

Measure=Calc

Formula=TAN(Rad(#Angle#))

DynamicVariables=1

[MeasureScaleY]

Measure=Calc

Formula=1

[MeasureMoveX]

Measure=Calc

Formula=(#X_prime# - [MeterSquare:X] * [MeasureScaleX:] - [MeterSquare:Y] * [MeasureSkewX:])

DynamicVariables=1

[MeasureMoveY]

Measure=Calc

Formula=(#Y_prime# - [MeterSquare:X] * [MeasureSkewY:] - [MeterSquare:Y] * [MeasureScaleY:])

DynamicVariables=1

[MeterBackground]

Meter=Image

X=0

Y=0

W=400

H=400

SolidColor=200,200,200,125

[MeterSquare]

Meter=Image

X=150

Y=150

W=100

H=100

SolidColor=255,0,0,255

SolidColor2=0,255,0,255

GradientAngle=270

AntiAlias=1

TransformationMatrix=([MeasureScaleX:]);([MeasureSkewY:]);([MeasureSkewX:]);([MeasureScaleY:]);([MeasureMoveX:]);([MeasureMoveY:])

DynamicVariables=1

Thanks in advance for your answers.