-
Notifications
You must be signed in to change notification settings - Fork 4
/
CalculusGrapherQueryParameters.ts
176 lines (149 loc) · 5.86 KB
/
CalculusGrapherQueryParameters.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// Copyright 2020-2024, University of Colorado Boulder
/**
* Query parameters supported by this simulation.
*
* @author Brandon Li
* @author Martin Veillette
* @author Chris Malley (PixelZoom, Inc.)
*/
import logGlobal from '../../../phet-core/js/logGlobal.js';
import calculusGrapher from '../calculusGrapher.js';
import CalculusGrapherConstants from './CalculusGrapherConstants.js';
export const ConnectDiscontinuitiesValues = [ 'noLine', 'dashedLine' ];
export type ConnectDiscontinuities = ( typeof ConnectDiscontinuitiesValues )[ number ];
export const DerivativeNotationValues = [ 'lagrange', 'leibniz' ] as const;
export type DerivativeNotation = ( typeof DerivativeNotationValues )[number];
export const FunctionVariableValues = [ 'x', 't' ] as const;
export type FunctionVariable = ( typeof FunctionVariableValues )[number];
const CalculusGrapherQueryParameters = QueryStringMachine.getAll( {
//====================================================================================================================
// public
//====================================================================================================================
// Initial value of the 'Variable' preference.
// The function variable to be used throughout the simulation
functionVariable: {
type: 'string',
defaultValue: 'x',
validValues: FunctionVariableValues,
public: true
},
// Initial value of the 'Notation' preference.
// The derivative notation to be used throughout the simulation
derivativeNotation: {
type: 'string',
defaultValue: 'lagrange',
validValues: DerivativeNotationValues,
public: true
},
// Initial value of the 'Discontinuities' preference.
// Whether to connect discontinuities with nothing or a dashed line
connectDiscontinuities: {
type: 'string',
defaultValue: 'noLine',
validValues: ConnectDiscontinuitiesValues,
public: true
},
// Initial value of the 'Values' preference.
// Shows numerical values wherever they appear in the sim: tick labels, tangent-line slope, etc.
valuesVisible: {
type: 'boolean',
defaultValue: false,
public: true
},
// Initial value of the 'Predict' preference.
// Determines whether features related to the predict curve are shown in the UI.
predict: {
type: 'boolean',
defaultValue: false,
public: true
},
// Whether the 'Show f(x)' checkbox will be shown when in 'Predict' mode.
hasShowOriginalCurveCheckbox: {
type: 'boolean',
defaultValue: true,
public: true
},
//====================================================================================================================
// private - for internal use only
//====================================================================================================================
/**
* The Curves for 'Calculus Grapher' are discretized into equally spaced points. The higher the numberOfPoints
* the more faithful is the reproduction of a curve. For values less than 400 points, oddities
* are apparent for the underTheCurveTool and tangentTool (see https://github.com/phetsims/calculus-grapher/issues/176)
*/
numberOfPoints: {
type: 'number',
isValidValue: value => value > 0,
defaultValue: 1251
},
/**
* The smooth algorithm for 'Calculus Grapher' uses a procedure described in https://en.wikipedia.org/wiki/Kernel_smoother.
* using a Gaussian kernel. The value below is the standard deviation of the Gaussian function kernel.
* The larger the standard deviation is, the smoother the function.
*/
smoothingStandardDeviation: {
type: 'number',
isValidValue: value => value > 0,
defaultValue: 0.005 * CalculusGrapherConstants.CURVE_X_RANGE.getLength()
},
/**
* The pedestal mode creates a smooth and continuous trapezoidal-shaped curve with rounded corners.
* The rounded corners are set by a constant called edgeSlopeFactor.
* A larger value creates a wider edge.
* https://github.com/phetsims/calculus-grapher/issues/75
*/
edgeSlopeFactor: {
type: 'number',
isValidValue: value => value >= 0,
defaultValue: 0.04 * CalculusGrapherConstants.CURVE_X_RANGE.getLength()
},
/**
* The maximum tilting (slope) of curves relative to the horizontal. Used for Tilt in Curve Manipulation Mode
* See https://github.com/phetsims/calculus-grapher/issues/26
*/
maxTilt: {
type: 'number',
isValidValue: value => value > 0,
defaultValue: 3
},
// Shows all the curve points as circles in a scatter plot.
allPoints: {
type: 'boolean',
defaultValue: false
},
// Shows the cusp points on a curve as circles in a scatter plot
cuspPoints: {
type: 'boolean',
defaultValue: false
},
// For debugging, to make all LabeledLine instances initially visible.
labeledLinesVisible: {
type: 'boolean',
defaultValue: false
},
// For debugging, to make all LabeledPoint instances initially visible.
labeledPointsVisible: {
type: 'boolean',
defaultValue: false
},
// Alpha for CalculusGrapherColors.integralPositiveFillProperty, so that PhET designer can fine-tune
// See https://github.com/phetsims/calculus-grapher/issues/166
positiveAlpha: {
type: 'number',
isValidValue: alpha => ( alpha > 0 && alpha <= 1 ),
defaultValue: 0.25
},
// Alpha for CalculusGrapherColors.integralPositiveFillProperty, so that PhET designer can fine-tune
// See https://github.com/phetsims/calculus-grapher/issues/166
negativeAlpha: {
type: 'number',
isValidValue: alpha => ( alpha > 0 && alpha <= 1 ),
defaultValue: 0.55
}
} );
calculusGrapher.register( 'CalculusGrapherQueryParameters', CalculusGrapherQueryParameters );
// Log query parameters
logGlobal( 'phet.chipper.queryParameters' );
logGlobal( 'phet.preloads.phetio.queryParameters' );
logGlobal( 'phet.calculusGrapher.CalculusGrapherQueryParameters' );
export default CalculusGrapherQueryParameters;