Make degrees angles into clockwise arc
Value
data.frame
with three columns:
'x'
: thenumeric
vector of degrees, sorted in increasing order, with values adjusted so that the difference between angle is positive, and has consistent numeric difference. When the arc crosses zero, the first angle will therefore be negative.'idx'
: theinteger
index position of inputdegrees
, which may be used as the equivalent oforder()
.'xdiff'
: the numeric difference between each degree angle, and the next angle in the sequence. The last value should always be the largest, representing the gap between the end of the arc, and the start of the arc.
Details
The purpose is very specific, it takes a vector of degree angles, determines the correct sequence of angles to constitute the proper arc. A proper arc is defined as a series of points where there is only one "largest gap" and this gap represents the open space. When the arc crosses zero, angles are shifted to negative values so that the numeric difference between each angle is consistent.
For this purpose, "clockwise" is defined "increasing numeric order".
The assumption is that values in x
only represent one contiguous arc,
that does not loop around itself, and therefore that values in x
may be provided in any order. Values returned will be sorted to start
with the first angle in the series, so that the last angle in the
series is positive and less than 360. If the arc crosses zero, the
first value in the series will be negative.
See also
Other venndir internal:
assemble_venndir_label()
,
assign_degree_groups()
,
check_systemfonts_family()
,
expand_range()
,
get_venn_polygon_shapes()
,
make_venn_combn_df()
,
match_list()
,
print_color_df()
,
render_venndir_footnotes()
,
shrink_df()
,
simple_ellipse()
,
subset_systemfonts()
,
venndir_label_style()
,
venndir_to_df()
Examples
x <- c(355, 5, 10, 350, 15, 20)
make_degrees_clockwise(x)
#> x idx xdiff
#> 4 -10 4 5
#> 1 -5 1 10
#> 2 5 2 5
#> 3 10 3 5
#> 5 15 5 5
#> 6 20 6 330
# re-order the original angles
x[make_degrees_clockwise(x)$idx]
#> [1] 350 355 5 10 15 20
make_degrees_clockwise(c(100, 200))
#> x idx xdiff
#> 1 100 1 100
#> 2 200 2 260
make_degrees_clockwise(c(200, 100, 300) + 110)
#> x idx xdiff
#> 2 -150 2 100
#> 1 -50 1 100
#> 3 50 3 160