1al_fixatan2(3)             Library Functions Manual             al_fixatan2(3)
2
3
4

NAME

6       al_fixatan2
7

SYNOPSIS

9              #include <allegro5/allegro.h>
10
11              al_fixed al_fixatan2(al_fixed y, al_fixed x)
12

DESCRIPTION

14       This is a fixed point version of the libc atan2() routine.  It computes
15       the arc tangent of y / x, but the signs of both arguments are  used  to
16       determine  the  quadrant  of the result, and x is permitted to be zero.
17       This function is useful to convert Cartesian coordinates to polar coor‐
18       dinates.
19
20       Example:
21
22                  al_fixed result;
23
24                  /* Sets `result' to binary angle 64. */
25                  result = al_fixatan2(al_itofix(1), 0);
26
27                  /* Sets `result' to binary angle -109. */
28                  result = al_fixatan2(al_itofix(-1), al_itofix(-2));
29
30                  /* Fails the assert. */
31                  result = al_fixatan2(0, 0);
32                  assert(!al_get_errno());
33

RETURN VALUE

35       Returns  the  arc  tangent of y / x in fixed point binary format angle,
36       from –128 to 128.  If both x and y are  zero,  returns  zero  and  sets
37       Allegro's errno to EDOM.
38
39
40
41Allegro reference manual                                        al_fixatan2(3)
Impressum