fixatan2(3alleg4)

fixatan23alleg4

Fixed point version of the libc atan2() routine. allegro game programming library.

Usage

#include <allegro.h>

fixed fixatan2(fixed y, fixed x);

Overview

This is a fixed point version of the libc atan2() routine. It computes the arc tangent of `y / x', but the signs of both arguments are used to determine the quadrant of the result, and `x' is permitted to be zero. This function is useful to convert Cartesian coordinates to polar coordinates. Example:

   fixed result;
   /* Sets `result' to binary angle 64. */
   result = fixatan2(itofix(1), 0);
   /* Sets `result' to binary angle -109. */
   result = fixatan2(itofix(-1), itofix(-2));
   /* Fails the assert. */
   result = fixatan2(0, 0);
   ASSERT(!errno);

Return value

Returns the arc tangent of `y / x' in fixed point binary format angle, from `-128' to `128'. If both `x' and `y' are zero, returns zero and sets `errno' to EDOM.

Releases

7 releases since Debian 7 (Wheezy); the text changed 1 time.

  1. 7–10
  2. 11–13

From allegro4-doc 2:4.4.3.1-5 in Debian 13 (Trixie). Parsed by carta from the page's man source.