1fixatan2(3) Allegro manual fixatan2(3)
2
3
4
6 fixatan2 - Fixed point version of the libc atan2() routine. Allegro
7 game programming library.
8
10 #include <allegro.h>
11
12
13 fixed fixatan2(fixed y, fixed x);
14
16 This is a fixed point version of the libc atan2() routine. It computes
17 the arc tangent of `y / x', but the signs of both arguments are used to
18 determine the quadrant of the result, and `x' is permitted to be zero.
19 This function is useful to convert Cartesian coordinates to polar coor‐
20 dinates. Example:
21
22 fixed result;
23
24 /* Sets `result' to binary angle 64. */
25 result = fixatan2(itofix(1), 0);
26 /* Sets `result' to binary angle -109. */
27 result = fixatan2(itofix(-1), itofix(-2));
28 /* Fails the assert. */
29 result = fixatan2(0, 0);
30 ASSERT(!errno);
31
33 Returns the arc tangent of `y / x' in fixed point binary format angle,
34 from `-128' to `128'. If both `x' and `y' are zero, returns zero and
35 sets `errno' to EDOM.
36
37
39 , exlights(3), exspline(3)
40
41
42
43Allegro version 4.2.3 fixatan2(3)