summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/mlib-lua.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-11-18 16:12:36 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2018-11-18 16:12:36 +0100
commit744095aa4676553437db0d71c281a74557a3222f (patch)
treebfdf5d203b5fbfa44ee7db705d3b3475361ad28f /tex/context/base/mkiv/mlib-lua.lua
parente2ee706a3114129601a30908d6b8cbb57068d32c (diff)
downloadcontext-744095aa4676553437db0d71c281a74557a3222f.tar.gz
2018-11-18 14:16:00
Diffstat (limited to 'tex/context/base/mkiv/mlib-lua.lua')
-rw-r--r--tex/context/base/mkiv/mlib-lua.lua114
1 files changed, 57 insertions, 57 deletions
diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua
index 09169e155..c155d7733 100644
--- a/tex/context/base/mkiv/mlib-lua.lua
+++ b/tex/context/base/mkiv/mlib-lua.lua
@@ -317,84 +317,84 @@ do
end
end
- -- local function mp_path(f2,f6,t,connector,cycle)
- -- if type(t) == "table" then
- -- local tn = #t
- -- if tn > 0 then
- -- if connector == true then
- -- connector = "--"
- -- cycle = true
- -- elseif not connector then
- -- connector = "--"
- -- end
- -- local ti = t[1]
- -- n = n + 1 ;
- -- if #ti == 6 then
- -- local tn = t[2] or t[1]
- -- buffer[n] = f6(ti[1],ti[2],ti[5],ti[6],tn[3],tn[4])
- -- else
- -- buffer[n] = f2(ti[1],ti[2])
- -- end
- -- for i=2,tn do
- -- local ti = t[i]
- -- n = n + 1 ; buffer[n] = connector
- -- n = n + 1 ;
- -- if #ti == 6 and (i < tn or cycle) then
- -- local tn = t[i+1] or t[1]
- -- buffer[n] = f6(ti[1],ti[2],ti[5],ti[6],tn[3],tn[4])
- -- else
- -- buffer[n] = f2(ti[1],ti[2])
- -- end
- -- end
- -- if cycle then
- -- n = n + 1 ; buffer[n] = connector
- -- n = n + 1 ; buffer[n] = "cycle"
- -- end
- -- end
- -- end
- -- end
+ -- we have three kind of connectors:
+ --
+ -- .. ... -- (true)
local function mp_path(f2,f6,t,connector,cycle)
if type(t) == "table" then
local tn = #t
- if tn > 0 then
- if connector == true then
- connector = "--"
- cycle = true
- elseif not connector then
+ if tn == 1 then
+ local t1 = t[1]
+ n = n + 1 ; buffer[n] = f2(t1[1],t1[2])
+ elseif tn > 0 then
+ if connector == true or connector == nil then
+ connector = ".."
+ elseif connector == false then
connector = "--"
end
- local ti = t[1]
- n = n + 1 ;
- if #ti == 6 then
- buffer[n] = f6(ti[1],ti[2],ti[3],ti[4],ti[5],ti[6])
+ if cycle == nil then
+ cycle = t.cycle
+ if cycle == nil then
+ cycle = true
+ end
+ end
+ local six = connector == ".." -- otherwise we use whatever gets asked for
+ local controls = connector -- whatever
+ local a = t[1]
+ local b = t[2]
+ n = n + 1
+ if six and #a == 6 and #b == 6 then
+ buffer[n] = f6(a[1],a[2],a[5],a[6],b[3],b[4])
+ controls = ".."
else
- buffer[n] = f2(ti[1],ti[2])
+ buffer[n] = f2(a[1],a[2])
+ controls = connector
end
- for i=2,tn do
- local ti = t[i]
- n = n + 1 ; buffer[n] = connector
- n = n + 1 ;
- if #ti == 6 then
- buffer[n] = f6(ti[1],ti[2],ti[3],ti[4],ti[5],ti[6])
+ for i=2,tn-1 do
+ a = b
+ b = t[i+1]
+ n = n + 1
+ buffer[n] = connector
+ n = n + 1
+ if six and #a == 6 and #b == 6 then
+ buffer[n] = f6(a[1],a[2],a[5],a[6],b[3],b[4])
+ controls = ".."
else
- buffer[n] = f2(ti[1],ti[2])
+ buffer[n] = f2(a[1],a[2])
+ controls = connector
end
end
+ n = n + 1
+ buffer[n] = connector
+ a = b
+ b = t[1]
+ n = n + 1
if cycle then
- n = n + 1 ; buffer[n] = connector
- n = n + 1 ; buffer[n] = "cycle"
+ if six and #a == 6 and #b == 6 then
+ buffer[n] = f6(a[1],a[2],a[5],a[6],b[3],b[4])
+ controls = ".."
+ else
+ buffer[n] = f2(a[1],a[2])
+ controls = connector
+ end
+ n = n + 1
+ buffer[n] = connector
+ n = n + 1
+ buffer[n] = "cycle"
+ else
+ buffer[n] = f2(a[1],a[2])
end
end
end
end
local function mppath(...)
- mp_path(f_pair,f_pair_ctrl,...)
+ mp_path(f_pair,f_ctrl,...)
end
local function mppathpoints(...)
- mp_path(f_pair_pt,f_pair_pt_ctrl,...)
+ mp_path(f_pair_pt,f_ctrl_pt,...)
end
local function mpsize(t)