uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit f7498cff5cc5995abe074caace991043bab66fdf
parent 0b134ff6b868a9772c8562ca60d5b852abb18f74
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Thu,  9 Jun 2022 09:19:15 -0700

(tables.c) Improved sin table generator

Diffstat:
Metc/tables/build.sh | 2+-
Metc/tables/tables.c | 11++++++-----
2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/etc/tables/build.sh b/etc/tables/build.sh @@ -8,7 +8,7 @@ rm -f ../../bin/tables echo "Building.." mkdir -p ../../bin -cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined -lm tables.c -o ../../bin/tables +cc -lm tables.c -o ../../bin/tables echo "Assembling.." ../../bin/tables diff --git a/etc/tables/tables.c b/etc/tables/tables.c @@ -25,12 +25,13 @@ clamp(int val, int min, int max) int main() { - int i; - printf("60 points on a circle128(bytex,bytey):\n\n"); - for(i = 0; i < 60; ++i) { + int seg = 64, offset = seg / 4, i; + double segf = 64.0; + printf("%d points on a circle128:\n\n", seg); + for(i = 0; i < seg; ++i) { double cx = 128, cy = 128, r = 128; - double pos = (i - 15) % 60; - double deg = (pos / 60.0) * 360.0; + double pos = (i - offset) % seg; + double deg = (pos / segf) * 360.0; double rad = deg * (PI / 180); double x = cx + r * cos(rad); double y = cy + r * sin(rad);