Validate h1,h2 color hue warp data, internal function
Usage
validate_colorjam_preset(
h1 = NULL,
h2 = NULL,
direction = NULL,
default_step = NULL,
preset = NULL,
digits = 4,
...
)
Arguments
- h1, h2
numeric
color hue in degrees- direction
numeric
with one of two accepted values:1
: (default) indicating forward (increasing, clockwise) progression around the color wheel-1
: indicating reverse (decreasing, counter-clockwise) progression around the color wheel.
- digits
numeric
passed toround()
before comparingh2
values for duplicated values.- ...
additional arguments are ignored.
Value
list
with components:
h1
: HCL color hue indicating the actual hue to be used when generating a color.h2
: HCL color hue indicating the virtual hue assigned to each actual hue inh1
.direction
: with1
indicating forward (increasing, clockwise) progression around the color wheel, and-1
indicating reverse (decreasing, counter-clockwise) progression around the color wheel.default_step
:character
string with name matching a value returned bycolorjam_steps()
Details
Validate the h1
,h2
color hue values alongside the direction
the angles should proceed. This function handles cases where
h2
contains duplicate values, which is used to remove a
section of h1
from the output h2
color wheel. Duplicated
values are not handled well by approx()
, so this function
rounds values to 4 digits, then sorts data based upon direction
,
then finally adjusts any duplicated h2
values by adding
1e-8
.
Processing steps:
h1
,h2
angles are adjusted within rangec(0, 360)
usingx %% 360
.h1
,h2
values are rounded usinground(x, digits=digits)
h1
,h2
values are sorted byh2
increasing, andh1
in order ofdirection
Duplicated
h2
values are adjusted by addingc(0, 1, 2, ...) + 1e-8
to each duplicated value, per set of duplicated values. The first duplicated value in each set is unchanged, and subsequent values in the set are increased by1e-8
.
TODO:
Enforce sensible ordering of values, mainly so the R-shiny app h1,h2 edited values will permit pushing identical values. For example, two identical
h2
values cause the correspondingh1
values to be skipped, thus removing that range of hues. When oneh2
value is increased, it should also increase subsequent values.
See also
Other colorjam hue warp:
add_colorjam_preset()
,
add_colorjam_step()
,
adjust_hue_warp()
,
approx_degrees()
,
colorjam_presets()
,
colorjam_steps()
,
display_degrees()
,
h2hw()
,
h2hwOptions()
,
hcl_to_hsl_hue()
,
hsl_to_hcl_hue()
,
hw2h()
,
mean_angle()
,
plot_colorjam_preset()
,
remap_colorjam_preset()