| coo_slice {Momocs} | R Documentation |
Slices shapes between successive coordinates
Description
Takes a shape with n coordinates. When you pass this function with at least two ids (<= n), the shape will be open on the corresponding coordinates and slices returned as a list
Usage
coo_slice(coo, ids, ldk)
Arguments
coo |
|
ids |
|
ldk |
|
Value
a list of shapes or a list of Opn
See Also
Have a look to coo_slidegap if you have problems with gaps after slicing around landmarks and/or starting points.
Other coo_ utilities:
coo_aligncalliper(),
coo_alignminradius(),
coo_alignxax(),
coo_align(),
coo_baseline(),
coo_bookstein(),
coo_boundingbox(),
coo_calliper(),
coo_centdist(),
coo_center(),
coo_centpos(),
coo_close(),
coo_down(),
coo_dxy(),
coo_extract(),
coo_flipx(),
coo_force2close(),
coo_interpolate(),
coo_is_closed(),
coo_jitter(),
coo_left(),
coo_likely_clockwise(),
coo_nb(),
coo_perim(),
coo_range(),
coo_rev(),
coo_right(),
coo_rotatecenter(),
coo_rotate(),
coo_sample_prop(),
coo_samplerr(),
coo_sample(),
coo_scale(),
coo_shearx(),
coo_slidedirection(),
coo_slidegap(),
coo_slide(),
coo_smoothcurve(),
coo_smooth(),
coo_template(),
coo_trans(),
coo_trimbottom(),
coo_trimtop(),
coo_trim(),
coo_untiltx(),
coo_up(),
is_equallyspacedradii()
Examples
h <- slice(hearts, 1:5) # speed purpose only
# single shape, a list of matrices is returned
sh <- coo_slice(h[1], c(12, 24, 36, 48))
coo_plot(sh[[1]])
panel(Opn(sh))
# on a Coo, a list of Opn is returned
# makes no sense if shapes are not normalized first
sh2 <- coo_slice(h, c(12, 24, 36, 48))
panel(sh2[[1]])
# Use coo_slice with `ldk` instead:
# hearts as an example
x <- h %>% fgProcrustes(tol=1)
# 4 landmarks
stack(x)
x$ldk[1:5]
# here we slice
y <- coo_slice(x, ldk=1:4)
# plotting
stack(y[[1]])
stack(y[[2]])
# new ldks from tipping points, new ldks from angle
olea %>% slice(1:5) %>% # for the sake of speed
def_ldk_tips %>%
def_ldk_angle(0.75*pi) %>% def_ldk_angle(0.25*pi) %>%
coo_slice(ldk =1:4) -> oleas
oleas[[1]] %>% stack
oleas[[2]] %>% stack # etc.
# domestic operations
y[[3]] %>% coo_area()
# shape analysis of a slice
y[[1]] %>% coo_bookstein() %>% npoly %>% PCA %>% plot(~aut)