# GUI Rotating method

22 views

Hi I'm jeonghan.

I have a question about GUI rotating.

Below Figure show what we are trying to do :

The link1, 2 is warp image and joint 2(link 2's source anchor) is on the global coordinate which means its source anchor is fixed.

But the problem we have is joint 1(link 1's source anchor) is needed to be on the link 2 which will change when the link 2 rotates.

So, our question is that is there any method to fixed joint 1(link 1's source anchor) on link 2?

We couldn't find out the way to fix joint 1 in link 2.

Hello Jeonghan,

using the transformation matrix will provide the desired behaviour. You will need to combine the rotation with translation. Please see first the section Perform 3D rotate, scale and translate operations explaining the basic concepts. Based on this information you can implement following code:

``````var Graphics::WarpMatrix m      = new Graphics::WarpMatrix;
var point                dstPos = Bounds.orect.center + <100,0>;

// First rotate the figure 1
m.Rotate( 0, 0, HorizontalSlider1.CurrentValue + 180 );
WarpImage1.Warp3D( dstPos, m );

// Then move the origin of the transformation matrix to the
// end of the figure 1. Note: in this example figure 1 is 200 px
// long. Taking 5 px margin on both ends in account we move 190 px.
m.Translate( 190, 0, 0 );

// Now rotate the figure 2 relative to the position resulting
// from the preceding rotation
m.Rotate( 0, 0, HorizontalSlider2.CurrentValue );
WarpImage2.Warp3D( dstPos, m );``````

This produces following results. Here the figure 1 is blue and figure 2 is yellow:

I hope it helps you further.

Best regards

Paul Banach

Hello Paul,

thanks to your help, we solved our problem !!!

again, thank you for your help.

Best regards

Jeonghan