Usually the angle is defined with respect to the horizontal direction and then you must use cosine for ex and sine for ey, but that depends on how you define the angle.

EDIT: and in general I would not expect to see any minus sign in those equations (the cosine/sine should take care of that), but again it depends on how your system is defined.

It will work as expected, the cosine of angles above 90 º and up to 270 º is negative, the sine is negative from 180 º to 360 º, so as I said before those functions will take care of the negative sign when neeeded. I am not sure I got your question, though.

I have seen you have another thread about creating a graph. Is this thread related? And, are you using your y values in the default direction (the values increase when moving downwards) or have you modified that axis?

Is your angle 0 º when pointing to the right and 90 º when pointing upwards?

In that case the use of sine and cosine in your first post was correct, Martin (assuming you are using the default x axis orientation). Sorry for the confusion.

Assuming that y is in the north direction and x in the east direction, with the already suggested correction of changing the (-) to a (+), your equations should work just fine. The one time where you might want a (-) is if you are using screen coordinates where y is positive downwards (i.e. towards the south).

If you are doing this calculation a lot, you might want to define a constant for the PI/180 radians/degree. As you undoubtedly know, 90° is PI/2 radians, 180° = PI radians, 270 = 3*PI/2 radians, and 360 = 2*PI radians.

The problem is slightly trickier if you know the direction cosines and want to calculate the bearings because the trig values repeat between 0 and 360.

Hi @Jason_King should the pixel color work inside a canvas? I have tried for a couple of days to try different methods but using your initial example drawing the bitmap to the canvas and then clicking on the canvas it returns a color but not the right one see below. I assume if it was simple Xojo would have already added it so just need to know if I should pass on it as a solution. Project

Back to the calculation, I can’t seem to get it
If I enter Bearing 180’ (south) and distance 30 I should end up at (50,70) for example
ey = sy - (cos(Dir) * Distance)
ex = sx + (sin(Dir) * Distance)
What should the formula be?