Closed veillette closed 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.
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.
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.