diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-06-03 23:41:42 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-06-03 23:41:42 +0530 |
| commit | 3be6325b1292233fae4817b3b864eca7b9911898 (patch) | |
| tree | 0cf5907854ed7520387646a5249fb3b3a4d17322 /examples/circle.sql | |
| parent | 7df455db49e1104eb9624adc4d5050b7f353a417 (diff) | |
| download | sqlite-creative-coding-3be6325b1292233fae4817b3b864eca7b9911898.tar.gz sqlite-creative-coding-3be6325b1292233fae4817b3b864eca7b9911898.zip | |
Add generated images to dir + readme
Diffstat (limited to 'examples/circle.sql')
| -rw-r--r-- | examples/circle.sql | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/examples/circle.sql b/examples/circle.sql deleted file mode 100644 index 46874cc..0000000 --- a/examples/circle.sql +++ /dev/null @@ -1,18 +0,0 @@ -DELETE FROM images WHERE id = 'circle'; -INSERT INTO images (id, width, height) VALUES ('circle', 200, 200) RETURNING id; - -WITH RECURSIVE - image AS (SELECT * FROM images WHERE id = 'circle'), - circle AS (SELECT width/2 AS cx, height/2 AS cy, 80 AS radius FROM image), - horizontal(x) AS - (SELECT width FROM image UNION ALL SELECT x - 1 FROM horizontal WHERE x > 1), - vertical(y) AS - (SELECT height FROM image UNION ALL SELECT y - 1 FROM vertical WHERE y > 1), - _pixels(x, y, r, g, b) AS (SELECT - x, y, - 150, - 255 * MAX(0, MIN(1, (SELECT POW(x - cx, 2) + POW(y - cy, 2) - POW(radius, 2) FROM circle))), - 150 - FROM vertical, horizontal - ) -INSERT INTO pixels (image_id, x, y, r, g, b) SELECT 'circle', x, y, r, g, b FROM _pixels; |
