Skip to content

Commit

Permalink
small simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
skejeton committed Dec 9, 2024
1 parent f76858d commit 36e6f57
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/gfx/rerp.um
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,21 @@ import (
)

fn iReal*(s, t, f: real): real {
if f > 1 {
f = 1
} else if f < 0 {
f = 0
}
f = f > 1 ? 1 : (f < 0 ? 0 : f)
return s + (t-s)*f
}


fn iVf2*(s, t: th::Vf2, f: real): th::Vf2 {
if f > 1 {
f = 1
} else if f < 0 {
f = 0
}
f = f > 1 ? 1 : (f < 0 ? 0 : f)
s.x += (t.x-s.x)*f
s.y += (t.y-s.y)*f
return s
}


fn iRect*(s, t: rect::Rect, f: real): rect::Rect {
if f > 1 {
f = 1
} else if f < 0 {
f = 0
}
f = f > 1 ? 1 : (f < 0 ? 0 : f)
s.x += (t.x-s.x)*f
s.y += (t.y-s.y)*f
s.w += (t.w-s.w)*f
Expand Down

0 comments on commit 36e6f57

Please sign in to comment.