PhysUnits class
Helper class to convert array indices to "physical" units, and to scale ("normalize") the values of the array. Its is used to label x and y axes when the array is displayed as a graph, e.g. using Polyline.
Constructors
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited
Static Methods
-
normalize(
double num, double num2, double normalizedNum2) → double -
Normalizes
num
such thatnum2
would obtain the valuenormalizedNum2
. Returns the respective new value fornum
. IfnormalizedNum2
is null,num
is returned. -
physFromIndex(
double index, double physStart, double physWidth, int n, bool center, bool increasing, double calib) → double -
Returns the physical unit for
index
. Assume you have a data array ofn
points. You want to assign eachindex
of the array a "physical unit", e.g. seconds, Hertz, or whatever. Also assume that there is a linear relationship between indices and unit.physStart
is the unit for index=0.physWidth
is the unit range covered by all indices, from the first to the last one.center
defines whether the computed unit value corresponds exactly toindex
(if false), or to the mean value between to subsequent indices (if true). Either choice can be convenient, depending on the application.increasing
defines whetherphysXRangeStart
will be the smallest value (true, increasing units), or the biggest one (false: decreasing unit).calib
is an optional calibration factor. If not null, bothphysStart
andphysWidth
are multiplied with calib. -
physToIndex(
double physX, double physStart, double physWidth, int n, bool center, bool increasing, double calib) → double -
This is the inverse of
getPhysXFromDataIndex
: Returns the index corresponding to the physcial unitphysX
. -
undoNormalize(
double numNormalized, double num2, double normalizedNum2) → double -
Inverse of normalize: If
numNormalized
was computed by normalize usingnum2
andnormalizedNum2
, this method returns the original valuenum
which was fed into normalize. IfnormalizedNum2
is null,num
is returned.