ID:1389933
 
Resolved
Matrix interpolation was incorrect in cases where a 180-degree flip was involved.
BYOND Version:500.1211
Operating System:Windows XP Pro
Web Browser:N/A
Applies to:Dream Seeker & Dream Daemon
Status: Resolved (500.1212)

This issue has been resolved.
Posted on behalf of Nadrew by Lummox JR

Descriptive Problem Summary:
The interpolation between a matrix and a flipped version (scaled -1,-1) was incorrect, as evidenced in animations.

Code Snippet (if applicable) to Reproduce Problem:
var/matrix/m1 = matrix()
var/matrix/m2 = matrix()
m2.Scale(-1,-1)
var/matrix/m3 = m1.Interpolate(m2, 0.5)

world << "[m3[0]] [m3[1]] [m3[2]] [m3[3]] [m3[4]] [m3[5]]"


Expected Results:
"0 0 0 0 0 0"

Actual Results:
This was actually tested with animate() rather than the output snippet.
Lummox JR resolved issue with message:
Matrix interpolation was incorrect in cases where a 180-degree flip was involved.
I'm still getting an issue where, instead of rotating 180 degrees, animate() will sometimes cause either have A: no animation or B: cause the atom to shrink then re-expand.

It happens seemingly at random. sometimes it will rotate, sometimes it shrinks then regrows, sometimes there's no animation and it just flips.
It shouldn't be inconsistent. The type of interpolation should be the same as long as you use the same two matrices.

If you interrupt an animation in the middle by applying a new one, that could explain any inconsistency however. The starting matrix in that case is whatever stage the atom was already in the middle of when the new animation started.

I'll need a test case to explore this further.
It seems to be caused by it being in the middle of an animation, like you said. the only thing is that it seems that if you have an animation that runs for, say 5 ticks, but the animation doesn't change at all (the transform is already equal to the matrix before the animation begins), then the animations seem to merge, which was causing my issue.

I'll make a fix in my code but I'm not sure if it's intended behavior for an animation that results in the same matrix it started with.

Thanks!

Edit: made sure the animations weren't walking over each other and it's resulting in the same way. I'll try and make a test environment for it.

Edit #2: With the way I have the code set up, I'm not sure if I'm keeping them from running over one another or not. Trying to get it set up to confirm for sure.