Skip to main content

Module numeric

Module numeric 

Source
Expand description

NumericInput: a number an operation is given — a length, an angle, a count — typed into a dialog’s number field as a plain value or as a formula of the program’s parameters, which it follows (evaluate). An operation’s arguments take one wherever they take a number. (How a dialog shows one, the editor says.)

A step resolves it where it builds (NumericInput::resolve), reading each parameter the formula names — a target the program defines (parameter): the read is recorded, so a change to one of them rebuilds the step, a change to any other does not.

Structs§

ParameterValues
Every parameter of the part, by name, in the order the steps defining them define them, as each comes to: what lists or designates the part reads. A parameter that failed is left out.

Enums§

NumericInput
A number an operation is given: a plain value, or a formula of the program’s parameters that it follows. Saved as a number when plain, and as {"formula": "width / 2"} otherwise.
ParameterValue
What a parameter of the program comes to, as its target holds it (parameter): a number, or a text — the row of a table a part family is looked up in, by name.

Constants§

FUNCTION_NAMES
The functions a formula can call, by name. Angles are in degrees, as everywhere a designer types one.

Functions§

evaluate
The value of the formula expression, with lookup the value of each parameter it names: numbers, + - * / ^, parentheses, pi, and the functions of FUNCTION_NAMES, with angles in degrees — and, last, one comparison of two of those, < <= > >= == !=, 1 where it holds and 0 where not: what says whether a step runs, length > 40 (crate::program::ProgramStep::active). Fails for anything else, for a name lookup does not know, and for a value that is no finite number.
names_in
The names of parameters expression reads, in order, each once.
parameter
The target of the parameter name: width, or size.d for the column d of the row a table looks up by the parameter size.
parameter_values
The target of every parameter of the part, as they come to.
read_parameter
The number name stands for in a formula, as reader reads it, the read recorded: a number parameter’s value — width, or size.d, a column of the row a table looked up. None where no step defines that parameter, or it failed, or it is no number.
read_parameter_values
Every parameter of the part reader reads, as they come to: none, for a part whose program defines none.