Closed KatieWoe closed 1 year ago
It's unclear what is being proposed here. @amanda-phet how would you change things?
@veillette this one is more in your wheelhouse.
Let me know if you want to discuss.
Yes will do
The CurveManipulationDisplayNode has the same x-range has the actual curve, that is from 0-10, but the yRange is different. It goes -0.25 to 1.25 whereas the graph y range goes from -2 to 2. The slider aspect ration is 4/10 just as the graph.
As a result of the different model y-range for the slider, the actual aspect ratio is off by a factor of 8/3 or 2.66.
The reason for the non symmetric y range was of the slider is that most of our functions are not symmetric over the y-range (the only exception being the sinusoid function). As a result we handle the sinuosoid function with a vertical shift (see below)
if ( mode === CurveManipulationMode.HILL ) {
curve.hill( width, xCenter, yMax );
}
else if ( mode === CurveManipulationMode.TRIANGLE ) {
curve.triangle( width, xCenter, yMax );
}
else if ( mode === CurveManipulationMode.PEDESTAL ) {
curve.pedestal( width, xCenter, yMax );
}
else if ( mode === CurveManipulationMode.PARABOLA ) {
curve.parabola( width, xCenter, yMax );
}
else if ( mode === CurveManipulationMode.SINUSOID ) {
curve.sinusoid( width, xCenter, yMax / 2 );
curve.shift( xCenter, yMax );
}
else if ( mode === CurveManipulationMode.FREEFORM ) {
CurveManipulationIconNode.freeformIconCurve( curve, yMin, yMax );
}
else if ( mode === CurveManipulationMode.TILT ) {
curve.tilt( xMax, yMax );
}
else if ( mode === CurveManipulationMode.SHIFT ) {
curve.shift( xMax, yMin );
}
else {
throw new Error( `unsupported mode: ${mode}` );
}
We could potentially use a symmetric y-range and draw all the curves with an offset, except for the sinusoid. If we did so, the triangle slope would match on the slider and the graph.
if ( mode === CurveManipulationMode.HILL ) {
curve.hill( width, xCenter, 2*yMax );
curve.shift( 0,- yMax);
}
else if ( mode === CurveManipulationMode.TRIANGLE ) {
curve.triangle( width, xCenter, 2*yMax );
curve.shift( 0,- yMax );
}
else if ( mode === CurveManipulationMode.PEDESTAL ) {
curve.pedestal( width, xCenter, 2*yMax );
curve.shift( 0,- yMax );
}
else if ( mode === CurveManipulationMode.PARABOLA ) {
curve.parabola( width, xCenter, 2*yMax );
curve.shift( 0,- yMax );
}
else if ( mode === CurveManipulationMode.SINUSOID ) {
curve.sinusoid( width, xCenter, yMax );
}
else if ( mode === CurveManipulationMode.FREEFORM ) {
CurveManipulationIconNode.freeformIconCurve( curve, yMin, 2*yMax );
curve.shift( 0,- yMax );
}
else if ( mode === CurveManipulationMode.TILT ) {
curve.tilt( xMax, 2*yMax );
curve.shift( 0,- yMax );
}
else if ( mode === CurveManipulationMode.SHIFT ) {
curve.shift( xMax, yMin );
}
else {
throw new Error( `unsupported mode: ${mode}` );
}
Let me work on a patch which would better for a side-by-side comparison.
By the way the flash simulation shows a similar behavior as our current implementation.
So there is a tension about respecting the aspect ratio and maximizing the vertical real estate. As you can see in the graph below, no portion of the triangle function is visible for the negative y-axis.
Our CurveManipulationDisplayNode attempts to maximize the usage of vertical space. However, as @KatieWoe pointed out, this result in not preserving the aspect ratio.
The patch below preserved the aspect ratio but since most of the functions are one-sided, that it, their y-values are solely positive, than there is a bit more blank space.
@pixelzoom and I went back and forth about an appropriate solution. We settled on maintaining the aspect ratio of the curve manipulation display node such that the y -range is the same on the graph.
// model height associated with curveManipulationDisplay
CURVE_MANIPULATION_Y_RANGE: new Range( -2, 2 ),
The curves themselves have been shifted a bit downward display has been shifted a bit, such that there is a bit of negative space above and below the curve. See the triangle
and parabola
On the fourth screen, the graphs themselves are not isometric, whereas our slider display is isometric, so there is a slight mismatch in the aspect ratio (although it is still an improvement over the previous mismatch noted by @KatieWoe) See for the triangle
It is a lot of small tweaks that affects all the curve manipulation modes so perhaps it would be easier for @amanda-phet to take a look on master. I would be happy to walk you through the changes.
This is an excellent improvement. Nice suggestion @KatieWoe.
This is looking great to me. Thanks @KatieWoe for suggesting it.
Thanks @amanda-phet for the thumbs up. At this point, the commit is already on master, but we will need to cheery pick it on the RC branch.
The commit was pushed on the 1.0 branch.
To verify in the next RC:
In PhET brand, verify that:
Following https://github.com/phetsims/calculus-grapher/issues/332#issuecomment-1505949723, this looks good in rc.2. Closing.
Reopening because I also see this with the hill and the width of the pedestal, and even the sin wave to an extent. Should those be looked at too?
@KatieWoe FYI From slack this morning: Nancy Salpepi 10:09 AM Hey Martin! For https://github.com/phetsims/calculus-grapher/issues/332, the slope should only match the triangle and parabola? For other modes if I only press slightly above the x-axis to make a curve, it is usually wider than what it shown for the slider. Is that OK?
Martin Veillette :house_with_garden: 10:12 AM That's right, for the other modes, the width should match but in proportion of the x-range, so if the width is 20% of the slider with, than its width will be 20% of the x-range on the graph.
Correct, this is just for the triangle and parabola.
Test device Samsung and iPad Operating System Win 11 and iPadOS 16 Browser Chrome and Safari Problem description For https://github.com/phetsims/qa/issues/924 The curve that is created on a line is more obtuse than the image shown on the slider. This is easiest to see with the triangle since it is easiest to see it's angle. Discussed with @amanda-phet and we thought it was worth a look. Steps to reproduce
Visuals
Troubleshooting information: