forked from pyrex/chameleonic
Golf linefill slightly more
This commit is contained in:
parent
f3a0b04cc4
commit
2d565873b3
@ -60,12 +60,11 @@ function linefill(ax,ay,bx,by,r,c)
|
|||||||
local ca,sa=dx/d,-dy/d
|
local ca,sa=dx/d,-dy/d
|
||||||
|
|
||||||
-- polygon points
|
-- polygon points
|
||||||
local s={{0,-r},{d,-r},{d,r},{0,r}}
|
|
||||||
local spans={}
|
local spans={}
|
||||||
local function calcxy(u,v) return ax+u*ca+v*sa,ay-u*sa+v*ca end
|
local function calcxy(u,v) return ax+u*ca+v*sa,ay-u*sa+v*ca end
|
||||||
local x0,y0=calcxy(0,r)
|
local x0,y0=calcxy(0,r)
|
||||||
for i=1,4 do
|
for s in all{{0,-r},{d,-r},{d,r},{0,r}} do
|
||||||
local x1,y1=calcxy(unpack(s[i]))
|
local x1,y1=calcxy(unpack(s))
|
||||||
local _x1,_y1=x1,y1
|
local _x1,_y1=x1,y1
|
||||||
if(y0>y1) x0,y0,x1,y1=x1,y1,x0,y0
|
if(y0>y1) x0,y0,x1,y1=x1,y1,x0,y0
|
||||||
local dx=(x1-x0)/(y1-y0)
|
local dx=(x1-x0)/(y1-y0)
|
||||||
|
Loading…
Reference in New Issue
Block a user