Closed jessegreenberg closed 4 years ago
The matrix it is trying to set is full of NaN
s.
Seemed to happen quickly in the above comment, but now after many minutes of fuzzing I cannot get this to happen.
I suspect it is a division by zero error
let localSquaredDistance = 0;
let targetSquaredDistance = 0;
localPoints.forEach( localPoint => { localSquaredDistance += localPoint.distanceSquared( localCentroid ); } );
targetPoints.forEach( targetPoint => { targetSquaredDistance += targetPoint.distanceSquared( targetCentroid ); } );
let scale = Math.sqrt( targetSquaredDistance / localSquaredDistance );
local points could be right on the localCentroid and distance could possibly end up as zero.
But then the entries would be Infinity
rather than NaN I think. So perhaps that isn't what is happening.
OK, I just hit this assertion: assert && assert( localSquaredDistance !== 0, 'distance to centroid should not be zero' );
happened while I was resizing window if that matters.
Detailed infor:
There are two Presses down. Each have same trail with id 215-216
, going to simulation root. First one at (81,205). Second one at (166,584). Local points are BOTH at {x: 50.30255742309739, y: 413.06044413233985}
. Target points are same as Pointer points.
I don't think this is the problem, the scale is limited. Stepping beyond the assertion shows no problems.
OK, hit the actual error - this time two Pointers are down in the exact same spot:
Should be fixed in the above commit - if Press points are in exactly the same spot (which is only possible during fuzz testing) we will not adjust scale at all. I tested by trying ?fuzz&fuzzPointers=3
for many minutes, and in aqua (where it seemed to happen more frequently. Can no longer get it to occur. Closing.
Caught from https://github.com/phetsims/aqua/issues/106, trying to enable multitouch fuzzing.