-
Notifications
You must be signed in to change notification settings - Fork 5
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
CT: assertion failure in Graph.computeWindingMap #72
Comments
Still present
|
It fails at this point in 1459 assert && assert( forwardFace !== reversedFace ); /**
* Computes the winding map for each face, starting with 0 on the unbounded face (for each shapeId).
* @private
*/
computeWindingMap() {
const edges = this.edges.slice();
// Winding numbers for "outside" are 0.
const outsideMap = {};
for ( let i = 0; i < this.shapeIds.length; i++ ) {
outsideMap[ this.shapeIds[ i ] ] = 0;
}
this.unboundedFace.windingMap = outsideMap;
// We have "solved" the unbounded face, and then iteratively go over the edges looking for a case where we have
// solved one of the faces that is adjacent to that edge. We can then compute the difference between winding
// numbers between the two faces, and thus determine the (absolute) winding numbers for the unsolved face.
while ( edges.length ) {
for ( let j = edges.length - 1; j >= 0; j-- ) {
const edge = edges[ j ];
const forwardHalf = edge.forwardHalf;
const reversedHalf = edge.reversedHalf;
const forwardFace = forwardHalf.face;
const reversedFace = reversedHalf.face;
assert && assert( forwardFace !== reversedFace );
const solvedForward = forwardFace.windingMap !== null;
const solvedReversed = reversedFace.windingMap !== null;
if ( solvedForward && solvedReversed ) {
edges.splice( j, 1 );
if ( assert ) {
for ( let m = 0; m < this.shapeIds.length; m++ ) {
const id = this.shapeIds[ m ];
assert( forwardFace.windingMap[ id ] - reversedFace.windingMap[ id ] === this.computeDifferential( edge, id ) );
}
}
}
else if ( !solvedForward && !solvedReversed ) {
continue;
}
else {
const solvedFace = solvedForward ? forwardFace : reversedFace;
const unsolvedFace = solvedForward ? reversedFace : forwardFace;
const windingMap = {};
for ( let k = 0; k < this.shapeIds.length; k++ ) {
const shapeId = this.shapeIds[ k ];
const differential = this.computeDifferential( edge, shapeId );
windingMap[ shapeId ] = solvedFace.windingMap[ shapeId ] + differential * ( solvedForward ? -1 : 1 );
}
unsolvedFace.windingMap = windingMap;
}
}
}
} |
This happens rather irregularly on Bayes. My initial assumption is that it is a corner case. Possibly when the spotlight gets so small that it becomes a point on the edge of the projector screen. This would create an a graph union that could potentially fail. This is pure speculation on my part. I have not been able to reproduce it. |
In a setup like below, I can at least get the sim to freeze up (from poor performance, I assume), but I get no error. Until such time that I determine if this screenshot is at all related to this issue, or this is its own issue, I will just leave it here. I got this on Win 10 FF. |
I tried to setup cases where the intersections of two shapes might fail, say a circle "kissing" a rectangle
but that does not trigger an assertion. |
Even the case of disk of radius 0 on the edge of a rectangle is handled correctly.
|
@jonathanolson , I think this is a Kite bug that involves Shape.intersection. We are passing two shapes and want to determine their intersections.
ScreenShape is a fixed, well defined parallelogram. I added some assertions to diskShape to make sure its shape is legit. However, I have not been able to trigger any assertions within geometric optics itself. The assertion that is triggered is within kite. I must admit that I dont understand what computeWindingMap is doing. It would be useful to get some insight into what is going on. Unfortunately, even though this assertion is triggered on a rather regular basis on Bayes, we dont have very clear procedure to trigger it. |
Assigning @jonathanolson to look into it. |
I added assertions to make sure that the two shapes that are passed are appropriate. We will monitor Bayes to see if that proves useful. |
Using BinaryResult instead of the more general intersection method still trigger assertions.
|
(I will be looking into this) |
This is really reproducible ... |
Thanks @kathy-phet. Reduce the slider until you reach the index of refraction 1.36. |
In the above case, it is the "second source" spotlight that fails. |
I tried reproducing using the above instructions in master, and couldn't reproduce. I tried fuzzing for 30 minutes, both with master and a dev version (https://phet-dev.colorado.edu/html/geometric-optics/1.0.0-dev.9/phet/geometric-optics_all_phet_debug.html?fuzz). Thoughts on how I can reproduce? Is it potentially dependent on screen size? Alternatively, if you could toString() both of the shapes being intersected and report that, I could presumably reproduce the kite error from that. |
We have moved the initial position of the source since, and this affects the reproduction instructions. |
I tried to co back to our previous initial positions for the sources but unfortunately we also changed the size and position of the projector screen during a refactor, so I have not been able to reproduce it. |
Considering the comment from @jonathanolson , I'll attempt to go back to a previous commit where KP was able to reproduce it by merely moving the sliders. |
Since this is not in the prototype, unassigning until I start working on public production issues. |
Note that Spotlight was renamed LightSpot, and SpotlightNode was renamed LightSpotNode, per #196. |
Still failing occassionally in CT:
|
We'll need @jonathanolson to take at look at this. Like #163, this is a problem in kite.Graph. |
I'm going to close this because: (1) I haven't seen this in CT since 10/19/21, almost 4 months ago. |
Reopening. While this problem is rare, it's not resolved. I hit it while running the State Wrapper for ~5 minutes in my local copy with |
I fuzzed tested locally for 30 minutes and did not encounter this problem. Test URLs:
|
|
This is a non-blocking error. It won't cause the sim to crash, and is unlikely to result in any noticeable problems in practice. 1.1 was published with this as a known issue. |
In c8f18cd, the implementation changed. LightSpot.ts no longer computes intersection with the projection screen, |
The text was updated successfully, but these errors were encountered: