From fb237529724ae1c01b15f99e3b25bdce7c77cf82 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 07:59:59 -0300 Subject: examples/live: square units, x and y from the centre in half the height picture.frag gives the tape x and y in half the target's height, 0 at its centre and y up (`y` -1 to 1, `x` -1.78 to 1.78 on 16:9), so a circle is round on any window, half resolution included. Lang.builtins and the README's table say so; the README's program draws its ring about the centre (`r = sqrt(x * x + y * y)`, the ring's radius and width doubled into the new unit). Test: test/live.script replaces the text (`%`, `c`) with a disc of radius 0.5, `step(x * x + y * y, 0.25)`, and reads its edge 180 pixels from the centre across and up: white at 170, black at 190, each way. zig build test: 85 of 85 steps. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- examples/live/src/Lang.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/live/src') diff --git a/examples/live/src/Lang.zig b/examples/live/src/Lang.zig index 6ad1f40..4ce504e 100644 --- a/examples/live/src/Lang.zig +++ b/examples/live/src/Lang.zig @@ -92,8 +92,8 @@ pub const Builtin = struct { /// switch, and only for a program that needs it. pub const builtins = [_]Builtin{ .{ .call = "t", .op = .t, .doc = "seconds" }, - .{ .call = "x", .op = .x, .doc = "0 at the left to 1 at the right; 0 in sound" }, - .{ .call = "y", .op = .y, .doc = "0 at the bottom to 1 at the top; 0 in sound" }, + .{ .call = "x", .op = .x, .doc = "across, in half the window's height: 0 at the centre, -1.78 to 1.78 on 16:9; 0 in sound" }, + .{ .call = "y", .op = .y, .doc = "up, in half the window's height: -1 at the bottom, 0 at the centre, 1 at the top; 0 in sound" }, .{ .call = "tau", .op = .constant, .value = std.math.tau, .doc = "a turn in radians, 6.283..." }, .{ .call = "pi", .op = .constant, .value = std.math.pi, .doc = "half a turn, 3.141..." }, .{ .call = "sin(a)", .op = .sin, .min = 1, .max = 1, .doc = "sine, of radians" }, -- cgit v1.3