Closed pixelzoom closed 1 year ago
Here's the relevant code in PointOnParabolaLinesNode.ts, failing at the assertion at line 65, which was added during TypeScript conversion. I'm guessing that this was always a problem, and that quadratic.directrix
was being coerced to zero on 71. I'm not sure how a quadratic can be a parabola and not have a directrix.
// update the lines
Multilink.multilink( [ quadraticProperty, pointOnParabolaProperty ],
( quadratic, pointOnParabola ) => {
assert && assert( quadratic.isaParabola(), `expected a parabola, quadratic=${quadratic}` );
assert && assert( quadratic.focus );
65 assert && assert( quadratic.directrix );
const pointView = modelViewTransform.modelToViewPosition( pointOnParabola );
const focusView = modelViewTransform.modelToViewPosition( quadratic.focus! );
71 const directrixView = modelViewTransform.modelToViewY( quadratic.directrix! );
focusLine.setLine( pointView.x, pointView.y, focusView.x, focusView.y );
directrixLine.setLine( pointView.x, pointView.y, pointView.x, directrixView );
} );
I could not reproduce this locally using brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=false
. I also tried added screens=4
, since this code is specific to the "Focus & Directrix" screen.
Unassigning for now, to be investigated when this sim is worked on again.
Fixed in the above commit. quadratic.directrix
is defined as public readonly directrix?: number
, and may be zero. So the assertion must be:
- assert && assert( quadratic.directrix );
+ assert && assert( quadratic.directrix !== undefined );
Probably introduced in TypeScript conversion.