coo_intersect_angle | R Documentation |
Take a shape, and segment starting on the centroid and having a particular angle, which point is the nearest where the segment intersects with the shape?
coo_intersect_angle(coo, angle = 0)
coo_intersect_direction(coo, direction = c("down", "left", "up", "right")[4])
## Default S3 method:
coo_intersect_direction(coo, direction = c("down", "left", "up", "right")[4])
## S3 method for class 'Coo'
coo_intersect_direction(coo, direction = c("down", "left", "up", "right")[4])
coo |
|
angle |
|
direction |
|
numeric
the id of the nearest point or a list
for Coo
See examples.
shapes are always centered before this operation. If you need a simple
direction such as (down, left, up, right)ward
, then use coo_intersect_direction which
does not need to find an intersection but relies on coordinates and is about 1000.
Other coo_ intersect:
coo_intersect_segment()
coo <- bot[1] %>% coo_center %>% coo_scale
coo_plot(coo)
coo %>% coo_intersect_angle(pi/7) %>%
coo[., , drop=FALSE] %>% points(col="red")
# many angles
coo_plot(coo)
sapply(seq(0, pi, pi/12),
function(x) coo %>% coo_intersect_angle(x)) -> ids
coo[ids, ] %>% points(col="blue")
coo %>%
coo_intersect_direction("down") %>%
coo[.,, drop=FALSE] %>% points(col="orange")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.