forked from microsoft/calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GraphingEnums.h
575 lines (427 loc) · 16.9 KB
/
GraphingEnums.h
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
namespace Graphing
{
enum class LocalizationType
{
Unknown,
DecimalPointAndListComma,
DecimalPointAndListSemicolon,
DecimalCommaAndListSemicolon
};
enum class EquationParsingMode
{
// Solving an equation. At least one equal sign is required
SolveEquation,
// Graphing an equation. At least one equal sign is required
GraphEquation,
// Not expecting an equation. No equal sign is allowed
NonEquation,
// Accept zero or more equal signs
DoNotCare
};
enum class FormatType
{
// This format is not very human-readable, but best for machine processing and unit test.
// The meaning of an expression is precise, there is no need for parentheses, and it's easy to parse.
// While other serializers may contain little tweaks to make the UI component work as expected, this
// format doesn't change often because no real UI uses it.
// Example: Sum[1,Divide[2,x]]
Formula,
// Similar to Formula, except the variables are in the format of Var(0), Var(1), ... instead of in their names.
// Used in serialization only (CasContext.FormatOptions) but not in parsing (CasContext.ParsingOptions)
// Example: Sum[1,Divide[2,Var(0)]]
InvariantFormula,
// Similar to Formula, except the aggregates (grouping parentheses) are silently removed during serialization.
// The primary usage for this format is in internal test cases.
// When used in parsing, it's identical to Formula
// Example: Sum[1,Divide[2,x]]
FormulaWithoutAggregate,
// This format is the most human-readable one. Can be used in command line applications or application that accept
// and displays linear syntax. Also, the RichEdit wrapper returns linear syntax and it should be parsed with Linear format type.
// Example: 1+2/x
Linear,
// This format is similar to linear format, but during serialization it uses ASCII characters only (except for variable
// named specified by the user) and can round trip back to the linear parser.
//
// When used in parsing it's identical to Linear.
LinearInput,
// The standard MathML format. Note that the math engine can only parse a subset of the syntax in the MathML specification.
// Example: <math><mn>1</mn><mo>+</mo><mfrac><mn>2</mn><mi>x</mi></mfrac></math>
MathML,
// Same as MathML, except this format type won't generate the root element <math> .
// Used in serialization only (CasContext.FormatOptions) but not in parsing (CasContext.ParsingOptions)
// Example: <mn>1</mn><mo>+</mo><mfrac><mn>2</mn><mi>x</mi></mfrac>
MathMLNoWrapper,
// This format type is for the RichEdit wrapper to render math in RichEdit.
//
// Used in serialization only (CasContext.FormatOptions) but not in parsing (CasContext.ParsingOptions)
// Example: 1 + \frac{2,x}
MathRichEdit,
// This format type is for the RichEdit wrapper to render math in RichEdit.
// It's same with MathRichEdit format with one exception: fractions are rendered
// horizontally instead of vertically. This is a better choice if the display area
// is confined with a small height.
//
// Used in serialization only (CasContext.FormatOptions) but not in parsing (CasContext.ParsingOptions)
// Example: 1 + x/(2 a)
InlineMathRichEdit,
// The most compact format. Uses binary data. Like Format, it guarantees round trip between parsing and serialization.
Binary,
// Similar to Binary, except variableIds are used instead of variable name.
InvariantBinary,
// This is the base-64 encoded Binary format
Base64,
// This is the base-64 encoded InvariantBinary format.
InvariantBase64,
// Latex format
// Example: \frac{1}{2}
Latex
};
// Specify on what number field the evaluation should be performed: Real or Complex.
enum class EvalNumberField
{
// This is invalid setting.
Invalid,
// Evaluation should be performed on Real number field
Real,
// Evaluation should be performed on Complex number field
Complex
};
// Specify the evaluation direction: Expand, Factor or Neutral (neither Expand nor Factor)
enum class EvalExpandMode
{
// Neither Expand nor Factor
Neutral,
// To expand during evaluation
Expand,
// To factor during evaluation
Factor
};
// Specify the current trigonometry unit mode: Radians, Degrees, Grads. This has effect on these trig operators:
// Sin Cos Tan Cot Sec Csc
// ASin ACos ATan ACot ASec ACsc.
// It has NO effect on hyperbolic trig operators (same behavior as Windows Calc), and any other operators.
enum class EvalTrigUnitMode
{
// Invalid value.
Invalid,
// Default trig unit. Period of sin is 2pi
Radians,
// Degrees as trig unit. Period of sin is 360 degrees
Degrees,
// Grads as trig unit. Period of sin is 400 grads
Grads
};
// Specifies the type of contextual action
enum class ContextualActionType
{
// The input didn't generate any contextual action
None,
// Solve equation
SolveEquation,
// perform comparison
Compare,
// Expand the expression
Expand,
// Perform a 2D graphing
Graph2D,
// Perform a 2D graphing on all items in the list
ListGraph2D,
// Perform 2D graphing of the two functions on both side of the equal sign or inequality sign
GraphBothSides2D,
// Perform a 3D graphing
Graph3D,
// Perform 3D graphing of the two functions on both side of the equal sign or inequality sign
GraphBothSides3D,
// Perform 2D inequality graphing
GraphInequality,
// Perform assignment
Assign,
// Factor the expression
Factor,
// Compute the derivate of the expression
Deriv,
// Compute the integral of the expression
IndefiniteIntegral,
// Perform 2D graph
Graph2DExpression,
// Perform 3D graph
Graph3DExpression,
// solve the inequality
SolveInequality,
// calculate/simplify the expression
Calculate,
// round of the number
Round,
// floor of the number
Floor,
// ceiling of the number
Ceiling,
// The bit mask for matrix related contextual action types. if (type & MatrixMask)!=0 then the type is matrix related
MatrixMask,
// Compute the determinant of the matrix
MatrixDeterminant,
// Compute the inverse of the matrix
MatrixInverse,
// Compute the trace of the matrix
MatrixTrace,
// Compute the transpose of the matrix
MatrixTranspose,
// Compute the size of the matrix
MatrixSize,
// Compute the reduce of the matrix
MatrixReduce,
// The bit mask for list related contextual action types. if (type & ListMask)!=0 then the type is list related
ListMask,
// Sort the list
ListSort,
// Compute the mean of the list
ListMean,
// Compute the median of the list
ListMedian,
// Compute the mode of the list
ListMode,
// Compute the LCM (least common multiplier) of the list
ListLcm,
// Compute the GCF (greatest common factor) of the list
ListGcf,
// Compute the sum of the list elements
ListSum,
// Compute the product of the list elements
ListProduct,
// Compute the max of the list elements
ListMax,
// Compute the min of the list elements
ListMin,
// Compute the variance of the list elements
ListVariance,
// Compute the standard deviation of the list elements
ListStdDev,
// Show complete (verbose) solution
ShowVerboseSolution,
// bit mask of action type. Can be used to remove the Informational flag
TypeMask, // mask to get the type
// A flag that can be added onto any type. This is informational only that explains what the straight input would do.
// No action should be performed
Informational
};
enum class MathActionCategoryType
{
Unknown,
Calculate,
Solve,
Integrate,
Differentiate,
Algebra,
Matrix,
List,
Graph
};
enum class StepSequenceType
{
None,
Text,
Expression,
NewLine,
NewStep,
Conditional,
Composite,
Goto,
Call,
Return,
Stop,
Error,
GotoTemp
};
enum class FormatVerbosityMode
{
Verbose,
Simple
};
namespace Renderer
{
// Used to indicate what action should be performed to change the range.
enum class ChangeRangeAction
{
// Zoom in on all axes by the predefined ratio
ZoomIn,
// Zoom out on all axes by the predefined ratio
ZoomOut,
// Zoom out on X axis only, leave the range of Y (and Z in 3D) unchanged
WidenX,
// Zoom in on X axis only, leave the range of Y (and Z in 3D) unchanged
ShrinkX,
// Zoom out on Y axis only, leave the range of X (and Z in 3D) unchanged
WidenY,
// Zoom in on Y axis only, leave the range of X (and Z in 3D) unchanged
ShrinkY,
// Zoom out on Z axis only, leave the range of X and Y unchanged. Apply to 3D graph only but not 2D graph.
WidenZ,
// Zoom in on Z axis only, leave the range of X and Y unchanged. Apply to 3D graph only but not 2D graph.
ShrinkZ,
// Move the view window of the graph towards the negative X axis.
MoveNegativeX,
// Move the view window of the graph towards the positive X axis.
MovePositiveX,
// Move the view window of the graph towards the negative Y axis.
MoveNegativeY,
// Move the view window of the graph towards the positive Y axis.
MovePositiveY,
// Move the view window of the graph towards the negative Z axis.
MoveNegativeZ,
// Move the view window of the graph towards the positive Z axis.
MovePositiveZ,
// Zoom in on all axes by the predefined ratio. The ratio is smaller than used in ZoomIn result in a smoother motion
SmoothZoomIn,
// Zoom out on all axes by the predefined ratio. The ratio is smaller than used in ZoomIn result in a smoother motion
SmoothZoomOut,
// Zoom in on all axes by the predefined ratio
PinchZoomIn,
// Zoom out on all axes by the predefined ratio
PinchZoomOut
};
enum class LineStyle
{
Solid,
Dot,
Dash,
DashDot,
DashDotDot
};
}
namespace Analyzer
{
// Graph Analyzer Messages
enum GraphAnalyzerMessage
{
// "No data"
GraphAnalyzerMessage_None = 0,
// "No zeros"
GraphAnalyzerMessage_NoZeros = 1,
// "No y-intercept"
GraphAnalyzerMessage_NoYIntercept = 2,
// "No minima"
GraphAnalyzerMessage_NoMinima = 3,
// "No maxima"
GraphAnalyzerMessage_NoMaxima = 4,
// "No inflection points"
GraphAnalyzerMessage_NoInflectionPoints = 5,
// "No vertical asymptotes"
GraphAnalyzerMessage_NoVerticalAsymptotes = 6,
// "No horizontal asymptotes"
GraphAnalyzerMessage_NoHorizontalAsymptotes = 7,
// "No oblique asymptotes"
GraphAnalyzerMessage_NoObliqueAsymptotes = 8,
// "Not able to calculate"
GraphAnalyzerMessage_NotAbleToCalculate = 9,
// "Not able to mark all graph features"
GraphAnalyzerMessage_NotAbleToMarkAllGraphFeatures = 10,
// These features are too complex for {APPLICATION_NAME} to calculate
GraphAnalyzerMessage_TheseFeaturesAreTooComplexToCalculate = 11,
// "This feature is too complex for {APPLICATION_NAME} to calculate"
GraphAnalyzerMessage_ThisFeatureIsTooComplexToCalculate = 12
};
// define which data should be filled into result object
enum AnalysisType
{
// fill domain data
AnalysisType_Domain = 0,
// fill range data
AnalysisType_Range = 1,
// fill parity data
AnalysisType_Parity = 2,
// fill zeros
AnalysisType_Zeros = 3,
// fill interception with y axis
AnalysisType_YIntercept = 4,
// fill minima
AnalysisType_Minima = 5,
// fill maxima
AnalysisType_Maxima = 6,
// fill inflection points
AnalysisType_InflectionPoints = 7,
// fill vertical asymptotes
AnalysisType_VerticalAsymptotes = 8,
// fill horizontal asymptotes
AnalysisType_HorizontalAsymptotes = 9,
// fill oblique asymptotes
AnalysisType_ObliqueAsymptotes = 10,
// fill monotonicity
AnalysisType_Monotonicity = 11,
// fill period
AnalysisType_Period = 12
};
// define which additional data should be calculated
enum class PerformAnalysisType
{
// Calculate nothing
// PerformAnalysisType_None = 0x0,
// Calculate domain data
PerformAnalysisType_Domain = 0x01,
// Calculate range data
PerformAnalysisType_Range = 0x02,
// Calculate parity data
PerformAnalysisType_Parity = 0x04,
// Calculate zeros and interception with y axis
PerformAnalysisType_InterceptionPointsWithXAndYAxis = 0x08,
// Calculate Extrema and inflection points
PerformAnalysisType_CriticalPoints = 0x10,
// Calculate asymptotes
PerformAnalysisType_Asymptotes = 0x20,
// Calculate monotonicity
PerformAnalysisType_Monotonicity = 0x40,
// Calculate period
PerformAnalysisType_Period = 0x80,
// Calculate all additional data
PerformAnalysisType_All = 0xFF
};
// function parity for function analysis
enum class FunctionParityType
{
// parity not calculated or not possible to calculate
FunctionParityType_Unknown = 0,
// parity is odd
FunctionParityType_Odd = 1,
// parity is even
FunctionParityType_Even = 2,
// function is not odd nor even
FunctionParityType_None = 3
};
// monotonicity direction for function analysis
enum class FunctionMonotonicityType
{
// unknown or not calculated
FunctionMonotonicityType_Unknown = 0,
// ascending monotonicity on interval
FunctionMonotonicityType_Ascending = 1,
// descending monotonicity on interval
FunctionMonotonicityType_Descending = 2,
// constant monotonicity on interval
FunctionMonotonicityType_Constant = 3
};
// asymptote description for function analysis
enum class AsymptoteType
{
// unknown or not calculated
AsymptoteType_Unknown = 0,
// when x goes to positive infinity
AsymptoteType_PositiveInfinity = 1,
// when x goes to negative infinity
AsymptoteType_NegativeInfinity = 2,
// when x goes to positive or negative infinity
AsymptoteType_AnyInfinity = 3
};
// function periodicity for function analysis
enum class FunctionPeriodicityType
{
// periodicity not calculated or not possible to calculate
FunctionPeriodicityType_Unknown = 0,
// parity is odd
FunctionPeriodicityType_Periodic = 1,
// parity is even
FunctionPeriodicityType_NotPeriodic = 2
};
}
}