Skip to content

Change Reference Fixes #339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/madl_dynmap.mad
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ M.translate = translate
-- Changeref (generic patch, lw_>0: RT, lw_<0: TR)

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

-- rotate
if rot and lw > 0 then
yrotation( dthe, m, 1)
xrotation(-dphi, m, 1)
srotation( dpsi, m, 1)
yrotation( dthe, m, edir)
xrotation(-dphi, m, edir)
srotation( dpsi, m, edir)
end

-- translate
if trn then
translate({dx=dx, dy=dy, ds=ds}, m, lw)
translate({dx=dx, dy=dy, ds=ds}, m, 1) -- translate does everything
end

-- rotate
if rot and lw < 0 then
srotation( dpsi, m, -1)
xrotation(-dphi, m, -1)
yrotation( dthe, m, -1)
srotation( dpsi, m, -edir)
xrotation(-dphi, m, -edir)
yrotation( dthe, m, -edir)
end

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