Page 1 of 1

RotateTransform to rotate one existing Point around other

Posted: 10 Dec 2021, 20:39
by mariorancic
I am trying to rotate one existing point around the other and in WPF it is possible with method Transform of RotateTransform class
and for example I can do this:

RotateTransform rotation = new RotateTransform();
rotation.Angle = 45;
rotation.CenterX = p1.X;
rotation.CenterY = p1.Y;
p2 = rotation.Transform(p2);

but in NoesisGUI this method does not exist and what I can do instead.

Re: RotateTransform to rotate one existing Point around other

Posted: 10 Dec 2021, 21:02
by jsantos
You can use Transform2::RotateAt(angle, centerX, centerY) in Noesis

Re: RotateTransform to rotate one existing Point around other

Posted: 10 Dec 2021, 21:08
by mariorancic
I am using NoesisGUI .net SDK and I do not see Transform2 class
Anyway, maybe with little help of Microsoft open sourced WPF, maybe I found answer on my own question:
Matrix matrix = new Matrix();
matrix.RotateAt(angle, centerX, centerY);
p2 = matrix.Transform(p2);

Maybe this will work, otherwise i have to somehow to get access to Transform2 class

Re: RotateTransform to rotate one existing Point around other

Posted: 10 Dec 2021, 21:18
by jsantos
I see, your message was not marked with the tag C#, so I thought you were using C++.

Yes, that should work.

Re: RotateTransform to rotate one existing Point around other

Posted: 10 Dec 2021, 23:40
by mariorancic
thx