point_handedness | R Documentation |
Determine which side one point is to another, given a slope or angle
point_handedness(
pt1,
pt2,
slope = NULL,
angle = NULL,
do_plot = FALSE,
verbose = FALSE,
...
)
pt1 |
|
pt2 |
|
slope |
|
do_plot |
|
... |
additional arguments are ignored. |
The result describes the position of the first line relative
to the second line, assuming both lines are parallel with identical slope.
For example "left" indicates that line 1 is on the left side of line 2.
Note that the angle
is a more accurate measure of directionality,
otherwise slope
is always assumed to desribe an angle moving to the right.
When both lines are exactly overlapping, the result may be unstable, however the result tends to favor "right" by default.
character
vector equal to the number of points, nrow(pt1)
:
"right"
indicates pt1
is on the right side of pt2
"left"
indicates pt1
is on the left side of pt2
Other jamses utilities:
choose_annotation_colnames()
,
contrast2comp_dev()
,
fold_to_log2fold()
,
intercalate()
,
list2im_opt()
,
log2fold_to_fold()
,
make_block_arrow_polygon()
,
mark_stat_hits()
,
matrix_normalize()
,
point_slope_intercept()
,
shortest_unique_abbreviation()
,
shrinkDataFrame()
,
shrink_df()
,
shrink_matrix()
,
sort_samples()
,
strsplitOrdered()
,
sub_split_vector()
,
update_function_params()
,
update_list_elements()
pt1 <- matrix(ncol=2, c(1, 1))
pt2 <- matrix(ncol=2, c(2, 2))
point_handedness(pt1, pt2, angle=0, do_plot=TRUE)
point_handedness(pt1=c(1, 1), pt2=c(2, 2), angle=0, do_plot=TRUE)
pt1 <- matrix(ncol=2, c(1, 1))
pt2 <- matrix(ncol=2, c(0, 1))
point_handedness(pt1, pt2, angle=45, do_plot=TRUE)
point_handedness(pt2, pt1, angle=45, do_plot=TRUE)
point_handedness(rbind(pt2, pt2-1), rbind(pt1, pt1-1),
angle=c(45, 45+180), do_plot=TRUE)
point_handedness(pt1, pt2, angle=45, do_plot=TRUE)
title(main="angle = 45,\n(slope = 1)")
point_handedness(pt1, pt2, angle=45 + 180, do_plot=TRUE)
title(main="angle = 225,\n(slope = 1)")
point_handedness(pt1, pt2, slope=Inf, do_plot=TRUE)
title(main="slope = Inf")
point_handedness(pt1, pt2, angle=90, do_plot=TRUE)
title(main="angle = 90")
point_handedness(pt2, pt1, slope=-Inf, do_plot=TRUE)
title(main="slope = -Inf")
point_handedness(pt2, pt1, angle = 270, do_plot=TRUE)
title(main="angle = 270")
point_handedness(pt1, pt2, slope=0, do_plot=TRUE)
point_handedness(pt2, pt1, slope=0, do_plot=TRUE)
pt1 <- matrix(ncol=2, c(-2, 5))
pt2 <- matrix(ncol=2, c(2, 3))
point_handedness(pt1, pt2, slope=1, do_plot=TRUE)
point_handedness(pt1, pt2, slope=-1, do_plot=TRUE)
point_handedness(pt1, pt2, slope=-1/3, do_plot=TRUE)
point_handedness(pt1, pt2, slope=-1/3, do_plot=TRUE)
point_handedness(pt1, pt2, slope=Inf, do_plot=TRUE)
point_handedness(pt1, pt2, slope=-Inf, do_plot=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.