phetsims / calculus-grapher

"Calculus Grapher" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
4 stars 4 forks source link

False positive: Discontinuities are triggered in smooth sections of curves. #246

Closed veillette closed 1 year ago

veillette commented 1 year ago

In https://github.com/phetsims/calculus-grapher/issues/218 @amanda-phet noted that a case where it was relatively to generate discontinuities in cases that were unwarranted.

This situation is just drawing a random-ish curve, nothing too fancy or unusual.

veillette commented 1 year ago

@amanda-phet was able to generate (easily) discontinuities that did not go away even after using the smooth button.

In #208, we have come up with a new approach to assign cusps and discontinuities. Instead of relying on a detection algorithm to notice discontinuities and cusps, we explicitly assign a point type to particular points after some curve manipulation. In the case of smooth, we explicitly tag all points to a smooth type. As a result, there are no longer any discontinuities and cusps after a smooth operation.

public smooth(): void {
    ...

    // Loops through each Point of the curve and set the new y-value.
    this.points.forEach( point => {

      ...

      // Set all points to smooth type;
      point.pointType = 'smooth';
    } );
}

Assigning to @amanda-phet to see if she can run a cursory test to check the presence/absence of discontinuities.

veillette commented 1 year ago

I'm going to close this issue. Instead we will create an issue (#292) to let the QA team be on the lookout for this kind of problems.