Skip to content

Commit d675a9d

Browse files
authored
Merge pull request #339 from jgray-19/change_ref_fixes
Change Reference Fixes
2 parents a3c2653 + 1bca514 commit d675a9d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/madl_dynmap.mad

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ M.translate = translate
270270
-- Changeref (generic patch, lw_>0: RT, lw_<0: TR)
271271

272272
function M.changeref (elm, m, lw_) -- unchecked
273-
local lw = lw_ or 1
273+
local sdir, edir in m
274+
local lw = (lw_ or 1)*sdir -- for trackone, sdir is not placed into lw
274275
local dx, dy, ds, dphi, dpsi in elm
275276
local dthe = elm.dtheta
276277
local trn = abs(dx )+abs(dy )+abs(ds ) >= minlen
@@ -285,21 +286,21 @@ function M.changeref (elm, m, lw_) --
285286

286287
-- rotate
287288
if rot and lw > 0 then
288-
yrotation( dthe, m, 1)
289-
xrotation(-dphi, m, 1)
290-
srotation( dpsi, m, 1)
289+
yrotation( dthe, m, edir)
290+
xrotation(-dphi, m, edir)
291+
srotation( dpsi, m, edir)
291292
end
292293

293294
-- translate
294295
if trn then
295-
translate({dx=dx, dy=dy, ds=ds}, m, lw)
296+
translate({dx=dx, dy=dy, ds=ds}, m, 1) -- translate does everything
296297
end
297298

298299
-- rotate
299300
if rot and lw < 0 then
300-
srotation( dpsi, m, -1)
301-
xrotation(-dphi, m, -1)
302-
yrotation( dthe, m, -1)
301+
srotation( dpsi, m, -edir)
302+
xrotation(-dphi, m, -edir)
303+
yrotation( dthe, m, -edir)
303304
end
304305

305306
m.atdebug(elm, m, lw_, 'changeref:1')

0 commit comments

Comments
 (0)