al_fixsin(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ al_fixsin ✨

okay bestie, so this one lives in the Allegro 5 manual, section 3alleg5 β€” like, that's its whole little address in manpage-land πŸ’…


🌸 NAME 🌸

al_fixsin β€” the Allegro 5 API, but make it trigonometry πŸ¦‹


πŸ’– SYNOPSIS πŸ’–

#include <allegro5/allegro.h>

al_fixed al_fixsin(al_fixed x);

✨ DESCRIPTION ✨

So like, this function finds the sine of a value, but it does it with a lookup table β€” no cap, it's literally just peeking at a table instead of doing the whole math from scratch. very efficient of it πŸŽ€

Important vibe check though: the input value has to be a fixed point binary angle. not degrees, not radians, binary angle. periodt.

Example, because seeing it is believing:

al_fixed angle;
int result;

/* Set the binary angle to 90 degrees. */
angle = al_itofix(64);

/* The sine of 90 degrees is one. */
result = al_fixtoi(al_fixsin(angle));
assert(result == 1);

like look at that. al_itofix(64) is 90 degrees, al_fixsin of it is one, and the assert is just there being a little main character confirming it. iconic. πŸ‘‘


🫢 RETURN VALUE 🫢

It returns the sine of that fixed point binary format angle β€” as a fixed point value. that's the whole deal, no plot twist, no surprises, just sine. πŸ’œ


and that's it bestie, you're so smart for reading the whole thing 🌈

sign-off time: this came from the Allegro reference manual, and the page itself is al_fixsin(3alleg5). go slay some angles fr fr πŸ’…βœ¨

πŸ“¦ where this page comes from