Re: [AD] About the fixed type (continued) |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 29 August 2002 14:08, Eric Botcazou wrote:
> That's confusing: to convert from rad to fix, you're using
> fixtorad_r. I'd rather read:
> y = fixmul(x, radtofix_r); x in rad, y in fp angle
You are of course correct, I must have been asleep ;-P
The correct patch is attached. Sorry about that.
Bye for now,
- --
Laurence Withers, lwithers@xxxxxxxxxx
(GnuPG 04A646EA) http://www.lwithers.demon.co.uk/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9biW2UdhclgSmRuoRAiynAJwIZAIr42t5GUB+suplvN3SaAH3IwCgpdOg
FlXvXzG4boTVyMeQea4tP1M=
=A2uX
-----END PGP SIGNATURE-----
diff -ru allegro.old/docs/src/allegro._tx allegro/docs/src/allegro._tx
--- allegro.old/docs/src/allegro._tx Wed Aug 28 22:47:19 2002
+++ allegro/docs/src/allegro._tx Wed Aug 28 22:59:54 2002
@@ -6559,6 +6559,18 @@
bitwise 'and' can be used to keep the angle within the range zero to a full
circle, eliminating all those tiresome 'if (angle >= 360)' checks.
+@@extern const fixed @radtofix_r;
+@xref fixmul, fixtorad_r
+ This constant gives a ratio which can be used to convert a number in
+ radians to a number in fixed point angle format: if 'x' is a float
+ in radians, then use: 'y = fixmul(ftofix(x), radtofix_r);'.
+
+@@extern const fixed @fixtorad_r;
+@xref fixmul, radtofix_r
+ This constant gives a ratio to convert a number in fixed point angle
+ format into radians: if 'y' is a fixed point angle, then use:
+ 'x = fixtof(fixmul(y, fixtorad_r));'.
+
@@fixed @fixsin(fixed x);
@xref Fixed point trig
Lookup table sine.
diff -ru allegro.old/include/allegro/fixed.h allegro/include/allegro/fixed.h
--- allegro.old/include/allegro/fixed.h Wed Aug 28 22:47:25 2002
+++ allegro/include/allegro/fixed.h Wed Aug 28 22:51:03 2002
@@ -24,6 +24,8 @@
#endif
typedef long fixed;
+extern const fixed fixtorad_r;
+extern const fixed radtofix_r;
#ifdef __cplusplus
}
diff -ru allegro.old/src/math.c allegro/src/math.c
--- allegro.old/src/math.c Wed Aug 28 22:47:30 2002
+++ allegro/src/math.c Wed Aug 28 22:53:02 2002
@@ -281,6 +281,14 @@
+/* fixtorad_r, radtofix_r:
+ * Ratios for converting between radians and fixed point angles.
+ */
+const fixed fixtorad_r = (fixed)1608;
+const fixed radtofix_r = (fixed)2670177;
+
+
+
#if (defined ALLEGRO_I386) && (!defined ALLEGRO_USE_C)