From 2d565873b3cf1db8403e94173cf5e74ea3fbfbd5 Mon Sep 17 00:00:00 2001 From: Nyeogmi Date: Thu, 22 Dec 2022 18:32:14 -0800 Subject: [PATCH] Golf linefill slightly more --- chameleonic.p8 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/chameleonic.p8 b/chameleonic.p8 index 4dbf81a..401cdc4 100644 --- a/chameleonic.p8 +++ b/chameleonic.p8 @@ -60,12 +60,11 @@ function linefill(ax,ay,bx,by,r,c) local ca,sa=dx/d,-dy/d -- polygon points - local s={{0,-r},{d,-r},{d,r},{0,r}} local spans={} local function calcxy(u,v) return ax+u*ca+v*sa,ay-u*sa+v*ca end local x0,y0=calcxy(0,r) - for i=1,4 do - local x1,y1=calcxy(unpack(s[i])) + for s in all{{0,-r},{d,-r},{d,r},{0,r}} do + local x1,y1=calcxy(unpack(s)) local _x1,_y1=x1,y1 if(y0>y1) x0,y0,x1,y1=x1,y1,x0,y0 local dx=(x1-x0)/(y1-y0)