coo_slice: Slices shapes between successive coordinates

Description Usage Arguments Value See Also Examples

View source: R/coo-utilities.R

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

1
coo_slice(coo, ids, ldk)

Arguments

coo

matrix of (x; y) coordinates or any Coo object.

ids

numeric of length >= 2, where to slice the shape(s)

ldk

numeric the id of the ldk to use as ids, only on Out and Opn. If provided, ids will be ignored.

Value

a list of shapes or a list of Opn

See Also

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_up, is_equallyspacedradii

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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)

Momocs documentation built on March 23, 2018, 1:04 a.m.