I can’t help with that, I can’t even open your project on Windows.

Julen

I can’t help with that, I can’t even open your project on Windows.

Julen

I’m glad to see that it’s working for you, but I’m somewhat puzzled that it works with the direction of rotation of the angle the same as that of the bearing. Traditional angles are measured counterclockwise from the x axis, while bearing is measured clockwise from the y axis.

Since the y axis is reversed, it’s like if we were looking at the reference system from behind (or, as if the entire reference system could rotate around the x axis and it had fallen downwards), so we see a counterclockwise angle as clockwise.

I hope that makes some sense. Anyway, the reason is our reference system is not the usual one (in which y increases when moving to the north).

Julen

Why are you subtracting the second term in the example calculation for ey when your formula is

ey = sy + Distance * sin(Angle) ?

I am using the cosine there. The cosine of angles larger than 90º (so those pointing downwards if that angle is the bearing) is negative, but ey > sy if bearing > 90º, so that minus sign is required.

Again, this is all because of the uncommon reference system and way to measure the angle.

And concerning the sine/cosine, usually you would use the sine for the y axis when the angle has its origin on the horizontal axis, but the bearing has its origin on the vertical axis, so the cosine needs to be used for the vertical axis and the sine for the horizontal axis.

The cosine and sine have the following property:

`cosine alpha = sine (alpha + 90 º)`

and there is a phase difference of 90 º between the angle as we would usually measure it (starting from the x axis) and the bearing.

Julen

1 Like

So, are you saying that your formula should always be:

ey = sy - Distance * sin(Angle)

always with the minus sign (which is different from what you originally posted)?

It seems to me that the sign keeps being changed ad hoc to make the result fit.

The reason why I provided my earlier formula:

Angle = (90-Bearing)*Pi/180

was in order to convert the bearing into a traditional representation of angle that everyone is familiar with: one that is referenced to the x axis, and increases in a counterclockwise direction.

1 Like

I originally posted that because:

And in my original post I said…

and

Once I learnt the meaning of bearing I never again changed the minus sign. Have you tried the expressions Martin posted orginally (which are the correct ones) and also yours with a few examples?

Like

In your expressions that would result in

Angle = 90 º -180 º = - 90 º

ex = 50 + 30 * cos (-90) = 50 + 30 * 0 = 50

ey = 40 + 30 * sin (-90) = 40 + 30 * (-1) = 10

(50, 10), which is not correct.

Try with other initial points and bearings

And you did that conversion right, but you are not taking into account the downwards direction of the y axis.

Julen

2 Likes

Okay thanks. I missed the “downwards direction of the y axis” part.

Though, I can’t help but think that such a non standard convention is going to cause more problems as time goes on.

1 Like

Forum for Xojo Programming Language and IDE. Copyright © 2023 Xojo, Inc.