# Math question with A2Dv2

## Recommended Posts

I am absolutely horrible at math(having a headache is not helping) so i have come here for a simple question.

I am using a2d to draw an image and based on the x and y of that image and the x and y of the mouse i need to rotate the image 1-360 degrees to point at the mouse.

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

##### Share on other sites

I thought I might find sort of _GDIPlus_SetMapMode function but I don't see one heh. Anyway, I don't have a good start point for you on how to implement it in AutoIt nor do I good at math either, but the Gdi.dll got some nice functions like CombineTransform() or SetWorldTransform(). Search msdn about these functions.

Rotating HDC usually is implemented in one of some ways using the XFORM struct, just take the mouse coords and calculate the radians between the one of the axises and the mouse point using cos/sin, you might find better explanation than I give in MSDN and Wikipedia.

##### Share on other sites

If there's no inbuilt way to rotate the image, then you have to do it yourself. So, because of the lack of information in your post I am just going to make this vague and unclear.

Every point on a circle can be defined as: ( cos(x) * radius, sin(y) * radius )

##### Share on other sites

The A2D udf has its own function to rotate my problem is finding out how to aim it at the mouse.

But i think i got it just let me test a few things.

Edited by MerkurAlex

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

×

• Wiki

• Back

• Git

## Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.