#### camerart

##### Well-Known Member

Hi,

I've been given an equasion by JJW, and would like to try it in Oshonsoft:

'##############################################################################

You calculate angle in radians from x, y coordinates.

Angle in degrees = radians × 180 / Pi

~ radians × 57.3

Oshonsoft has arctan function for y / x < 1

You have to calculate in eight octants ( 45 degrees )

Octants can be found from signs of x and y and from

value of y / x if it is less or greater than one.

For example, if North is 0 degrees and clockwise direction:

0 - 45 degrees x / y < 1 and x > 0, y > 0

angle = arctan( x / y ) × 57.3

45 - 90 degrees x/y > 1 x >0 y>0

angle =

etc ...

Angle, x and y are floating point variables

'#################################################################################

Is this correct?

Between 0° to 45°

If x/y

If x >0 then

If y > 0 then

angle = arctan( x / y ) × 57.3

ENDIF

ENDIF

ENDIF

Corrected.

Cheers, Camerart.

I've been given an equasion by JJW, and would like to try it in Oshonsoft:

'##############################################################################

You calculate angle in radians from x, y coordinates.

Angle in degrees = radians × 180 / Pi

~ radians × 57.3

Oshonsoft has arctan function for y / x < 1

You have to calculate in eight octants ( 45 degrees )

Octants can be found from signs of x and y and from

value of y / x if it is less or greater than one.

For example, if North is 0 degrees and clockwise direction:

0 - 45 degrees x / y < 1 and x > 0, y > 0

angle = arctan( x / y ) × 57.3

45 - 90 degrees x/y > 1 x >0 y>0

angle =

**90**- arctan(**y / x**) × 57.3etc ...

Angle, x and y are floating point variables

'#################################################################################

Is this correct?

Between 0° to 45°

If x/y

**<**1 thenIf x >0 then

If y > 0 then

angle = arctan( x / y ) × 57.3

ENDIF

ENDIF

ENDIF

Corrected.

Cheers, Camerart.

Last edited: