Open samreid opened 3 months ago
I'm guessing that it's significantly more expensive to do hit testing for the direction that you're going for phetsims/faradays-electromagnetic-lab#111. @jonathanolson can you comment on the performance implications, and whether this is specific to scenery helper?
In any case... I don't recommend going down this path for phetsims/faradays-electromagnetic-lab#111. It's unnecessary, see https://github.com/phetsims/faradays-electromagnetic-lab/issues/111#issuecomment-2010978731. And if you'd like to pursue whether this is a problem with scenery helper, let's transfer this issue to scenery.
Scenery helper is showing an interesting "highlight"
With the patch applied and second screen open:
phet.joist.display.rootNode.children[ 0 ].children[ 2 ].children[ 1 ].children[ 0 ].children[0].children[ 3 ].getSelfShape().toString()
is showing what seems to be the buggy path:
The screenshot in https://github.com/phetsims/kite/issues/105 corresponds to the unexpected hit testing behavior shown in https://github.com/phetsims/faradays-electromagnetic-lab/issues/111#issuecomment-2012481604:
The Helper is unioning a bunch of shapes together. It seems to include a case that is causing some grief in kite. It's also a bit complicated, because serializing the shapes and deserializing seems to be... causing a different error (yay floats).
Trying to find intersections between two circular arcs that are... very similar (but didn't get filtered out by overlap detection, because they do not overlap in angle ranges)
Broken computation:
During phetsims/faradays-electromagnetic-lab#103, @matthew-blackman and I were investigating the pointer areas for the CoilSegmentNode in phetsims/faradays-electromagnetic-lab#111 and we observed that the pointer areas did not match the stroked shape. So we tried to enable the "scenery helper" ctrl+shift+H to see what was being hit tested. In doing this and mousing over the coil, we observed that the sim locked up. When pressing "pause" in the dev tools, we saw that the intersection test was detecting nearly 5,000,000 intersections.
Here is the patch we used for testing that simplified the views to just focus on the CoilSegmentNode:
We don't know whether this problem is isolated to the scenery helper, or if it would trigger in calling
getLocalShape
on the CoilSegmentNode directly. But ideally the scenery helper could be use to help with issues like this (it is working properly in other simulations such as Kepler's Laws).